Files
quality_analyse/web/verification/agent-flow.tsx
lyun ff7bbe3e46 同步:完善质量分析工作台并更新主题字体
同步已上线的智能分析执行协议、来源查询、图表报告与管理页面配套代码。
补齐数据库迁移、运行依赖和回归测试,保留原有指标计算口径。
统一午夜黑及其他主题的控件细节、中文和业务数字字体。
排除本地业务数据、凭据、预览、发布与验收产物。

验证:生产构建通过,320项前端回归通过;本轮仅同步Git,不再次部署。
2026-10-30 22:40:58 +08:00

35 lines
2.6 KiB
TypeScript

// Deterministic local UI fixture. No model calls, database changes or production writes.
import React, { useState } from 'react';
import { createRoot } from 'react-dom/client';
import { AnalysisProcess } from '../src/AnalysisProcess';
import '../src/styles.css';
import '../src/analysis-chat.css';
const stamp = (second: number) => `2026-10-26T00:00:${String(second).padStart(2,'0')}Z`;
function Fixture() {
const [step,setStep]=useState(0),[long,setLong]=useState(false);
const active=step<4;
const thought=(id:string,at:number,text:string,running:boolean)=>({id,source:'api',model:'local-fixture',phase:'analysis',status:running?'running':'completed',version:step+1,text,streaming:true,truncated:false,at:stamp(at)});
const first='先核对两个期间与业务范围,再使用正式指标查询。';
const thoughts=[thought('api-abcd1234-1',1,step===0?'先核对两个期间':first,step===0),
...(step>=2?[thought('api-abcd1234-2',4,'查询结果已经返回,继续核对变化方向并整理结论。'+(step>=3?'保留原始指标口径。':''),step<4)]:[])];
if(long)thoughts[thoughts.length-1].text+='\n中文长文保留原始换行,完整显示。🙂 <img src=x onerror=alert(1)>\n'.repeat(1800);
const timeline=step>=1?[
{kind:'assistant',sequence:1,at:stamp(2),text:'我来对比这两个期间的质量表现。'},
{kind:'tool_start',sequence:2,at:stamp(3),tool:'mcp_call',toolCallId:'query-1',label:'查询期间对比',status:'started',input:{mode:'compare',year:2026,month:9}},
...(step>=2?[{kind:'tool_result',sequence:3,at:stamp(4),tool:'mcp_call',toolCallId:'query-1',label:'查询期间对比',status:'completed',text:'两个期间的正式指标已返回。'}]:[]),
...(step>=3?[{kind:'assistant',sequence:4,at:stamp(5),text:'指标已核对,接下来整理重点变化。'}]:[]),
]:[];
return <main style={{maxWidth:1000,margin:'auto',padding:24}}>
<div style={{display:'flex',gap:12,marginBottom:24}}>
<button disabled={step===4} onClick={()=>setStep(value=>value+1)}>下一步</button>
<button onClick={()=>{setStep(0);setLong(false);}}>重新开始</button>
<button onClick={()=>setLong(value=>!value)}>切换长文</button>
</div>
<AnalysisProcess turn={{id:'ordered-flow',status:active?'RUNNING':'COMPLETED',modelThinking:thoughts,timeline}}
metadata={<span className="analysis-turn-metadata"><span>{active?'运行中':'已完成'}</span><span>运行时长 {step+1}秒</span></span>}/>
{!active&&<div className="analysis-answer"><p>两个期间的质量指标已完成核对,以下为本轮最终结论。</p></div>}
</main>;
}
createRoot(document.getElementById('root')!).render(<Fixture/>);