更新后刷新配置到设备
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
@@ -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}`)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user