Skip to content

Commit d9bbd67

Browse files
author
zhuque-security
committed
bugfix
1 parent 5b7ef70 commit d9bbd67

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

common/websocket/mcp_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
WSMsgTypeMcpREADME = "readme"
2424
WSMsgTypeMcpProcessing = "processing"
2525
WSMsgTypeMcpFinish = "finish"
26-
WSMsgTypeMcpStop = "stpp"
26+
WSMsgTypeMcpStop = "stop"
2727
WSMsgTypeMcpError = "error"
2828
)
2929

internal/mcp/scanner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ func (s *Scanner) SaveHistory(b bool) error {
128128
func (s *Scanner) SetLanguage(language string) error {
129129
if language == "zh-CN" {
130130
s.language = "zh"
131+
} else {
132+
s.language = language
131133
}
132-
s.language = language
133134
return nil
134135
}
135136

internal/mcp/utils/agent.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,11 @@ func (a *AutoGPT) Run(ctx context.Context, aiModel *models.OpenAI) (string, erro
586586
userPrompt = fmt.Sprintf("未知命令:%s 你只能使用 read_file, continue_read, list_dir, grep, finish 命令", command.Name)
587587
}
588588
maxLength := 200
589-
if len(userPrompt) < maxLength {
590-
maxLength = len(userPrompt)
589+
userPrompt2 := []rune(userPrompt)
590+
if len(userPrompt2) < maxLength {
591+
maxLength = len(userPrompt2)
591592
}
592-
gologger.Infoln("executing result:", userPrompt[:maxLength], "...")
593+
gologger.Infoln("executing result:", string(userPrompt2[:maxLength]), "...")
593594
// 添加用户提示到历史记录
594595
history = append(history, map[string]string{
595596
"role": "user",

0 commit comments

Comments
 (0)