From 2b1c69460f38ddb8912d7f00ded5e27ee33bd6d0 Mon Sep 17 00:00:00 2001 From: allen2fuc Date: Tue, 12 May 2026 11:14:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8E=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=B0=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/lib/aiApi.ts | 3 +++ client/src/lib/luxsinApi.ts | 4 ++++ client/src/pages/AIPage.tsx | 1 + 3 files changed, 8 insertions(+) diff --git a/client/src/lib/aiApi.ts b/client/src/lib/aiApi.ts index cc32c8a..15e8e17 100644 --- a/client/src/lib/aiApi.ts +++ b/client/src/lib/aiApi.ts @@ -287,6 +287,7 @@ export async function executeFrontendTool( } } await api.setSetting(params); + await api.refreshState(); // 回传给 AI 的仍以人类可读的 dB 展示 return { ok: true, content: { ok: true, updated: rawParams } }; } @@ -334,11 +335,13 @@ export async function executeFrontendTool( canDel: p.canDel, }, }); + await api.refreshState(); return { ok: true, content: { ok: true, name: p.name } }; } case "delete_peqs": { const names = (block.input?.names ?? []) as string[]; await api.removePeq(names); + await api.refreshState(); return { ok: true, content: { ok: true, deleted: names } }; } default: diff --git a/client/src/lib/luxsinApi.ts b/client/src/lib/luxsinApi.ts index c07089a..e0cb6b2 100644 --- a/client/src/lib/luxsinApi.ts +++ b/client/src/lib/luxsinApi.ts @@ -218,6 +218,10 @@ export class LuxsinAPI { return parseInt(text.trim(), 10); } + async refreshState(): Promise { + await fetch(`${this.baseUrl}/msgAdd`); + } + async setSetting(params: Record): Promise { const query = Object.entries(params) .map(([k, v]) => `${k}=${v}`) diff --git a/client/src/pages/AIPage.tsx b/client/src/pages/AIPage.tsx index 43f84d4..eb5ad66 100644 --- a/client/src/pages/AIPage.tsx +++ b/client/src/pages/AIPage.tsx @@ -586,6 +586,7 @@ export default function AIPage({ variant = "page", onClose }: AIPageProps = {}) }, }); await updateMessageApplied(msg.id, nextApplied); + await api.refreshState(); setMessages((prev) => prev.map((m) => m.kind === "optimize" && m.id === msg.id