feat: preserve and echo thinking blocks for extended-thinking models (DeepSeek, Claude thinking mode)

This commit is contained in:
sausheong committed 2026-07-12 20:30:48 +08:00
1 parent d3c74e5681
commit 152d8b972e
6 files changed
+116 -17

No files matched your search

+9
View File
@@ -212,6 +212,15 @@ func assembleMessages(history []session.SessionEntry) []llm.Message {
Role: entry.Role,
Content: md.Text,
}
// Restore thinking blocks for assistant messages (must be echoed back).
if entry.Role == "assistant" {
for _, tb := range md.ThinkingBlocks {
msg.ThinkingBlocks = append(msg.ThinkingBlocks, llm.ThinkingBlock{
Thinking: tb.Thinking,
Signature: tb.Signature,
})
}
}
// Convert session images to LLM image content
if entry.Role == "user" {
for _, img := range md.Images {