This commit is contained in:
北枳 2025-08-25 01:18:16 +08:00
parent f65fe63650
commit fc19d6e25b
2 changed files with 24 additions and 19 deletions

View File

@ -314,7 +314,7 @@ function transformSystemMessage(
type: 'progress', type: 'progress',
value: customData.completed_count, value: customData.completed_count,
total: customData.total_count, total: customData.total_count,
label: `${customData.completed_count} 个演员,剧本中共有 ${customData.total_count}` label: `${customData.completed_count} 个演员,共有 ${customData.total_count}`
}, { }, {
type: 'text', type: 'text',
text: `\n\n${content}` text: `\n\n${content}`
@ -337,7 +337,7 @@ function transformSystemMessage(
type: 'progress', type: 'progress',
value: customData.completed_count, value: customData.completed_count,
total: customData.total_count, total: customData.total_count,
label: `${customData.completed_count} 个场景,剧本中共有 ${customData.total_count}` label: `${customData.completed_count} 个场景,共有 ${customData.total_count}`
}, { }, {
type: 'text', type: 'text',
text: `\n\n${content}` text: `\n\n${content}`
@ -360,7 +360,7 @@ function transformSystemMessage(
type: 'progress', type: 'progress',
value: customData.completed_count, value: customData.completed_count,
total: customData.total_count, total: customData.total_count,
label: `${customData.completed_count} 个故事板静帧,剧本中共有 ${customData.total_count}` label: `${customData.completed_count} 个故事板静帧,共有 ${customData.total_count}`
}, { }, {
type: 'text', type: 'text',
text: `\n\n${content}` text: `\n\n${content}`
@ -387,7 +387,7 @@ function transformSystemMessage(
type: 'progress', type: 'progress',
value: customData.completed_count, value: customData.completed_count,
total: customData.total_count, total: customData.total_count,
label: `${customData.completed_count} 个分镜视频剧本中共有 ${customData.total_count}` label: `${customData.completed_count} 个分镜,共有 ${customData.total_count}分镜`
}, { }, {
type: 'text', type: 'text',
text: `\n\n${content}` text: `\n\n${content}`
@ -415,6 +415,7 @@ function transformMessage(apiMessage: RealApiMessage): ChatMessage {
}; };
if (role === 'assistant' || role === 'user') { if (role === 'assistant' || role === 'user') {
try {
const contentObj = JSON.parse(content); const contentObj = JSON.parse(content);
const contentArray = Array.isArray(contentObj) ? contentObj : [contentObj]; const contentArray = Array.isArray(contentObj) ? contentObj : [contentObj];
contentArray.forEach((c: ApiMessageContent) => { contentArray.forEach((c: ApiMessageContent) => {
@ -428,6 +429,10 @@ function transformMessage(apiMessage: RealApiMessage): ChatMessage {
message.blocks.push({ type: "audio", url: c.content }); 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) { } else if (role === 'system' && function_name && custom_data) {
// 处理系统消息 // 处理系统消息
message.blocks = transformSystemMessage(function_name, content, custom_data); message.blocks = transformSystemMessage(function_name, content, custom_data);

View File

@ -207,7 +207,7 @@ const WorkFlow = React.memo(function WorkFlow() {
autoFocus={false} autoFocus={false}
mask={false} mask={false}
zIndex={49} 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={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
borderBottomLeftRadius: 10, borderBottomLeftRadius: 10,
@ -226,7 +226,7 @@ const WorkFlow = React.memo(function WorkFlow() {
isSmartChatBoxOpen={isSmartChatBoxOpen} isSmartChatBoxOpen={isSmartChatBoxOpen}
setIsSmartChatBoxOpen={setIsSmartChatBoxOpen} setIsSmartChatBoxOpen={setIsSmartChatBoxOpen}
projectId={episodeId} projectId={episodeId}
userId={51} userId={userId}
/> />
</Drawer> </Drawer>