From 33acc3f4029441e4ef83beb45c49bdb630d14381 Mon Sep 17 00:00:00 2001 From: Laura Date: Sun, 30 Nov 2025 21:31:26 +0100 Subject: [PATCH] include generated images in req --- chat.go | 19 +++++++++++++++---- static/js/chat.js | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/chat.go b/chat.go index eb1dcfa..bb682a8 100644 --- a/chat.go +++ b/chat.go @@ -36,10 +36,11 @@ type TextFile struct { } type Message struct { - Role string `json:"role"` - Text string `json:"text"` - Tool *ToolCall `json:"tool"` - Files []TextFile `json:"files"` + Role string `json:"role"` + Text string `json:"text"` + Tool *ToolCall `json:"tool"` + Files []TextFile `json:"files"` + Images []string `json:"images"` } type Reasoning struct { @@ -308,6 +309,16 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, error) { }, } + for index, image := range message.Images { + msg.Images = append(msg.Images, openrouter.ChatCompletionImage{ + Index: index, + Type: openrouter.StreamImageTypeImageURL, + ImageURL: openrouter.ChatCompletionImageURL{ + URL: image, + }, + }) + } + tool := message.Tool if tool != nil { msg = tool.AsAssistantToolCall(message.Text) diff --git a/static/js/chat.js b/static/js/chat.js index 5934420..0b14587 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -876,7 +876,7 @@ } } - if (this.#images.length && full) { + if (this.#images.length) { data.images = this.#images; }