Skip to content

[Bug] 上传知识库文档失败 #4274

@DBJD-CR

Description

@DBJD-CR

What happened / 发生了什么

上传知识库文档时,如果分块后某一批次内容超过 10 条,会报错 batch size is invalid, it should not be larger than 10.: input.contents,导致上传失败。当前没有自动拆分批次或 UI 配置项,用户只能手动规避。

(具体的条目数受底层的嵌入模型 API 对每次批量处理的内容数量的限制)

Reproduce / 如何复现?

在知识库上传较大文档或多个文档,导致分块后某批次内容数 >10

实际行为

  • 上传失败,报错信息不够友好,且没有自动拆分或参数配置选项

期望行为

  • 支持自动拆分批次,确保每批 <=10 条内容自动上传
  • 或在 UI 提供 batch_size 配置项
  • 或在报错信息中明确提示用户如何规避

建议
希望优化上传流程,提升大文档上传体验。

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

v4.10.2,Windows一键安装器部署、阿里云百炼 text-embedding-v4、QQ个人号+NapCat

OS

Windows

Logs / 报错日志

[05:54:46] [Core] [ERRO] [knowledge_base.kb_helper:336]: 上传文档失败:有 2 个批次处理失败:批次 0 处理失败,已重试 3 次: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: Value error, batch size is invalid, it should not be larger than 10.: input.contents', 'type': 'InvalidParameter', 'param': None, 'code': 'InvalidParameter'}, 'id': 'c218cf08-77f8-9c37-8e12-fd9bc42ee2da', 'request_id': 'c218cf08-77f8-9c37-8e12-fd9bc42ee2da'}; 批次 1 处理失败,已重试 3 次: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: Value error, batch size is invalid, it should not be larger than 10.: input.contents', 'type': 'InvalidParameter', 'param': None, 'code': 'InvalidParameter'}, 'id': '2e9a763b-d2da-9913-b301-9d29bb983a46', 'request_id': '2e9a763b-d2da-9913-b301-9d29bb983a46'} 
[05:54:46] [Core] [ERRO] [routes.knowledge_base:188]: 上传文档 kb_lingchat_backend.md 失败:有 2 个批次处理失败:批次 0 处理失败,已重试 3 次: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: Value error, batch size is invalid, it should not be larger than 10.: input.contents', 'type': 'InvalidParameter', 'param': None, 'code': 'InvalidParameter'}, 'id': 'c218cf08-77f8-9c37-8e12-fd9bc42ee2da', 'request_id': 'c218cf08-77f8-9c37-8e12-fd9bc42ee2da'}; 批次 1 处理失败,已重试 3 次: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: Value error, batch size is invalid, it should not be larger than 10.: input.contents', 'type': 'InvalidParameter', 'param': None, 'code': 'InvalidParameter'}, 'id': '2e9a763b-d2da-9913-b301-9d29bb983a46', 'request_id': '2e9a763b-d2da-9913-b301-9d29bb983a46'} 
[05:54:50] [Core] [ERRO] [knowledge_base.kb_helper:336]: 上传文档失败:有 1 个批次处理失败:批次 0 处理失败,已重试 3 次: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: Value error, batch size is invalid, it should not be larger than 10.: input.contents', 'type': 'InvalidParameter', 'param': None, 'code': 'InvalidParameter'}, 'id': '48481b29-ef1d-9937-8711-19ac820f5655', 'request_id': '48481b29-ef1d-9937-8711-19ac820f5655'} 
[05:54:50] [Core] [ERRO] [routes.knowledge_base:188]: 上传文档 kb_lingchat_script_designer.md 失败:有 1 个批次处理失败:批次 0 处理失败,已重试 3 次: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: Value error, batch size is invalid, it should not be larger than 10.: input.contents', 'type': 'InvalidParameter', 'param': None, 'code': 'InvalidParameter'}, 'id': '48481b29-ef1d-9937-8711-19ac820f5655', 'request_id': '48481b29-ef1d-9937-8711-19ac820f5655'}

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't workingfeature:knowledge-baseThe bug / feature is about knowledge basepriority: p0will fix asap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions