summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bot.go1
-rw-r--r--llm.go6
-rw-r--r--models/models.go5
-rw-r--r--props_table.go5
4 files changed, 12 insertions, 5 deletions
diff --git a/bot.go b/bot.go
index f7ba981..af41305 100644
--- a/bot.go
+++ b/bot.go
@@ -653,7 +653,6 @@ func sendMsgToLLM(body io.Reader) {
reasoningText := "<think>" + reasoningBuffer.String() + "</think>"
answerText = strings.ReplaceAll(reasoningText, "\n\n", "\n")
chunkChan <- answerText
- reasoningSent = true
}
if chunk.Chunk != "" {
logger.Warn("text inside of finish llmchunk", "chunk", chunk, "counter", counter)
diff --git a/llm.go b/llm.go
index bca9655..3da8488 100644
--- a/llm.go
+++ b/llm.go
@@ -237,8 +237,10 @@ func (op LCPChat) ParseChunk(data []byte) (*models.TextChunk, error) {
return &models.TextChunk{Finished: true}, nil
}
+ lastChoice := llmchunk.Choices[len(llmchunk.Choices)-1]
resp := &models.TextChunk{
- Chunk: llmchunk.Choices[len(llmchunk.Choices)-1].Delta.Content,
+ Chunk: lastChoice.Delta.Content,
+ Reasoning: lastChoice.Delta.ReasoningContent,
}
// Check for tool calls in all choices, not just the last one
@@ -256,7 +258,7 @@ func (op LCPChat) ParseChunk(data []byte) (*models.TextChunk, error) {
}
}
- if llmchunk.Choices[len(llmchunk.Choices)-1].FinishReason == "stop" {
+ if lastChoice.FinishReason == "stop" {
if resp.Chunk != "" {
logger.Error("text inside of finish llmchunk", "chunk", llmchunk)
}
diff --git a/models/models.go b/models/models.go
index b089ecd..c5e9435 100644
--- a/models/models.go
+++ b/models/models.go
@@ -64,8 +64,9 @@ type LLMRespChunk struct {
FinishReason string `json:"finish_reason"`
Index int `json:"index"`
Delta struct {
- Content string `json:"content"`
- ToolCalls []ToolDeltaResp `json:"tool_calls"`
+ Content string `json:"content"`
+ ReasoningContent string `json:"reasoning_content"`
+ ToolCalls []ToolDeltaResp `json:"tool_calls"`
} `json:"delta"`
} `json:"choices"`
Created int `json:"created"`
diff --git a/props_table.go b/props_table.go
index ac47f49..a1ec657 100644
--- a/props_table.go
+++ b/props_table.go
@@ -149,6 +149,11 @@ func makePropsTable(props map[string]float32) *tview.Table {
addListPopupRow("Set log level", logLevels, GetLogLevel(), func(option string) {
setLogLevel(option)
})
+ // Add reasoning effort dropdown (for OpenRouter and supported APIs)
+ reasoningEfforts := []string{"", "none", "minimal", "low", "medium", "high", "xhigh"}
+ addListPopupRow("Reasoning effort (OR)", reasoningEfforts, cfg.ReasoningEffort, func(option string) {
+ cfg.ReasoningEffort = option
+ })
// Helper function to get model list for a given API
getModelListForAPI := func(api string) []string {
if strings.Contains(api, "api.deepseek.com/") {