console: 任务列表行显示首字、总耗时、token 栏位
任务列表每一行新增三项(筛选、搜索、选中高亮、状态点不动):
- 首字:行前小方块,prompt 第一个非空白字符(按码点取),
无 prompt 时用任务 id 首字符兜底;原 prompt 文案不动。
- 总耗时:只用列表已回时间戳算。终态用 finished_at -
started_at(与服务端 avg_duration_seconds 同口径);running
显示“进行中 + 已用时长”,随列表刷新更新;无 started_at
时用 created_at 兜底(含排队,title 注明口径)。格式:
3分12秒、1小时5分、1天1小时。
- token:栏位已接好,total_tokens 优先,actual +
estimated 分项加总次之;但列表接口 _task_to_dict 目前
不回任何 token 字段,单任务真数只在 GET /tasks/{id}/cost
里,所以当前显示“token —”,不编造、不逐个调 /cost
拖慢列表。服务端在列表里补 total_tokens 后本行自动出真数。
诚实边界:worker 每次认领重写 started_at,多轮续跑任务
的耗时是末次认领时长,不是历次之和;严格累计需服务端
保留首次 started_at 或累加各轮时长。token 的服务端缺口:
需在 _task_to_dict / 列表查询里按 task_id 聚合 cost_records
的 total_tokens,不需要新端点。
构建:npm run build(tsc + vite singlefile)0 退出,
dist/index.html 原样拷到 cloud/console.html,产物含
issue-first、耗时、token —,未动其它确认框。
This commit is contained in:
1 parent
e5bf361c6d
commit
65a875ada9
4 files changed
+132
-25
No files matched your search
@@ -7,6 +7,15 @@ export interface Env { id: string; name: string; branch?: string; executor?: str
|
||||
export interface Task {
|
||||
id: string; project_id?: string; prompt?: string; status: string; executor?: string;
|
||||
worktree_host?: string; pr_url?: string; pr_number?: number | string; updated_at?: number;
|
||||
// 列表行 meta 用:服务端 _task_to_dict 本来就回这几个时间戳
|
||||
// (秒,epoch),此前 Task 类型没列、前端直接忽略了。
|
||||
created_at?: number; started_at?: number | null; finished_at?: number | null;
|
||||
last_heartbeat?: number | null;
|
||||
// token:列表接口目前不回这些字段(见 TaskListSection 的注释),
|
||||
// 先留类型位:服务端一旦在列表里补 total_tokens(或
|
||||
// actual/estimated 分项),列表行无需再改代码就能显示真数。
|
||||
total_tokens?: number | null; actual_tokens?: number | null;
|
||||
estimated_tokens?: number | null; unpriced_actual_tokens?: number | null;
|
||||
turn_id?: string; root_turn_id?: string; plan?: number | boolean; forked_from?: string;
|
||||
coordinator_parts?: Array<{ name: string; prompt?: string }> | null; parent_task_id?: string;
|
||||
coordinator_part?: string; goal_mode?: number | boolean; verify_command?: string;
|
||||
|
||||
Reference in new issue
Block a user