From 0d020ce30c5eaaec762f31711d65817b39f44c49 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 31 Dec 2025 13:42:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=80=9D=E8=80=83?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E9=85=8D=E7=BD=AE=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在SummaryConfig结构体中新增Thinking字段,支持启用思考模式功能。更新相关配置文件、类型定义和客户端代码以支持该功能。 --- client/session.go | 17 +++++++++-------- .../application/service/chat_pipline/common.go | 1 + internal/config/config.go | 1 + internal/types/chat_manage.go | 1 + internal/types/session.go | 2 ++ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/session.go b/client/session.go index 65b6a185..98cff914 100644 --- a/client/session.go +++ b/client/session.go @@ -47,6 +47,7 @@ type SummaryConfig struct { Temperature float64 `json:"temperature"` Seed int `json:"seed"` MaxCompletionTokens int `json:"max_completion_tokens"` + Thinking *bool `json:"thinking"` } // SessionAgentConfig defines session-level agent configuration (matches server struct). @@ -66,10 +67,10 @@ type CreateSessionRequest struct { // ContextConfig configures LLM context management type ContextConfig struct { - MaxTokens int `json:"max_tokens"` // Maximum tokens allowed in LLM context - CompressionStrategy string `json:"compression_strategy"` // Compression strategy: "sliding_window" or "smart" - RecentMessageCount int `json:"recent_message_count"` // Number of recent messages to keep - SummarizeThreshold int `json:"summarize_threshold"` // Number of messages before summarization + MaxTokens int `json:"max_tokens"` // Maximum tokens allowed in LLM context + CompressionStrategy string `json:"compression_strategy"` // Compression strategy: "sliding_window" or "smart" + RecentMessageCount int `json:"recent_message_count"` // Number of recent messages to keep + SummarizeThreshold int `json:"summarize_threshold"` // Number of messages before summarization } // Session session information @@ -425,10 +426,10 @@ func (c *Client) StopSession(ctx context.Context, sessionID string, messageID st // SearchKnowledgeRequest knowledge search request type SearchKnowledgeRequest struct { - Query string `json:"query"` // Query content - KnowledgeBaseID string `json:"knowledge_base_id,omitempty"` // Single knowledge base ID (for backward compatibility) - KnowledgeBaseIDs []string `json:"knowledge_base_ids,omitempty"` // Knowledge base IDs (multi-KB support) - KnowledgeIDs []string `json:"knowledge_ids,omitempty"` // Specific knowledge (file) IDs + Query string `json:"query"` // Query content + KnowledgeBaseID string `json:"knowledge_base_id,omitempty"` // Single knowledge base ID (for backward compatibility) + KnowledgeBaseIDs []string `json:"knowledge_base_ids,omitempty"` // Knowledge base IDs (multi-KB support) + KnowledgeIDs []string `json:"knowledge_ids,omitempty"` // Specific knowledge (file) IDs } // SearchKnowledgeResponse search results response diff --git a/internal/application/service/chat_pipline/common.go b/internal/application/service/chat_pipline/common.go index 5e2e4e46..66df2916 100644 --- a/internal/application/service/chat_pipline/common.go +++ b/internal/application/service/chat_pipline/common.go @@ -46,6 +46,7 @@ func prepareChatModel(ctx context.Context, modelService interfaces.ModelService, MaxCompletionTokens: chatManage.SummaryConfig.MaxCompletionTokens, FrequencyPenalty: chatManage.SummaryConfig.FrequencyPenalty, PresencePenalty: chatManage.SummaryConfig.PresencePenalty, + Thinking: chatManage.SummaryConfig.Thinking, } return chatModel, opt, nil diff --git a/internal/config/config.go b/internal/config/config.go index 9a137a3b..c06af39d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -78,6 +78,7 @@ type SummaryConfig struct { Seed int `yaml:"seed" json:"seed"` MaxCompletionTokens int `yaml:"max_completion_tokens" json:"max_completion_tokens"` NoMatchPrefix string `yaml:"no_match_prefix" json:"no_match_prefix"` + Thinking *bool `yaml:"thinking" json:"thinking"` } // ServerConfig 服务器配置 diff --git a/internal/types/chat_manage.go b/internal/types/chat_manage.go index 2843f81e..db00f780 100644 --- a/internal/types/chat_manage.go +++ b/internal/types/chat_manage.go @@ -113,6 +113,7 @@ func (c *ChatManage) Clone() *ChatManage { Temperature: c.SummaryConfig.Temperature, Seed: c.SummaryConfig.Seed, MaxCompletionTokens: c.SummaryConfig.MaxCompletionTokens, + Thinking: c.SummaryConfig.Thinking, }, FallbackStrategy: c.FallbackStrategy, FallbackResponse: c.FallbackResponse, diff --git a/internal/types/session.go b/internal/types/session.go index 9d5cfd96..416b25a3 100644 --- a/internal/types/session.go +++ b/internal/types/session.go @@ -43,6 +43,8 @@ type SummaryConfig struct { Seed int `json:"seed"` // Max completion tokens MaxCompletionTokens int `json:"max_completion_tokens"` + // Thinking - whether to enable thinking mode + Thinking *bool `json:"thinking"` } // ContextCompressionStrategy represents the strategy for context compression