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