新增AI的功能与页面,扩展了国际化功能
This commit is contained in:
@@ -28,12 +28,33 @@ export interface ChatRead {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface OptimizePeqPayload {
|
||||
name?: string;
|
||||
brand?: string;
|
||||
model?: string;
|
||||
preamp?: number;
|
||||
canDel?: number;
|
||||
autoPre?: number;
|
||||
filters?: Array<{
|
||||
type: number | string;
|
||||
fc?: number;
|
||||
frequency?: number;
|
||||
gain: number;
|
||||
q: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface MessageRead {
|
||||
id: string;
|
||||
role: "user" | "assistant";
|
||||
content: string;
|
||||
created_at: string;
|
||||
/** 0: 默认聊天, 1: 摘要, 2: 优化记录, 3: 标题生成 */
|
||||
type: number;
|
||||
before_peq: OptimizePeqPayload | null;
|
||||
after_peq: OptimizePeqPayload | null;
|
||||
applied: boolean;
|
||||
applied_at: string | null;
|
||||
}
|
||||
|
||||
export interface ToolUseBlock {
|
||||
@@ -88,6 +109,14 @@ export async function clearChat(chatId: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateMessageApplied(messageId: string, applied: boolean): Promise<void> {
|
||||
const url = `${getAIBaseUrl()}/sse/update_message_applied?message_id=${encodeURIComponent(
|
||||
messageId,
|
||||
)}&applied=${applied ? "true" : "false"}`;
|
||||
const res = await fetch(url, { method: "POST" });
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
|
||||
}
|
||||
|
||||
export async function sendToolResult(toolUseId: string, content: { ok: boolean; content?: any; message?: string }): Promise<void> {
|
||||
await fetch(`${getAIBaseUrl()}/chat/tool_result`, {
|
||||
method: "POST",
|
||||
|
||||
@@ -485,5 +485,60 @@
|
||||
"selectedYet": "Target curve not selected yet",
|
||||
"leftChannel": "Left channel",
|
||||
"rightChannel": "Right channel"
|
||||
},
|
||||
"ai": {
|
||||
"title": "Luxsin AI",
|
||||
"welcomeTitle": "Hi, I'm Luxsin AI",
|
||||
"welcomeDescription": "I can help you check and adjust {device} settings, analyze headphone frequency response, optimize EQ, or answer usage questions.",
|
||||
"suggestionsLabel": "Try asking",
|
||||
"suggestions": [
|
||||
{ "title": "Optimize my EQ", "prompt": "Please optimize my current EQ — I want clearer vocals." },
|
||||
{ "title": "Recommend Pop EQ", "prompt": "Recommend a set of EQ parameters suitable for pop music." },
|
||||
{ "title": "Check device status", "prompt": "Show me the current volume, input source and output port." },
|
||||
{ "title": "Switch input source", "prompt": "Switch the input source to USB-C." }
|
||||
],
|
||||
"inputPlaceholder": "Ask about your device, EQ, effects…",
|
||||
"thinking": "Thinking…",
|
||||
"stopped": "(Stopped)",
|
||||
"requestFailed": "Request failed. Please try again later.",
|
||||
"ariaSend": "Send",
|
||||
"ariaStop": "Stop",
|
||||
"ariaNewChat": "New chat",
|
||||
"ariaHistory": "History",
|
||||
"ariaClose": "Close",
|
||||
"clearCurrent": "Clear this chat",
|
||||
"cleared": "Current chat cleared",
|
||||
"clearFailed": "Clear failed: {message}",
|
||||
"deviceRequired": "Please connect a device first",
|
||||
"deviceDisconnected": "Device disconnected",
|
||||
"loadHistoryFailed": "Failed to load history: {message}",
|
||||
"loadChatFailed": "Failed to load chat: {message}",
|
||||
"toolResultFailed": "Failed to send tool result: {message}",
|
||||
"history": {
|
||||
"title": "Chat history",
|
||||
"newChat": "Start a new chat",
|
||||
"empty": "No chat history yet",
|
||||
"current": "Current"
|
||||
},
|
||||
"optimize": {
|
||||
"badge": "Optimization",
|
||||
"applied": "Applied",
|
||||
"summary": "{count} filters · preamp {preamp} dB",
|
||||
"compare": "Compare",
|
||||
"apply": "Apply",
|
||||
"rollback": "Rollback",
|
||||
"applySuccess": "New EQ applied",
|
||||
"rollbackSuccess": "Rolled back to original EQ",
|
||||
"applyFailed": "Operation failed: {message}"
|
||||
},
|
||||
"compareDialog": {
|
||||
"title": "EQ comparison",
|
||||
"legendBefore": "Before",
|
||||
"legendAfter": "After",
|
||||
"close": "Close",
|
||||
"apply": "Apply this optimization",
|
||||
"rollback": "Rollback to original",
|
||||
"paramSummary": "{count} filters · preamp {preamp} dB"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,5 +299,60 @@
|
||||
"selectedYet": "你尚未選擇目標曲線",
|
||||
"leftChannel": "左聲道",
|
||||
"rightChannel": "右聲道"
|
||||
},
|
||||
"ai": {
|
||||
"title": "Luxsin AI",
|
||||
"welcomeTitle": "你好,我是 Luxsin AI",
|
||||
"welcomeDescription": "可以幫你查詢與調整 {device} 的設定,分析耳機頻響、優化 EQ,或者解答使用上的疑問。",
|
||||
"suggestionsLabel": "試試這樣問",
|
||||
"suggestions": [
|
||||
{ "title": "優化我的 EQ", "prompt": "幫我優化目前 EQ,我希望人聲更清晰一些" },
|
||||
{ "title": "推薦流行樂 EQ", "prompt": "推薦一套適合聽流行音樂的 EQ 參數" },
|
||||
{ "title": "查看裝置狀態", "prompt": "幫我查看目前的音量、輸入源和輸出埠" },
|
||||
{ "title": "切換輸入源", "prompt": "把輸入源切換到 USB-C" }
|
||||
],
|
||||
"inputPlaceholder": "問問關於裝置、EQ、音效……",
|
||||
"thinking": "思考中…",
|
||||
"stopped": "(已停止)",
|
||||
"requestFailed": "請求失敗,請稍後重試",
|
||||
"ariaSend": "發送",
|
||||
"ariaStop": "停止",
|
||||
"ariaNewChat": "新增會話",
|
||||
"ariaHistory": "歷史會話",
|
||||
"ariaClose": "關閉",
|
||||
"clearCurrent": "清空目前會話",
|
||||
"cleared": "已清空目前會話",
|
||||
"clearFailed": "清空失敗:{message}",
|
||||
"deviceRequired": "請先連接裝置",
|
||||
"deviceDisconnected": "裝置未連接",
|
||||
"loadHistoryFailed": "載入歷史失敗:{message}",
|
||||
"loadChatFailed": "載入會話失敗:{message}",
|
||||
"toolResultFailed": "工具結果回傳失敗:{message}",
|
||||
"history": {
|
||||
"title": "歷史會話",
|
||||
"newChat": "開始新會話",
|
||||
"empty": "暫無歷史會話",
|
||||
"current": "目前"
|
||||
},
|
||||
"optimize": {
|
||||
"badge": "優化記錄",
|
||||
"applied": "已套用",
|
||||
"summary": "{count} 個濾波器 · 總增益 {preamp} dB",
|
||||
"compare": "對比",
|
||||
"apply": "套用",
|
||||
"rollback": "回滾",
|
||||
"applySuccess": "已套用新的 EQ",
|
||||
"rollbackSuccess": "已回滾到原 EQ",
|
||||
"applyFailed": "操作失敗:{message}"
|
||||
},
|
||||
"compareDialog": {
|
||||
"title": "EQ 對比",
|
||||
"legendBefore": "優化前",
|
||||
"legendAfter": "優化後",
|
||||
"close": "關閉",
|
||||
"apply": "套用此優化",
|
||||
"rollback": "回滾到優化前",
|
||||
"paramSummary": "{count} 段 · preamp {preamp} dB"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,5 +300,60 @@
|
||||
"selectedYet": "你还未选择目标曲线",
|
||||
"leftChannel": "左声道",
|
||||
"rightChannel": "右声道"
|
||||
},
|
||||
"ai": {
|
||||
"title": "Luxsin AI",
|
||||
"welcomeTitle": "你好,我是 Luxsin AI",
|
||||
"welcomeDescription": "可以帮你查询与调整 {device} 的设置,分析耳机频响、优化 EQ,或者解答使用上的疑问。",
|
||||
"suggestionsLabel": "试试这样问",
|
||||
"suggestions": [
|
||||
{ "title": "优化我的 EQ", "prompt": "帮我优化当前 EQ,我希望人声更清晰一些" },
|
||||
{ "title": "推荐流行乐 EQ", "prompt": "推荐一套适合听流行音乐的 EQ 参数" },
|
||||
{ "title": "查看设备状态", "prompt": "帮我查看当前的音量、输入源和输出端口" },
|
||||
{ "title": "切换输入源", "prompt": "把输入源切换到 USB-C" }
|
||||
],
|
||||
"inputPlaceholder": "问问关于设备、EQ、音效……",
|
||||
"thinking": "思考中…",
|
||||
"stopped": "(已停止)",
|
||||
"requestFailed": "请求失败,请稍后重试",
|
||||
"ariaSend": "发送",
|
||||
"ariaStop": "停止",
|
||||
"ariaNewChat": "新建会话",
|
||||
"ariaHistory": "历史会话",
|
||||
"ariaClose": "关闭",
|
||||
"clearCurrent": "清空当前会话",
|
||||
"cleared": "已清空当前会话",
|
||||
"clearFailed": "清空失败:{message}",
|
||||
"deviceRequired": "请先连接设备",
|
||||
"deviceDisconnected": "设备未连接",
|
||||
"loadHistoryFailed": "加载历史失败:{message}",
|
||||
"loadChatFailed": "加载会话失败:{message}",
|
||||
"toolResultFailed": "工具结果回传失败:{message}",
|
||||
"history": {
|
||||
"title": "历史会话",
|
||||
"newChat": "开始新会话",
|
||||
"empty": "暂无历史会话",
|
||||
"current": "当前"
|
||||
},
|
||||
"optimize": {
|
||||
"badge": "优化记录",
|
||||
"applied": "已应用",
|
||||
"summary": "{count} 个滤波器 · 总增益 {preamp} dB",
|
||||
"compare": "对比",
|
||||
"apply": "应用",
|
||||
"rollback": "回滚",
|
||||
"applySuccess": "已应用新的 EQ",
|
||||
"rollbackSuccess": "已回滚到原 EQ",
|
||||
"applyFailed": "操作失败:{message}"
|
||||
},
|
||||
"compareDialog": {
|
||||
"title": "EQ 对比",
|
||||
"legendBefore": "优化前",
|
||||
"legendAfter": "优化后",
|
||||
"close": "关闭",
|
||||
"apply": "应用此优化",
|
||||
"rollback": "回滚到优化前",
|
||||
"paramSummary": "{count} 段 · preamp {preamp} dB"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+727
-114
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user