import React, { useMemo, useRef, useState } from 'react'; import { createRoot } from 'react-dom/client'; import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client'; import { StickyLane } from '../src/client/StickyLane.js'; import { ChoreographedFlow } from '../src/client/ChoreographedFlow.js'; import { ClosedProcessSummary } from '../src/client/ClosedProcessSummary.js'; import { Disclosure, StatusText } from '../src/client/motion.js'; import { presentLiveTurn } from '../src/client/live-turn.js'; import type { LiveStep } from '../src/client/live-turn.js'; import css from '../src/client/Reader.module.css'; const steps:LiveStep[]=[...Array.from({length:6},(_,i):LiveStep=>({kind:'reasoning',key:`r${i}`,nodeKey:`r${i}`,step:i,start:0,blocks:[]})),{kind:'body',key:'body',nodeKey:'body',step:6,start:0,blocks:[]},{kind:'other',key:'extra',nodeKey:'extra'},{kind:'reasoning',key:'latest',nodeKey:'latest',step:7,start:0,blocks:[]},{kind:'body',key:'answer',nodeKey:'answer',step:7,start:0,blocks:[]}]; function Fixture(){ const [expanded,setExpanded]=useState(true),[open,setOpen]=useState>({}),[closed,setClosed]=useState(false);const button=useRef(null); const frame=useMemo(()=>({items:presentLiveTurn(steps,{status:'open',reason:null,latestStep:7,closingStep:null}),snapshot:{} as ChatSnapshot}),[]); return <>
用户消息:滚动抵达顶部才吸顶。
} /> {closed?<>
最终回答占位,验证完成后统计仍然吸顶。
:{setExpanded(true);setOpen(x=>({...x,[k]:v}));}} renderStep={s=>s.key==='answer'?
当前输出保持完整,统计不应被推出视野。
:expanded?
过程 {s.key}
:null}/>}
下一轮之前
; } createRoot(document.getElementById('app')!).render();