build: 内置 norma 模块,构建不再依赖上游仓库
把 github.com/Autumn-27/norma v0.4.3(commit 320ae32)的源码复制到 third_party/norma,并用 go.mod 的 replace 指向本地副本。上游删除仓库或 改写 tag 都不再影响本仓库构建。 - 已验证 GOPROXY=off 下可完整编译并打出发行包 - go.sum 中该模块的两条校验记录随之删除(本地 replace 不需要哈希) - 升级方法与授权注意事项见 third_party/README.md
This commit is contained in:
1 parent
a819fa3230
commit
f782b612ec
213 files changed
+37401
-2
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
package llm
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestBuildAnthropicSystemCacheBoundary(t *testing.T) {
|
||||
sys := []string{"a", "b", "c"}
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
boundary int
|
||||
wantBlocks int
|
||||
wantCached []bool // per-block: has cache_control
|
||||
}{
|
||||
{"no boundary (0) → single uncached", 0, 1, []bool{false}},
|
||||
{"negative → single uncached", -1, 1, []bool{false}},
|
||||
{"mid split → cached prefix + dynamic tail", 2, 2, []bool{true, false}},
|
||||
{"boundary == len → whole thing cached", 3, 1, []bool{true}},
|
||||
{"boundary > len → whole thing cached", 5, 1, []bool{true}},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
blocks := buildAnthropicSystem(CompletionRequest{System: sys, DynamicBoundary: c.boundary})
|
||||
if len(blocks) != c.wantBlocks {
|
||||
t.Fatalf("blocks=%d want %d", len(blocks), c.wantBlocks)
|
||||
}
|
||||
for i, wantCached := range c.wantCached {
|
||||
gotCached := blocks[i].CacheControl != nil
|
||||
if gotCached != wantCached {
|
||||
t.Fatalf("block %d cached=%v want %v", i, gotCached, wantCached)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user