68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
/**
|
|
* 并行多智能体面板的共享类型。
|
|
*
|
|
* `Dialogue` 镜像圆桌 Step2 的 `Step2Dialogue`,外加 `agentId`(并行场景下用来把消息
|
|
* 归到对应席位列)。`StreamEvent` 是后端 `/api/parallel-agents/run/stream` 的统一事件协议。
|
|
*/
|
|
|
|
/** 一条工具调用步骤(喂步骤条 / 思维链卡)。 */
|
|
export interface DialogueStep {
|
|
id: string;
|
|
key: string;
|
|
label: string;
|
|
ts: string;
|
|
args?: Record<string, unknown> | null;
|
|
}
|
|
|
|
/** 一条消息气泡(对齐 Step2Dialogue + agentId)。 */
|
|
export interface Dialogue {
|
|
id: number;
|
|
/** 归属席位的 agent_id(并行列定位用)。 */
|
|
agentId: string;
|
|
sender: string;
|
|
avatarType: string;
|
|
content: string;
|
|
time: string;
|
|
/** 状态标签("实时输出" / "已完成" / "出错" 等)。 */
|
|
confidence: string;
|
|
streaming?: boolean;
|
|
steps?: DialogueStep[];
|
|
}
|
|
|
|
/** 并行席位的视图状态(席位状态条用)。 */
|
|
export interface SeatView {
|
|
agentId: string;
|
|
name: string;
|
|
avatarType: string;
|
|
status: "pending" | "running" | "done" | "error";
|
|
/** 关联的 Dialogue.id。 */
|
|
bubbleId: number;
|
|
}
|
|
|
|
/** 宿主传入的一个待并行调用的智能体。 */
|
|
export interface AgentInput {
|
|
agent_id: string;
|
|
name: string;
|
|
avatarType?: string;
|
|
}
|
|
|
|
/** 后端合并 SSE 的统一事件。 */
|
|
export type StreamEvent =
|
|
| { type: "agent_start"; agent_id: string }
|
|
| { type: "delta"; agent_id: string; text: string }
|
|
| { type: "step"; agent_id: string; key: string; label: string; args?: Record<string, unknown> | null }
|
|
| { type: "agent_done"; agent_id: string; content: string }
|
|
| { type: "agent_error"; agent_id: string; message: string }
|
|
| { type: "all_done" };
|
|
|
|
/** 持久化的任务记录(与后端 /api/parallel-agent-tasks 对应)。 */
|
|
export interface SavedTask {
|
|
id: string;
|
|
title: string;
|
|
brief?: string | null;
|
|
agents: AgentInput[];
|
|
messages?: Dialogue[];
|
|
created_at?: string | null;
|
|
updated_at?: string | null;
|
|
}
|