Skip to content

[BUG] 简洁阐述问题 :初始化数据库阶段,报出prompt length 过长错误。 #5432

@Zheng-Yu-feng

Description

@Zheng-Yu-feng

问题描述 / Problem Description
初始化数据库阶段,报出prompt length 过长错误。

复现问题的步骤 / Steps to Reproduce

  1. 执行
    cd libs/chatchat-server
    python chatchat/cli.py kb --recreate-vs
  2. 滚动到
    正在将 samples/大模型指令对齐训练原理.md 添加到向量库,共包含3条文档
    Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 4.0 seconds as it raised InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:44205, pid=3320924] The decoder prompt (length 515) is longer than the maximum model length of 512. Make sure that max_model_len is no smaller than the number of text tokens.'}.
    Retrying chatchat.server.localai_embeddings.embed_with_retry.._embed_with_retry in 4.0 seconds as it raised InternalServerError: Error code: 500 - {'detail': '[address=0.0.0.0:44205, pid=3320924] The decoder prompt (length 515) is longer than the maximum model length of 512. Make sure that max_model_len is no smaller than the number of text tokens.'}.
  3. 问题出现
    2025-12-28 05:03:42.407 | ERROR | chatchat.server.utils:run_in_thread_pool:812 - error in sub thread: Error code: 500 - {'detail': '[address=0.0.0.0:44205, pid=3320924] The decoder prompt (length 515) is longer than the maximum model length of 512. Make sure that max_model_len is no smaller than the number of text tokens.'}
    2025-12-28 05:03:42.409 | ERROR | chatchat.init_database:worker:61 - texts and metadatas expected to be equal length but len(texts)=2 and len(metadatas)=3

环境信息 / Environment Information

  • Langchain-Chatchat 版本 / commit 号:0.3.1.3
  • 部署方式(pypi 安装 / 源码部署 / docker 部署):源码部署
  • 使用的模型推理框架(Xinference / Ollama / OpenAI API 等):Xinference
  • 使用的 LLM 模型(GLM-4-9B / Qwen2-7B-Instruct 等):qwen3
  • 使用的 Embedding 模型(bge-large-zh-v1.5 / m3e-base 等):bge-large-zh-v1.5
  • 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss
  • 操作系统及版本 / Operating system and version: Ubuntu 22.04
  • Python 版本 / Python version: 3.10
  • 推理使用的硬件(GPU / CPU / MPS / NPU 等) : GPU

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions