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