Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: AI Agent https://github.com/siyuan-note/siyuan/issues/17797

Daniel42a4284448b7
diff --git a/kernel/agent/agent.go b/kernel/agent/agent.go
index 2b958c1e87..11c98dbb1f 100644
--- a/kernel/agent/agent.go
+++ b/kernel/agent/agent.go
@@ -363,7 +363,7 @@ func AgentChat(ctx context.Context, client *openai.Client, model string, session
}
temperature := kernelModel.Conf.AI.Agent.Temperature
- if temperature <= 0 {
+ if temperature < 0 || 2 < temperature {
temperature = 1.0
}
maxCompletionTokens := kernelModel.Conf.AI.Agent.MaxCompletionTokens
diff --git a/kernel/api/setting.go b/kernel/api/setting.go
index 315cffa7fe..d42ec09b1b 100644
--- a/kernel/api/setting.go
+++ b/kernel/api/setting.go
@@ -211,7 +211,7 @@ func setAI(c *gin.Context) {
if 0 > ai.Chat.MaxCompletionTokens {
ai.Chat.MaxCompletionTokens = 0
}
- if 0 >= ai.Chat.Temperature || 2 < ai.Chat.Temperature {
+ if 0 > ai.Chat.Temperature || 2 < ai.Chat.Temperature {
ai.Chat.Temperature = 1.0
}
if 1 > ai.Chat.MaxHistoryMessages || 64 < ai.Chat.MaxHistoryMessages {
diff --git a/kernel/model/conf.go b/kernel/model/conf.go
index 2f9399af15..3a2c048906 100644
--- a/kernel/model/conf.go
+++ b/kernel/model/conf.go
@@ -619,7 +619,7 @@ func InitConf() {
if 0 > Conf.AI.Chat.MaxCompletionTokens {
Conf.AI.Chat.MaxCompletionTokens = 0
}
- if 0 >= Conf.AI.Chat.Temperature || 2 < Conf.AI.Chat.Temperature {
+ if 0 > Conf.AI.Chat.Temperature || 2 < Conf.AI.Chat.Temperature {
Conf.AI.Chat.Temperature = 1.0
}
if 1 > Conf.AI.Chat.MaxHistoryMessages || 64 < Conf.AI.Chat.MaxHistoryMessages {