同步:完善质量分析工作台并更新主题字体
同步已上线的智能分析执行协议、来源查询、图表报告与管理页面配套代码。 补齐数据库迁移、运行依赖和回归测试,保留原有指标计算口径。 统一午夜黑及其他主题的控件细节、中文和业务数字字体。 排除本地业务数据、凭据、预览、发布与验收产物。 验证:生产构建通过,320项前端回归通过;本轮仅同步Git,不再次部署。
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { RightOutlined } from '@ant-design/icons';
|
||||
import { thinkingTextFrame, type ModelThinking } from './analysisModelThinking';
|
||||
|
||||
export function AnalysisThinkingBlock({ entry, running }: { entry: ModelThinking; running: boolean }) {
|
||||
const active = running && entry.status === 'running';
|
||||
const [open, setOpen] = useState(false);
|
||||
const priorId = useRef(entry.id);
|
||||
const [text, setText] = useState(entry.text);
|
||||
const shown = useRef(entry.text);
|
||||
useEffect(() => {
|
||||
if (priorId.current !== entry.id) { priorId.current = entry.id; setOpen(false); }
|
||||
else if (!active) setOpen(false);
|
||||
// A late adjacent call must not reopen a disclosure that already closed.
|
||||
}, [active, entry.id]);
|
||||
useEffect(() => {
|
||||
const target = entry.text;
|
||||
if (!active || !open || window.matchMedia('(prefers-reduced-motion: reduce)').matches || !target.startsWith(shown.current)) {
|
||||
shown.current = target; setText(target); return;
|
||||
}
|
||||
const from = shown.current, start = performance.now();
|
||||
let frame = 0;
|
||||
const update = (now: number) => {
|
||||
const next = thinkingTextFrame(from, target, now - start);
|
||||
shown.current = next; setText(next);
|
||||
if (next !== target) frame = requestAnimationFrame(update);
|
||||
};
|
||||
frame = requestAnimationFrame(update);
|
||||
return () => cancelAnimationFrame(frame);
|
||||
}, [entry.id, entry.text, active, open]);
|
||||
if (!entry.text) return null;
|
||||
return <details className="analysis-thinking-block" aria-live="off" open={open} onToggle={event => setOpen(event.currentTarget.open)} data-process-id={entry.id}>
|
||||
<summary>深度思考<RightOutlined aria-hidden="true" /></summary>
|
||||
<div className="analysis-thinking-text"><pre>{active && open ? text : entry.text}</pre></div>
|
||||
</details>;
|
||||
}
|
||||
Reference in New Issue
Block a user