WeKnora/internal/models/embedding
ljl 2b31d3681b fix(embedding): prevent ants worker panic and mutex deadlock on empty/mismatched results
If the embedding provider returns an empty slice of vectors (e.g. length 0)
due to api mismatch or empty input, BatchEmbed will return length 0.
Accessing embedding[i] directly in BatchEmbedWithPool results in an out of bounds panic.
Because the panic occurs inside a mu.Lock() block, the mutex is never unlocked,
leading to a permanent deadlock of the document processing queue.

This fix checks the returned embeddings slice length and returns an error
instead of panicking, releasing the mutex properly.
2026-08-04 16:46:57 +08:00
..
aliyun.go
…
azure_openai.go
…
azure_openai_test.go
…
batch.go fix(embedding): prevent ants worker panic and mutex deadlock on empty/mismatched results 2026-08-04 16:46:57 +08:00
concurrency_wrapper.go
…
concurrency_wrapper_test.go
…
config_from_model_test.go
…
dimensions_policy_test.go
…
embedder.go
…
gemini.go
…
gemini_test.go
…
jina.go
…
langfuse_wrapper.go
…
llm_debug.go
…
nvidia.go
…
ollama.go
…
openai.go
…
openai_test.go
…
transport.go
…
transport_test.go
…
volcengine.go
…
weknoracloud.go
…
zhipu.go
…