docs(comments): 注释中文化 · internal/runtime/memory(31 文件,纯替换)
- 只翻注释/文档字符串:820 增 / 820 删 严格 1:1;剥掉整行注释与行尾注释尾巴后, 逐文件与 HEAD 比对「代码部分差异 = 0」;裁决/design 编号计数逐项与 HEAD 一致 - 保留可执行 SQL 样例、SQLite 报错原文、pgvector/HNSW/ANN/BLOB 等技术词原文 - 复核:go build 绿 + memory/projectindex/vector 三包测试绿;gofmt 仅剩 2 个既有未格式化文件(改动前即如此,未顺手修)
This commit is contained in:
1 parent
eb1828ee7a
commit
61cf80d5ee
31 files changed
+820
-820
No files matched your search
@@ -10,9 +10,9 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
|
||||
)
|
||||
|
||||
// mockAdapter is a scriptable model.Adapter for tests. With no fn it returns an
|
||||
// empty candidate array, so a test that only needs a successful call can use it
|
||||
// directly.
|
||||
// mockAdapter 是测试用的可脚本化 model.Adapter。未设置 fn 时它返回
|
||||
// 空候选数组,因此只需要一次成功调用的测试可以直接
|
||||
// 用它。
|
||||
type mockAdapter struct {
|
||||
fn func(ctx context.Context, req model.Request, opts model.Options) (model.Response, error)
|
||||
}
|
||||
@@ -81,7 +81,7 @@ func TestLLMExtractor_Extract_InvalidScopeKind_Fallback_正常(t *testing.T) {
|
||||
if len(items) != 1 {
|
||||
t.Fatalf("got %d items, want 1", len(items))
|
||||
}
|
||||
// Bogus scope/kind fall back to the extractor's configured defaults.
|
||||
// 非法 scope/kind 回退到提取器配置的默认值。
|
||||
if items[0].Scope != ScopePersona || items[0].Kind != KindRelationship {
|
||||
t.Errorf("fallback scope/kind = %q/%q, want persona/relationship", items[0].Scope, items[0].Kind)
|
||||
}
|
||||
@@ -99,8 +99,8 @@ func TestLLMExtractor_Prompt_ExcludesSource(t *testing.T) {
|
||||
|
||||
func TestLLMExtractor_Extract_Dedup_正常(t *testing.T) {
|
||||
t.Parallel()
|
||||
// The model emits the same memory three times, differing only in case and
|
||||
// surrounding whitespace; they must collapse into one item.
|
||||
// 模型三次输出同一条记忆,只有大小写与
|
||||
// 周边空白不同;它们必须归并为一条条目。
|
||||
adapter := &mockAdapter{fn: func(_ context.Context, _ model.Request, _ model.Options) (model.Response, error) {
|
||||
return model.Response{Content: `[
|
||||
{"content":"记得喝咖啡"},
|
||||
@@ -196,8 +196,8 @@ func TestLLMExtractor_ExtractAsync_异步_正常(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("ExtractAsync: %v", err)
|
||||
}
|
||||
// ExtractAsync returned while the adapter is still blocked on release,
|
||||
// proving the extraction runs on a background goroutine.
|
||||
// adapter 仍阻塞在 release 上时 ExtractAsync 就返回了,
|
||||
// 证明提取跑在后台 goroutine 上。
|
||||
select {
|
||||
case <-started:
|
||||
case <-time.After(2 * time.Second):
|
||||
@@ -231,7 +231,7 @@ func TestLLMExtractor_ExtractAsync_Idempotent_正常(t *testing.T) {
|
||||
t.Fatalf("first async result = %+v, want 1 item", res)
|
||||
}
|
||||
|
||||
// A second async extraction of the same memory deduplicates to zero.
|
||||
// 对同一条记忆的第二次异步提取去重后为零条。
|
||||
second, err := ex.ExtractAsync(context.Background(), conv)
|
||||
if err != nil {
|
||||
t.Fatalf("ExtractAsync second: %v", err)
|
||||
|
||||
Reference in new issue
Block a user