1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

add reasoning type

This commit is contained in:
Laura
2025-11-11 14:37:09 +01:00
parent b6c1a694e4
commit 61b53ad1c1
3 changed files with 88 additions and 54 deletions

15
chat.go
View File

@@ -434,10 +434,11 @@ func RunCompletion(ctx context.Context, response *Stream, request *openrouter.Ch
defer stream.Close()
var (
id string
open int
close int
tool *ToolCall
id string
open int
close int
reasoning bool
tool *ToolCall
)
buf := GetFreeBuffer()
@@ -506,6 +507,12 @@ func RunCompletion(ctx context.Context, response *Stream, request *openrouter.Ch
response.WriteChunk(NewChunk(ChunkText, delta.Content))
} else if delta.Reasoning != nil {
if !reasoning && len(delta.ReasoningDetails) != 0 {
reasoning = true
response.WriteChunk(NewChunk(ChunkReasoningType, delta.ReasoningDetails[0].Type))
}
response.WriteChunk(NewChunk(ChunkReasoning, *delta.Reasoning))
} else if len(delta.Images) > 0 {
for _, image := range delta.Images {