Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

refactor(chat): simplify temperature option handling in chat request builders

wizardchen4dd481560d94
diff --git a/internal/models/chat/ollama.go b/internal/models/chat/ollama.go
index 28d739454..fde77fa0f 100644
--- a/internal/models/chat/ollama.go
+++ b/internal/models/chat/ollama.go
@@ -93,9 +93,7 @@ func (c *OllamaChat) buildChatRequest(messages []Message, opts *ChatOptions, isS
// 添加可选参数
if opts != nil {
- if opts.Temperature > 0 {
- chatReq.Options["temperature"] = opts.Temperature
- }
+ chatReq.Options["temperature"] = opts.Temperature
if opts.TopP > 0 {
chatReq.Options["top_p"] = opts.TopP
}
diff --git a/internal/models/chat/remote_api.go b/internal/models/chat/remote_api.go
index 21d574190..ab16f7945 100644
--- a/internal/models/chat/remote_api.go
+++ b/internal/models/chat/remote_api.go
@@ -177,9 +177,7 @@ func (c *RemoteAPIChat) BuildChatCompletionRequest(messages []Message, opts *Cha
}
if opts != nil {
- if opts.Temperature > 0 {
- req.Temperature = float32(opts.Temperature)
- }
+ req.Temperature = float32(opts.Temperature)
if opts.TopP > 0 {
req.TopP = float32(opts.TopP)
}