forked from 77media/video-flow
chatbox 英文化
This commit is contained in:
parent
c56043d85c
commit
df7d8c8a0d
@ -90,7 +90,7 @@ function transformSystemMessage(
|
||||
if (isProjectInit(customData)) {
|
||||
blocks = [{
|
||||
type: 'text',
|
||||
text: `🎬 根据您输入的 "${customData.project_data.script}",我已完成项目的初始化。\n${content}`
|
||||
text: `🎬 According to your input "${customData.project_data.script}", I have completed the initialization of the project.\n${content}`
|
||||
}];
|
||||
}
|
||||
break;
|
||||
@ -98,7 +98,7 @@ function transformSystemMessage(
|
||||
case 'generate_script_summary':
|
||||
if (isScriptSummary(customData)) {
|
||||
blocks = [
|
||||
{ type: 'text', text: `🎬 剧本摘要生成完成\n\n${customData.summary}\n\n${content}` }
|
||||
{ type: 'text', text: `🎬 I have completed the script summary generation.\n\n${customData.summary}\n\n${content}` }
|
||||
];
|
||||
}
|
||||
break;
|
||||
@ -107,18 +107,18 @@ function transformSystemMessage(
|
||||
if (isCharacterGeneration(customData)) {
|
||||
blocks = [{
|
||||
type: 'text',
|
||||
text: `🎭 演员 "${customData.character_name}" 已就位`
|
||||
text: `🎭 Actor "${customData.character_name}" is ready.`
|
||||
}, {
|
||||
type: 'image',
|
||||
url: customData.image_path
|
||||
}, {
|
||||
type: 'text',
|
||||
text: '图片中演员形象仅供参考,后续可根据视频生成后进行调整。'
|
||||
text: 'The actor image is for reference only, and can be adjusted after the video is generated.'
|
||||
}, {
|
||||
type: 'progress',
|
||||
value: customData.completed_count,
|
||||
total: customData.total_count,
|
||||
label: `已完成 ${customData.completed_count} 个演员,共有 ${customData.total_count} 个`
|
||||
label: `Completed ${customData.completed_count} actors, total ${customData.total_count} actors`
|
||||
}, {
|
||||
type: 'text',
|
||||
text: `\n${content}`
|
||||
@ -130,18 +130,18 @@ function transformSystemMessage(
|
||||
if (isSketchGeneration(customData)) {
|
||||
blocks = [{
|
||||
type: 'text',
|
||||
text: `🎨 场景 "${customData.sketch_name}" 参考图片已生成 \n`
|
||||
text: `🎨 Scene "${customData.sketch_name}" reference image generated \n`
|
||||
}, {
|
||||
type: 'image',
|
||||
url: customData.image_path
|
||||
}, {
|
||||
type: 'text',
|
||||
text: '图片中场景仅供参考,后续可根据视频生成后进行调整。'
|
||||
text: 'The scene image is for reference only, and can be adjusted after the video is generated.'
|
||||
}, {
|
||||
type: 'progress',
|
||||
value: customData.completed_count,
|
||||
total: customData.total_count,
|
||||
label: `已完成 ${customData.completed_count} 个场景,共有 ${customData.total_count} 个`
|
||||
label: `Completed ${customData.completed_count} scenes, total ${customData.total_count} scenes`
|
||||
}, {
|
||||
type: 'text',
|
||||
text: `\n${content}`
|
||||
@ -153,18 +153,18 @@ function transformSystemMessage(
|
||||
if (isShotSketchGeneration(customData)) {
|
||||
blocks = [{
|
||||
type: 'text',
|
||||
text: `🎬 故事板静帧生成 \n镜头类型:${customData.shot_type}\n氛围:${customData.atmosphere}\n关键动作:${customData.key_action}`
|
||||
text: `🎬 Storyboard static frame generation \nShot type: ${customData.shot_type}\nAtmosphere: ${customData.atmosphere}\nKey action: ${customData.key_action}`
|
||||
}, {
|
||||
type: 'image',
|
||||
url: customData.url
|
||||
}, {
|
||||
type: 'text',
|
||||
text: '图片中故事板静帧仅供参考,后续可根据视频生成后进行调整。'
|
||||
text: 'The storyboard static frame image is for reference only, and can be adjusted after the video is generated.'
|
||||
}, {
|
||||
type: 'progress',
|
||||
value: customData.completed_count,
|
||||
total: customData.total_count,
|
||||
label: `已完成 ${customData.completed_count} 个故事板静帧,共有 ${customData.total_count} 个`
|
||||
label: `Completed ${customData.completed_count} storyboard static frames, total ${customData.total_count} storyboard static frames`
|
||||
}, {
|
||||
type: 'text',
|
||||
text: `\n${content}`
|
||||
@ -176,7 +176,7 @@ function transformSystemMessage(
|
||||
if (isShotVideoGeneration(customData)) {
|
||||
blocks.push({
|
||||
type: 'text',
|
||||
text: `🎬 该分镜下包含${customData.urls.length} 个视频。 \n核心氛围:${customData.prompt_json.core_atmosphere}`
|
||||
text: `🎬 There are ${customData.urls.length} videos in this shot. \nCore atmosphere: ${customData.prompt_json.core_atmosphere}`
|
||||
});
|
||||
customData.urls.forEach((url: string) => {
|
||||
blocks.push({
|
||||
@ -186,12 +186,12 @@ function transformSystemMessage(
|
||||
});
|
||||
blocks.push({
|
||||
type: 'text',
|
||||
text: '后续可在剪辑线上进行编辑。'
|
||||
text: 'You can edit the video on the editing line later.'
|
||||
}, {
|
||||
type: 'progress',
|
||||
value: customData.completed_count,
|
||||
total: customData.total_count,
|
||||
label: `已完成 ${customData.completed_count} 个分镜,共有 ${customData.total_count} 个分镜`
|
||||
label: `Completed ${customData.completed_count} shots, total ${customData.total_count} shots`
|
||||
}, {
|
||||
type: 'text',
|
||||
text: `\n${content}`
|
||||
@ -252,18 +252,18 @@ function transformMessage(apiMessage: RealApiMessage): ChatMessage {
|
||||
|
||||
// 如果没有有效的 blocks,至少添加一个文本块
|
||||
if (message.blocks.length === 0) {
|
||||
message.blocks.push({ type: "text", text: "无内容" });
|
||||
message.blocks.push({ type: "text", text: "No content" });
|
||||
}
|
||||
|
||||
return message;
|
||||
} catch (error) {
|
||||
console.error("转换消息格式失败:", error, apiMessage);
|
||||
console.error("Failed to transform message format:", error, apiMessage);
|
||||
// 返回一个带有错误信息的消息
|
||||
return {
|
||||
id: new Date().getTime().toString(),
|
||||
role: apiMessage.role,
|
||||
createdAt: new Date(apiMessage.created_at).getTime(),
|
||||
blocks: [{ type: "text", text: "消息格式错误" }],
|
||||
blocks: [{ type: "text", text: "Message format error" }],
|
||||
chatType: 'chat',
|
||||
status: 'error',
|
||||
};
|
||||
@ -289,13 +289,13 @@ export async function fetchMessages(
|
||||
};
|
||||
|
||||
try {
|
||||
console.log('发送历史消息请求:', request);
|
||||
console.log('Send history message request:', request);
|
||||
const response = await post<ApiResponse<MessagesResponse>>("/intelligent/history", request);
|
||||
console.log('收到历史消息响应:', response);
|
||||
console.log('Receive history message response:', response);
|
||||
|
||||
// 确保 response.data 和 messages 存在
|
||||
if (!response.data || !response.data.messages) {
|
||||
console.error('历史消息响应格式错误:', response);
|
||||
console.error('History message response format error:', response);
|
||||
return {
|
||||
messages: [],
|
||||
hasMore: false,
|
||||
@ -319,7 +319,7 @@ export async function fetchMessages(
|
||||
totalCount: response.data.total_count
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("获取消息历史失败:", error);
|
||||
console.error("Failed to get message history:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@ -360,10 +360,10 @@ export async function sendMessage(
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('发送消息请求:', request);
|
||||
console.log('Send message request:', request);
|
||||
await post<ApiResponse<RealApiMessage>>("/intelligent/chat", request);
|
||||
} catch (error) {
|
||||
console.error("发送消息失败:", error);
|
||||
console.error("Send message failed:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@ -377,5 +377,5 @@ export async function retryMessage(
|
||||
): Promise<void> {
|
||||
// TODO: 实现实际的重试逻辑,可能需要保存原始消息内容
|
||||
// 这里简单重用发送消息的接口
|
||||
return sendMessage([{ type: "text", text: "重试消息" }], config);
|
||||
return sendMessage([{ type: "text", text: "Retry message" }], config);
|
||||
}
|
||||
@ -64,15 +64,15 @@ export const showInsufficientPointsNotification = () => {
|
||||
description: (
|
||||
<div data-alt="insufficient-points-notification" style={{ minWidth: '280px' }}>
|
||||
<h3 style={messageStyle}>
|
||||
积分不足提醒
|
||||
Insufficient credits reminder
|
||||
</h3>
|
||||
<p style={descriptionStyle}>您的积分余额不足,无法继续使用该功能</p>
|
||||
<p style={descriptionStyle}>Your credits are insufficient, please upgrade to continue.</p>
|
||||
<button
|
||||
onClick={() => window.location.href = '/pricing'}
|
||||
style={btnStyle}
|
||||
data-alt="recharge-button"
|
||||
>
|
||||
立即充值/升级会员 →
|
||||
Upgrade to continue →
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user