AI返回模板内容:
(注:由于未接收到实际图片内容,无法进行基于视觉信息的精准分析。
根据系统提示,需严格基于图片实际内容展开分析,但当前缺少核心视觉素材...)
文件: stage-requirements.component.ts (lines 3320-3379)
功能:上传成功后自动创建ProjectFile记录
const ProjectFile = Parse.Object.extend('ProjectFile');
const projectFile = new ProjectFile();
projectFile.set('project', { __type: 'Pointer', className: 'Project', objectId: this.projectId });
projectFile.set('name', file.name);
projectFile.set('url', uploadedFile.url);
projectFile.set('type', file.type);
projectFile.set('size', file.size);
projectFile.set('extension', fileExt);
projectFile.set('category', 'ai_design_reference'); // 标记类别
if (this.aiDesignCurrentSpace?.id) {
projectFile.set('product', { __type: 'Pointer', className: 'Product', objectId: this.aiDesignCurrentSpace.id });
projectFile.set('data', {
spaceId: this.aiDesignCurrentSpace.id,
spaceName: this.aiDesignCurrentSpace.name,
uploadedFor: 'ai_design_analysis',
uploadedAt: new Date().toISOString()
});
}
await projectFile.save();
控制台日志:
💾 ProjectFile记录已创建: xyzabc123
文件: design-analysis-ai.service.ts (lines 74-175)
原因:项目中成功使用vision的唯一方式是completionJSON,而不是FmodeChatCompletion
const result = await completionJSON(
prompt,
'', // 不使用JSON schema
undefined, // 不使用流式回调
2, // 重试次数
{
model: this.AI_MODEL,
vision: true,
images: encodedImages, // 图片URL数组
max_tokens: 8000
}
);
文件: design-analysis-ai.service.ts (lines 46-58)
功能:处理中文文件名
const encodedImages = options.images.map(url => {
try {
const urlObj = new URL(url);
const pathname = urlObj.pathname;
const encodedPathname = pathname.split('/')
.map(segment => encodeURIComponent(decodeURIComponent(segment)))
.join('/');
return urlObj.origin + encodedPathname + urlObj.search;
} catch (e) {
console.warn('⚠️ URL编码失败,使用原始URL:', url);
return url;
}
});
控制台应显示:
📤 准备上传文件: test.jpg, 大小: 2.5MB
📂 上传路径: ai-design-analysis/iKvYck89zE
上传进度: 100%
✅ 文件上传成功: https://file-cloud.fmode.cn/.../test.jpg
💾 ProjectFile记录已创建: abc123xyz
如果没有显示"ProjectFile记录已创建":
手动测试:
如果无法访问:
控制台应显示:
🤖 调用豆包1.6模型...
📸 原始图片URL: ["https://file-cloud.fmode.cn/.../test.jpg"]
📸 编码后URL: ["https://file-cloud.fmode.cn/.../%E6%B5%8B%E8%AF%95.jpg"]
📸 图片数量: 1
🚀 开始调用completionJSON进行vision分析...
检查图片URL列表:
[]blob:http://...正常情况:
✅ AI分析完成,原始内容长度: 1523
📝 AI返回内容预览: 一、空间定位与场景属性...
异常情况:
❌ AI无法访问图片!
🔍 AI返回的完整内容: (注:由于未接收到实际图片内容...
🔍 图片URL列表: [...]
问题:AI服务无法访问需要登录的URL
解决方案:
验证方法: 在浏览器隐身模式中打开图片URL,应该能直接看到图片
问题:completionJSON可能只支持base64图片
测试方案:修改为base64传递
// 将图片转换为base64
async function urlToBase64(url: string): Promise<string> {
const response = await fetch(url);
const blob = await response.blob();
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result as string);
reader.onerror = reject;
reader.readAsDataURL(blob);
});
}
// 在AI服务中使用
const base64Images = await Promise.all(
encodedImages.map(url => urlToBase64(url))
);
const result = await completionJSON(
prompt,
'',
undefined,
2,
{
model: this.AI_MODEL,
vision: true,
images: base64Images, // 使用base64而不是URL
max_tokens: 8000
}
);
问题:当前版本的completionJSON可能不支持vision或images参数
验证方法:
fmode-ng版本问题:fmode-1.6-cn模型可能不支持多模态
解决方案:
优点:
缺点:
实现:见"原因2"的代码
如果fmode-ng的vision支持有问题,考虑:
📤 准备上传文件: 客厅设计.jpg, 大小: 3.2MB
✅ 文件上传成功: https://file-cloud.fmode.cn/project/abc123/客厅设计.jpg
💾 ProjectFile记录已创建: pf_xyz789
🤖 调用豆包1.6模型...
📸 原始图片URL: ["https://file-cloud.fmode.cn/project/abc123/客厅设计.jpg"]
📸 编码后URL: ["https://file-cloud.fmode.cn/project/abc123/%E5%AE%A2%E5%8E%85%E8%AE%BE%E8%AE%A1.jpg"]
🚀 开始调用completionJSON进行vision分析...
✅ AI分析完成,原始内容长度: 2341
📝 AI返回内容预览: 一、空间定位与场景属性
这是一个现代法式风格的客餐厅一体化空间...
📤 准备上传文件: 卧室.jpg, 大小: 2.1MB
✅ 文件上传成功: https://file-cloud.fmode.cn/project/abc123/卧室.jpg
💾 ProjectFile记录已创建: pf_xyz456
🤖 调用豆包1.6模型...
📸 原始图片URL: ["https://file-cloud.fmode.cn/project/abc123/卧室.jpg"]
📸 编码后URL: ["https://file-cloud.fmode.cn/project/abc123/%E5%8D%A7%E5%AE%A4.jpg"]
🚀 开始调用completionJSON进行vision分析...
❌ AI无法访问图片!
🔍 AI返回的完整内容: (注:由于未接收到实际图片内容,无法进行基于视觉信息的精准分析...
🔍 图片URL列表: ["https://file-cloud.fmode.cn/project/abc123/%E5%8D%A7%E5%AE%A4.jpg"]
错误信息:AI无法访问图片。可能原因:
1. 图片URL无法被AI服务访问
2. 图片格式不支持
3. 图片过大或损坏
更新日期: 2025-11-27
状态: 🔧 调试中,等待用户反馈