feat(memory): P1 长期记忆升级 —— 异步攒批 Consolidate + 软删 + importance/last_seen #1
@@ -110,7 +110,17 @@ export default function App() {
|
|||||||
pollRef.current = window.setInterval(async () => {
|
pollRef.current = window.setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
const s = await taskStatus(taskId);
|
const s = await taskStatus(taskId);
|
||||||
setRun((r) => (r.taskId === taskId ? { ...r, lifecycle: s.status, detail: s.detail } : r));
|
setRun((r) => {
|
||||||
|
if (r.taskId !== taskId) return r;
|
||||||
|
// 命中终态:同时把 phase 也置终态,否则 token 流没收到 done(如恢复的任务/外部置终态)
|
||||||
|
// 时 phase 会永卡 streaming → 运行按钮永远禁用「运行中…」。
|
||||||
|
const phase = terminal.has(s.status)
|
||||||
|
? s.status === "failed" || s.status === "timeout"
|
||||||
|
? "error"
|
||||||
|
: "done"
|
||||||
|
: r.phase;
|
||||||
|
return { ...r, lifecycle: s.status, detail: s.detail, phase };
|
||||||
|
});
|
||||||
if (terminal.has(s.status)) stopPoll();
|
if (terminal.has(s.status)) stopPoll();
|
||||||
} catch {
|
} catch {
|
||||||
/* 忽略瞬时失败,下个 tick 再试 */
|
/* 忽略瞬时失败,下个 tick 再试 */
|
||||||
|
|||||||
Reference in New Issue
Block a user