diff --git a/components/SmartChatBox/api.ts b/components/SmartChatBox/api.ts index b636870..9795258 100644 --- a/components/SmartChatBox/api.ts +++ b/components/SmartChatBox/api.ts @@ -314,7 +314,7 @@ function transformSystemMessage( type: 'progress', value: customData.completed_count, total: customData.total_count, - label: `已生成 ${customData.completed_count} 个演员,剧本中共有 ${customData.total_count} 个` + label: `已完成 ${customData.completed_count} 个演员,共有 ${customData.total_count} 个` }, { type: 'text', text: `\n\n${content}` @@ -337,7 +337,7 @@ function transformSystemMessage( type: 'progress', value: customData.completed_count, total: customData.total_count, - label: `已生成 ${customData.completed_count} 个场景,剧本中共有 ${customData.total_count} 个` + label: `已完成 ${customData.completed_count} 个场景,共有 ${customData.total_count} 个` }, { type: 'text', text: `\n\n${content}` @@ -360,7 +360,7 @@ function transformSystemMessage( type: 'progress', value: customData.completed_count, total: customData.total_count, - label: `已生成 ${customData.completed_count} 个故事板静帧,剧本中共有 ${customData.total_count} 个` + label: `已完成 ${customData.completed_count} 个故事板静帧,共有 ${customData.total_count} 个` }, { type: 'text', text: `\n\n${content}` @@ -387,7 +387,7 @@ function transformSystemMessage( type: 'progress', value: customData.completed_count, total: customData.total_count, - label: `已生成 ${customData.completed_count} 个分镜视频,剧本中共有 ${customData.total_count} 个` + label: `已完成 ${customData.completed_count} 个分镜,共有 ${customData.total_count} 个分镜` }, { type: 'text', text: `\n\n${content}` @@ -415,19 +415,24 @@ function transformMessage(apiMessage: RealApiMessage): ChatMessage { }; if (role === 'assistant' || role === 'user') { - const contentObj = JSON.parse(content); - const contentArray = Array.isArray(contentObj) ? contentObj : [contentObj]; - contentArray.forEach((c: ApiMessageContent) => { - if (c.type === "text") { - message.blocks.push({ type: "text", text: c.content }); - } else if (c.type === "image") { - message.blocks.push({ type: "image", url: c.content }); - } else if (c.type === "video") { - message.blocks.push({ type: "video", url: c.content }); - } else if (c.type === "audio") { - message.blocks.push({ type: "audio", url: c.content }); - } - }); + try { + const contentObj = JSON.parse(content); + const contentArray = Array.isArray(contentObj) ? contentObj : [contentObj]; + contentArray.forEach((c: ApiMessageContent) => { + if (c.type === "text") { + message.blocks.push({ type: "text", text: c.content }); + } else if (c.type === "image") { + message.blocks.push({ type: "image", url: c.content }); + } else if (c.type === "video") { + message.blocks.push({ type: "video", url: c.content }); + } else if (c.type === "audio") { + message.blocks.push({ type: "audio", url: c.content }); + } + }); + } catch (error) { + // 如果 JSON 解析失败,将整个 content 作为文本内容 + message.blocks.push({ type: "text", text: content }); + } } else if (role === 'system' && function_name && custom_data) { // 处理系统消息 message.blocks = transformSystemMessage(function_name, content, custom_data); diff --git a/components/pages/work-flow.tsx b/components/pages/work-flow.tsx index d47a977..de947cf 100644 --- a/components/pages/work-flow.tsx +++ b/components/pages/work-flow.tsx @@ -207,7 +207,7 @@ const WorkFlow = React.memo(function WorkFlow() { autoFocus={false} mask={false} zIndex={49} - className="backdrop-blur-md bg-white/10 border border-white/20 shadow-xl" + className="backdrop-blur-lg bg-black/30 border border-white/20 shadow-xl" style={{ backgroundColor: 'transparent', borderBottomLeftRadius: 10, @@ -226,7 +226,7 @@ const WorkFlow = React.memo(function WorkFlow() { isSmartChatBoxOpen={isSmartChatBoxOpen} setIsSmartChatBoxOpen={setIsSmartChatBoxOpen} projectId={episodeId} - userId={51} + userId={userId} />