fix: 状态指示器重叠与 Trace Viewer 状态丢失
1. StreamingIndicator: 最后一条是 assistant 消息时不显示'正在连接', 避免与 AssistantMessage 的'正在思考'重叠 2. useAgentStream: 跳过 INIT(iteration=0) 的 trace step, 引擎初始化无实际内容不应展示 3. useAgentStream: 状态转换追加到 states 数组而非覆盖 state 字段, 保留完整 THINKING->EXECUTING->OBSERVING 进度 4. TraceStep: header 显示状态进度链(如'思考 -> 执行 -> 观察')而非仅最终状态 5. agent-store: 旧数据兼容, 加载时为缺少 states 的 trace step 补全
This commit is contained in:
@@ -59,6 +59,7 @@ export interface TraceStep {
|
||||
id: string;
|
||||
iteration: number;
|
||||
state: string;
|
||||
states: string[];
|
||||
startedAt: number;
|
||||
completedAt?: number;
|
||||
thought?: string;
|
||||
@@ -163,10 +164,11 @@ export const useAgentStore = create<AgentState>((set, get) => ({
|
||||
window.metona.sessions.getTrace(id).then((data) => {
|
||||
if (data) {
|
||||
if (data.traceSteps) {
|
||||
// 兼容旧数据:为缺少 id 的 trace 步骤生成 id
|
||||
// 兼容旧数据:为缺少 id/states 的 trace 步骤补全
|
||||
const steps = (data.traceSteps as TraceStep[]).map((t, i) => ({
|
||||
...t,
|
||||
id: t.id ?? `trace_legacy_${t.iteration}_${t.state}_${i}`,
|
||||
states: t.states ?? [t.state],
|
||||
}));
|
||||
set({ traceSteps: steps });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user