新增AI的功能与页面,扩展了国际化功能

This commit is contained in:
allen2fuc
2026-04-21 16:41:01 +08:00
parent 52cdaf1e51
commit eb4c3c1e6a
5 changed files with 921 additions and 114 deletions
+29
View File
@@ -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",