fix(embedding): enable retry backoff for embedding API calls (#173)

MAX_RETRIES was hardcoded to 0, making the existing exponential
backoff retry logic dead code. Transient errors (network jitter,
429 rate limits, DNS failures) caused immediate embedding failure,
contributing to JSONL/SQLite drift (issue #156).

Changed MAX_RETRIES from 0 to 3, matching the retry strategy
already used by tcvdb-client.ts.

Closes #159

Signed-off-by: WSL_zhangxiaoshuai <zhangxiaoshuai@wsl.com>
Co-authored-by: WSL_zhangxiaoshuai <zhangxiaoshuai@wsl.com>
This commit is contained in:
zhangxiaoshuai
2026-06-24 17:17:03 +08:00
committed by GitHub
parent 9fac8bc998
commit 38673b5d2b
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -96,7 +96,7 @@
"sendDimensions": { "type": "boolean", "default": true, "description": "是否在请求体中携带 dimensions 字段。默认 true(兼容 OpenAI text-embedding-3-* 的 Matryoshka 截断)。当目标服务为 BGE-M3 等不支持自定义维度的固定维度模型时,请设为 false,否则会被服务端以 HTTP 400 拒绝('does not support matryoshka representation')。" },
"conflictRecallTopK": { "type": "number", "default": 5, "description": "冲突检测时召回 Top-K 数" },
"maxInputChars": { "type": "number", "default": 5000, "description": "Embedding 输入文本最大字符数,超出时截断并打印警告日志(默认 5000,适合大多数模型的 token 上限)" },
"timeoutMs": { "type": "number", "default": 10000, "description": "单次 embedding API 调用超时(毫秒),超时后该次请求中止且不重试" },
"timeoutMs": { "type": "number", "default": 10000, "description": "单次 embedding API 调用超时(毫秒),超时后会自动重试(最多 3 次)" },
"recallTimeoutMs": { "type": "number", "description": "recall 路径 embedding 超时(毫秒),覆盖 timeoutMs。用户等待中,建议设短一些(如 3000)" },
"captureTimeoutMs": { "type": "number", "description": "capture 路径 embedding 超时(毫秒),覆盖 timeoutMs。后台运行,可设长一些(如 15000)" }
}