diff --git a/web/src/manage/ManagePanel.tsx b/web/src/manage/ManagePanel.tsx index b088827..50ec64b 100644 --- a/web/src/manage/ManagePanel.tsx +++ b/web/src/manage/ManagePanel.tsx @@ -122,7 +122,7 @@ export function ManagePanel({ state, open, onClose, onSave, fail, theme, setThem } } const switchSection = (s: string) => { request.current?.abort(); generation.current++; setBusy(false); setSection(s); setDetail(true); setMessage(''); }; const lastFocus = useRef(focus); - useEffect(() => { if (focus === lastFocus.current) return; lastFocus.current = focus; switchSection('her'); }, [focus]); // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { if (focus === lastFocus.current) return; lastFocus.current = focus; switchSection('her'); }, [focus]); // Esc on a phone steps back from a section to the section list first; confirmations handle their own Esc. useEffect(() => { if (!open || !detail) return; const key = (e: KeyboardEvent) => { if (e.key !== 'Escape' || confirm || !matchMedia('(max-width:720px)').matches) return; e.stopImmediatePropagation(); setDetail(false); }; window.addEventListener('keydown', key, true); return () => window.removeEventListener('keydown', key, true); }, [open, detail, confirm]); const growth = state.memories.filter(m => m.group === '她的成长' && m.lifeIds.every(id => state.events.some(e => e.id === id && e.shared === true))); @@ -135,13 +135,13 @@ export function ManagePanel({ state, open, onClose, onSave, fail, theme, setThem if (!quiet) setPersonaLoad('loading'); loadPersona(c.signal).then(view => { if (!c.signal.aborted) { setPersona(view); setPersonaLoad('ok'); } }, () => { if (!c.signal.aborted && !quiet) setPersonaLoad('error'); }); }; - useEffect(() => { if (!real || !open || section !== 'her') return; polls.current = 0; readPersona(); return () => personaRequest.current?.abort(); }, [real, open, section, personaRead]); // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { if (!real || !open || section !== 'her') return; polls.current = 0; readPersona(); return () => personaRequest.current?.abort(); }, [real, open, section, personaRead]); // A profile created moments ago may still be forming: look again a bounded number of times, never forever. useEffect(() => { if (!real || !open || section !== 'her' || persona?.state !== 'loading' || polls.current >= 12) return; const t = setTimeout(() => { polls.current++; readPersona(true); }, 5000); return () => clearTimeout(t); - }, [real, open, section, persona]); // eslint-disable-line react-hooks/exhaustive-deps + }, [real, open, section, persona]); async function retryGeneration() { personaRequest.current?.abort(); const c = new AbortController(); personaRequest.current = c; setPersonaBusy(true); setPersonaNote(''); @@ -155,7 +155,7 @@ export function ManagePanel({ state, open, onClose, onSave, fail, theme, setThem if (personaLoad === 'loading' && !persona) return ; if (personaLoad === 'error' || !persona) return

她的这部分资料一时没读出来。

不是你的问题,资料仍在服务器保存。

; const p = persona, interp = p.interpretation; - if (p.state === 'ready' && interp) return <>
{interp.text}

{backfilled(interp.provenance) ? `后来补上的初始印象 · ${day(interp.created_at)} 生成,不是她出生时就有的。` : `创建时形成 · ${day(interp.created_at)}`} 由模型从出生资料自主形成,会延续;不是固定模板,也不能直接改写。

; + if (p.state === 'ready' && interp) return <>
{interp.text}

{backfilled(interp.provenance) ? `后来补上的初始印象 · ${day(interp.created_at)} 生成,不是她出生时就有的。` : `创建时形成 · ${day(interp.created_at)}`} 由模型从出生资料自主形成,会延续;不是固定模板,也不能直接改写。

; if (p.state === 'loading') return <>

{polls.current >= 12 ? '还在形成中。稍后回到这里会再看一次。' : '她正在形成对自己的理解…'}

; if (p.state === 'failed') return

她对自己的理解这次没有形成。

档案、名字和底色都保留;这里不会用模板顶替。

{personaNote &&

{personaNote}

}
; if (p.state === 'not_initialized') return ;