forked from 77media/video-flow
chatbox
This commit is contained in:
parent
f65fe63650
commit
fc19d6e25b
@ -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);
|
||||||
|
|||||||
@ -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>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user