test(vector): mock 对 dim<=0 不再除零(保持 dim0→ErrInvalidDim 意图)
This commit is contained in:
1 parent
111ad598be
commit
6ea5affc8a
1 file changed
+4
@@ -62,6 +62,10 @@ func (m *mockEmbedder) Embed(ctx context.Context, texts []string) ([]embedding.V
|
||||
}
|
||||
out := make([]embedding.Vector, len(texts))
|
||||
for i := range texts {
|
||||
if m.dim <= 0 {
|
||||
out[i] = embedding.Vector{}
|
||||
continue
|
||||
}
|
||||
v := make(embedding.Vector, m.dim)
|
||||
v[i%m.dim] = 1
|
||||
out[i] = v
|
||||
|
||||
Reference in new issue
Block a user