Add thinking duration to message parts #13
+1
-1
@@ -42,7 +42,7 @@ func sampleMessage() Message {
|
||||
ID: "msg_abc123def456", ConversationID: "cnv_abc123def456", RunID: "run_abc123def456",
|
||||
Role: RoleAssistant,
|
||||
Parts: []Part{
|
||||
{Type: PartThinking, Text: "考虑先检索…", Process: true},
|
||||
{Type: PartThinking, Text: "考虑先检索…", Process: true, DurationMs: 1500},
|
||||
{Type: PartToolCall, Process: true, ToolCall: &ToolCallPart{ID: "call_1", Name: "history_search", Arguments: `{"q":"部署"}`, Duration: 12.5}},
|
||||
{Type: PartToolResult, Process: true, ToolResult: &ToolResultPart{CallID: "call_1", Status: "ok", Summary: "3 条命中"}},
|
||||
{Type: PartText, Text: "根据历史记录……"},
|
||||
|
||||
@@ -89,6 +89,10 @@ type Part struct {
|
||||
|
||||
// 过程标记:true 的部件在 run 终态后由前端折叠为摘要行(4.2)。
|
||||
Process bool `json:"process,omitempty"`
|
||||
|
||||
// DurationMs 是 thinking 部件的思考时长(毫秒,从首个推理增量到最后一个)。
|
||||
// 工具耗时在 ToolCallPart.Duration,不复用本字段。
|
||||
DurationMs float64 `json:"durationMs,omitempty"`
|
||||
}
|
||||
|
||||
type ToolCallPart struct {
|
||||
|
||||
Vendored
+2
-1
@@ -7,7 +7,8 @@
|
||||
{
|
||||
"type": "thinking",
|
||||
"text": "考虑先检索…",
|
||||
"process": true
|
||||
"process": true,
|
||||
"durationMs": 1500
|
||||
},
|
||||
{
|
||||
"type": "tool_call",
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface Part {
|
||||
card?: { kind: string; data: UINode[]; cardId?: ID }; // cardId 非空 = 收件箱卡片引用部件(submit_card)
|
||||
error?: { code: string; message: string };
|
||||
process?: boolean; // run 终态后折叠为摘要行
|
||||
durationMs?: number; // thinking 部件的思考时长(毫秒);工具耗时在 toolCall.durationMs
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
|
||||
Reference in New Issue
Block a user