TencentCloud / TencentCloud/Octop
[bug] 知识库 embedding 索引失败 —— 请求 batch 超限(400 Bad Request)
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 459
- Avg merge
- 8h 36m
- Merged PRs (30d)
- 228
Description
Expected behavior
chunk 数超过 20 时自动分批发送(每批 ≤20)并合并 embedding 结果,文档能正常索引完成。
Steps to reproduce
- 新建知识库,embedding backend 选
remote,模型qwen3.7-text-embedding - 上传任意超过 20 个 chunk(约 1.5 万字符以上)的文本/Markdown 文档
- 等待索引 → 文档状态变为
failed,日志出现上述 400
建议修复
在 embed_knowledge_texts() 内对 texts 按 ≤20 条分批循环请求、按序合并 data[].embedding;或复用已有 batch 常量的地方统一处理。注意保持返回顺序与传入 chunks 一一对应(KnowledgeIndex.replace_doc_chunks 依赖索引对齐)。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating embed_knowledge_texts() and inspect how KnowledgeIndex.replace_doc_chunks relies on embedding order. Reproduce the failure with more than 20 chunks, then verify requests are limited to 20 items and embeddings are merged in input order; indexing should complete successfully without the 400 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100