更新后刷新配置到设备

This commit is contained in:
allen2fuc
2026-05-12 11:14:27 +08:00
parent ae4ce8bb07
commit 2b1c69460f
3 changed files with 8 additions and 0 deletions
+3
View File
@@ -287,6 +287,7 @@ export async function executeFrontendTool(
} }
} }
await api.setSetting(params); await api.setSetting(params);
await api.refreshState();
// 回传给 AI 的仍以人类可读的 dB 展示 // 回传给 AI 的仍以人类可读的 dB 展示
return { ok: true, content: { ok: true, updated: rawParams } }; return { ok: true, content: { ok: true, updated: rawParams } };
} }
@@ -334,11 +335,13 @@ export async function executeFrontendTool(
canDel: p.canDel, canDel: p.canDel,
}, },
}); });
await api.refreshState();
return { ok: true, content: { ok: true, name: p.name } }; return { ok: true, content: { ok: true, name: p.name } };
} }
case "delete_peqs": { case "delete_peqs": {
const names = (block.input?.names ?? []) as string[]; const names = (block.input?.names ?? []) as string[];
await api.removePeq(names); await api.removePeq(names);
await api.refreshState();
return { ok: true, content: { ok: true, deleted: names } }; return { ok: true, content: { ok: true, deleted: names } };
} }
default: default:
+4
View File
@@ -218,6 +218,10 @@ export class LuxsinAPI {
return parseInt(text.trim(), 10); return parseInt(text.trim(), 10);
} }
async refreshState(): Promise<void> {
await fetch(`${this.baseUrl}/msgAdd`);
}
async setSetting(params: Record<string, string | number>): Promise<void> { async setSetting(params: Record<string, string | number>): Promise<void> {
const query = Object.entries(params) const query = Object.entries(params)
.map(([k, v]) => `${k}=${v}`) .map(([k, v]) => `${k}=${v}`)
+1
View File
@@ -586,6 +586,7 @@ export default function AIPage({ variant = "page", onClose }: AIPageProps = {})
}, },
}); });
await updateMessageApplied(msg.id, nextApplied); await updateMessageApplied(msg.id, nextApplied);
await api.refreshState();
setMessages((prev) => setMessages((prev) =>
prev.map((m) => prev.map((m) =>
m.kind === "optimize" && m.id === msg.id m.kind === "optimize" && m.id === msg.id