chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,56 @@
|
||||
package tools
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestStripThinkBlocks(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "no think blocks",
|
||||
input: "Hello, world!",
|
||||
expected: "Hello, world!",
|
||||
},
|
||||
{
|
||||
name: "empty string",
|
||||
input: "",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "single think block",
|
||||
input: "<think>Let me reason about this</think>The answer is 42.",
|
||||
expected: "The answer is 42.",
|
||||
},
|
||||
{
|
||||
name: "multiline think block",
|
||||
input: "<think>\nStep 1: analyze\nStep 2: solve\n</think>\nHere is my answer.",
|
||||
expected: "Here is my answer.",
|
||||
},
|
||||
{
|
||||
name: "multiple think blocks",
|
||||
input: "<think>first</think>Answer part 1. <think>second</think>Answer part 2.",
|
||||
expected: "Answer part 1. Answer part 2.",
|
||||
},
|
||||
{
|
||||
name: "only think block",
|
||||
input: "<think>just thinking</think>",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "think block with surrounding whitespace",
|
||||
input: " <think>reasoning</think> Answer ",
|
||||
expected: "Answer",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result := StripThinkBlocks(tt.input)
|
||||
if result != tt.expected {
|
||||
t.Errorf("StripThinkBlocks(%q) = %q, want %q", tt.input, result, tt.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user