mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-17 03:27:02 +08:00
- 修复内存泄漏问题,该可能导致内存异常占用 - 支持俄语增加翻译范围 - 修复qwen-3.8-max中断问题(mimo也应该属于同一类问题) - 修复claude模型可能无法识别图片问题 @GGHansome - 支持自定义Openai端点 @Sxuan-Coder - WebSearch 接入百度搜索,DuckDuckGo 作为兜底 @杨超 - 修复一些兼容性问题 @kael-odin - 修复window上一些表现问题 @philau2512 🔔 如何让AI自动拉模型配置? (以下为提示词,把地址和密钥换为你的) 我的模型配置在 ~/.cursor-local-assistant-v2/config.yaml,我的API地址是:https://xxx 密钥是xxx,帮我拉所有模型配置进去,不要影响已有模型,根据models标准接口拉取。
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package modeladapter
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestSanitizeProviderMessagesMergesLegacyAssistantTextAndToolCallTurnsIdempotently(t *testing.T) {
|
|
input := []Message{
|
|
{
|
|
Role: "assistant",
|
|
Content: "Now let me pass stream.Mode in service.go.",
|
|
ReasoningContent: "I need to update service.go.",
|
|
},
|
|
{
|
|
Role: "assistant",
|
|
Content: "",
|
|
ReasoningContent: "I need to update service.go.",
|
|
ToolCalls: []ToolCallDescriptor{
|
|
{
|
|
ID: "call_1",
|
|
Type: "function",
|
|
Function: ToolCallFunctionShape{
|
|
Name: "PatchEdit",
|
|
Arguments: `{"path":"/workspace/service.go"}`,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Role: "tool",
|
|
Content: `{"success":{"path":"/workspace/service.go"}}`,
|
|
ToolCallID: "call_1",
|
|
Name: "PatchEdit",
|
|
},
|
|
}
|
|
|
|
first := sanitizeProviderMessages(input)
|
|
if len(first) != 2 {
|
|
t.Fatalf("message count = %d, want 2: %#v", len(first), first)
|
|
}
|
|
|
|
assistant := first[0]
|
|
if assistant.Content != input[0].Content {
|
|
t.Fatalf("assistant content = %q", assistant.Content)
|
|
}
|
|
if assistant.ReasoningContent != input[0].ReasoningContent {
|
|
t.Fatalf("assistant reasoning = %q, want one copy of %q", assistant.ReasoningContent, input[0].ReasoningContent)
|
|
}
|
|
if len(assistant.ToolCalls) != 1 || assistant.ToolCalls[0].ID != "call_1" {
|
|
t.Fatalf("assistant tool calls = %#v", assistant.ToolCalls)
|
|
}
|
|
|
|
second := sanitizeProviderMessages(first)
|
|
if !reflect.DeepEqual(second, first) {
|
|
t.Fatalf("sanitizing normalized messages changed them:\nfirst: %#v\nsecond: %#v", first, second)
|
|
}
|
|
}
|