diff --git a/docs/docs.go b/docs/docs.go index 62c61101..e67df397 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -289,6 +289,20 @@ const docTemplate = `{ "ThinkingHigh" ] }, + "domain.UsageMetadata": { + "type": "object", + "properties": { + "input_tokens": { + "type": "integer" + }, + "output_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + } + }, "fsdb.Pattern": { "type": "object", "properties": { @@ -360,6 +374,9 @@ const docTemplate = `{ "$ref": "#/definitions/restapi.PromptRequest" } }, + "quiet": { + "type": "boolean" + }, "raw": { "type": "boolean" }, @@ -372,6 +389,9 @@ const docTemplate = `{ "seed": { "type": "integer" }, + "showMetadata": { + "type": "boolean" + }, "suppressThink": { "type": "boolean" }, @@ -392,6 +412,9 @@ const docTemplate = `{ "type": "number", "format": "float64" }, + "updateChan": { + "type": "object" + }, "voice": { "type": "string" } @@ -423,6 +446,10 @@ const docTemplate = `{ "patternName": { "type": "string" }, + "sessionName": { + "description": "Session name for multi-turn conversations", + "type": "string" + }, "strategyName": { "description": "Optional strategy name", "type": "string" @@ -446,7 +473,6 @@ const docTemplate = `{ "type": "object", "properties": { "content": { - "description": "The actual content", "type": "string" }, "format": { @@ -454,8 +480,11 @@ const docTemplate = `{ "type": "string" }, "type": { - "description": "\"content\", \"error\", \"complete\"", + "description": "\"content\", \"usage\", \"error\", \"complete\"", "type": "string" + }, + "usage": { + "$ref": "#/definitions/domain.UsageMetadata" } } }, diff --git a/docs/swagger.json b/docs/swagger.json index 547443dd..749c6e06 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -283,6 +283,20 @@ "ThinkingHigh" ] }, + "domain.UsageMetadata": { + "type": "object", + "properties": { + "input_tokens": { + "type": "integer" + }, + "output_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + } + }, "fsdb.Pattern": { "type": "object", "properties": { @@ -354,6 +368,9 @@ "$ref": "#/definitions/restapi.PromptRequest" } }, + "quiet": { + "type": "boolean" + }, "raw": { "type": "boolean" }, @@ -366,6 +383,9 @@ "seed": { "type": "integer" }, + "showMetadata": { + "type": "boolean" + }, "suppressThink": { "type": "boolean" }, @@ -386,6 +406,9 @@ "type": "number", "format": "float64" }, + "updateChan": { + "type": "object" + }, "voice": { "type": "string" } @@ -417,6 +440,10 @@ "patternName": { "type": "string" }, + "sessionName": { + "description": "Session name for multi-turn conversations", + "type": "string" + }, "strategyName": { "description": "Optional strategy name", "type": "string" @@ -440,7 +467,6 @@ "type": "object", "properties": { "content": { - "description": "The actual content", "type": "string" }, "format": { @@ -448,8 +474,11 @@ "type": "string" }, "type": { - "description": "\"content\", \"error\", \"complete\"", + "description": "\"content\", \"usage\", \"error\", \"complete\"", "type": "string" + }, + "usage": { + "$ref": "#/definitions/domain.UsageMetadata" } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f1629f92..53184584 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -12,6 +12,15 @@ definitions: - ThinkingLow - ThinkingMedium - ThinkingHigh + domain.UsageMetadata: + properties: + input_tokens: + type: integer + output_tokens: + type: integer + total_tokens: + type: integer + type: object fsdb.Pattern: properties: description: @@ -60,6 +69,8 @@ definitions: items: $ref: '#/definitions/restapi.PromptRequest' type: array + quiet: + type: boolean raw: type: boolean search: @@ -68,6 +79,8 @@ definitions: type: string seed: type: integer + showMetadata: + type: boolean suppressThink: type: boolean temperature: @@ -82,6 +95,8 @@ definitions: topP: format: float64 type: number + updateChan: + type: object voice: type: string type: object @@ -102,6 +117,9 @@ definitions: type: string patternName: type: string + sessionName: + description: Session name for multi-turn conversations + type: string strategyName: description: Optional strategy name type: string @@ -118,14 +136,15 @@ definitions: restapi.StreamResponse: properties: content: - description: The actual content type: string format: description: '"markdown", "mermaid", "plain"' type: string type: - description: '"content", "error", "complete"' + description: '"content", "usage", "error", "complete"' type: string + usage: + $ref: '#/definitions/domain.UsageMetadata' type: object restapi.YouTubeRequest: properties: diff --git a/internal/plugins/ai/dryrun/dryrun_test.go b/internal/plugins/ai/dryrun/dryrun_test.go index 0f8825ac..a5db58c3 100644 --- a/internal/plugins/ai/dryrun/dryrun_test.go +++ b/internal/plugins/ai/dryrun/dryrun_test.go @@ -39,7 +39,7 @@ func TestSendStream_SendsMessages(t *testing.T) { opts := &domain.ChatOptions{ Model: "dry-run-model", } - channel := make(chan string) + channel := make(chan domain.StreamUpdate) go func() { err := client.SendStream(msgs, opts, channel) if err != nil { @@ -48,7 +48,7 @@ func TestSendStream_SendsMessages(t *testing.T) { }() var receivedMessages []string for msg := range channel { - receivedMessages = append(receivedMessages, msg) + receivedMessages = append(receivedMessages, msg.Content) } if len(receivedMessages) == 0 { t.Errorf("Expected to receive messages, but got none")