Version: 0.4.2.dev.260305

feat: 🧠 支持切换模型思考模式

* 新增模型思考开关配置,支持动态控制模型是否启用思考模式
This commit is contained in:
LoveLosita
2026-03-05 21:44:22 +08:00
parent f9d52e0c5e
commit cb5ac07e3c
4 changed files with 33 additions and 10 deletions

View File

@@ -22,7 +22,7 @@ func NewAgentService(aiHub *inits.AIHub, repo *dao.AgentDAO) *AgentService {
}
}
func (s *AgentService) AgentChat(ctx context.Context, userMessage string, userID int, chatID string) (<-chan string, <-chan error) {
func (s *AgentService) AgentChat(ctx context.Context, userMessage string, ifThinking bool, userID int, chatID string) (<-chan string, <-chan error) {
//1. 创建一个输出通道
outChan := make(chan string, 5)
errChan := make(chan error, 1)
@@ -69,7 +69,7 @@ func (s *AgentService) AgentChat(ctx context.Context, userMessage string, userID
go func() {
defer close(outChan) // 确保在函数结束时关闭通道
//3. 调用 StreamChat 函数进行流式聊天
fullText, err := agent.StreamChat(ctx, s.AIHub.Worker, userMessage, chatHistory, outChan)
fullText, err := agent.StreamChat(ctx, s.AIHub.Worker, userMessage, ifThinking, chatHistory, outChan)
if err != nil {
errChan <- err
return