ragflow报错:KeyError: ‘\n “序号“‘

环境:

ragflowv 0.17.2

问题描述:

ragflow报错:KeyError: '\n "序号"'

bash 复制代码
**1. 推荐表(输出json格式)**
[
  {
    "
  },
  {
    
  },
  {
    "
  },
  {
   
  }
]
bash 复制代码
raceback (most recent call last):
May 08 20:06:09 VM-0-2-ubuntu ragflow-start.sh[2745493]:   File "/mnt/code/ragflow/api/apps/conversation_app.py", line 232, in stream
May 08 20:06:09 VM-0-2-ubuntu ragflow-start.sh[2745493]:     for ans in chat(dia, msg, True, **req):
May 08 20:06:09 VM-0-2-ubuntu ragflow-start.sh[2745493]:   File "/mnt/code/ragflow/api/db/services/dialog_service.py", line 313, in chat
May 08 20:06:09 VM-0-2-ubuntu ragflow-start.sh[2745493]:     msg = [{"role": "system", "content": prompt_config["system"].format(**kwargs)}]
May 08 20:06:09 VM-0-2-ubuntu ragflow-start.sh[2745493]: KeyError: '\n    "志愿序号"'
May 08 20:06:09 VM-0-2-ubuntu ragflow-start.sh[2745493]: 2025-05-08 20:06:09,687 INFO     2745493 127.0.0.1 - - [08/May/2025 20:06:09] "POST /v1/conversatio

解决方案:

这个字符串中存在一个格式化占位符,形如 {...},需要用kwargs中的键去替换,但在 kwargs 字典中没有对应的键 '\n "志愿序号"'

1.更改去掉{}

bash 复制代码
**1. 推荐表(输出json格式)**
[
    "序号": "志愿1",
    "概率": "37%",
    "建议": "冲",
    "专业": "机械设计制造及其自动化"
,
  
    "序号": "志愿2",
    "概率": "33%",
    "建议": "稳",
    "专业": "电子信息类"
  ,
  
    "序号": "志愿3",
    "概率": "30%",
    "建议": "保",
    "专业": "电气工程及其自动化"
 ,
  
    "志愿序号": "志愿4",
    "概率": "28%",
    "建议": "难",
    "专业": "计算机类"
  ]

恢复正常

相关推荐
deephub5 天前
向量搜索系统的三个核心优化维度:速度、精度与规模
人工智能·python·rag·检索
海棠AI实验室6 天前
RAG 五大应用场景(三)企业级 Code RAG 与代码库 Copilot 深度架构指南
架构·copilot·rag
海棠AI实验室6 天前
RAG 五大应用场景(四)法务合同合规系统 —— 从“聊天玩具”到“证据链引擎”
rag·法务合同合规系统
deephub6 天前
RAG 中分块重叠的 8 个隐性开销与权衡策略
人工智能·大语言模型·rag·检索
无聊的小坏坏6 天前
RAG 实战 (下):打造多轮对话知识助手
langchain·rag·大模型应用
无聊的小坏坏8 天前
RAG 实战 (上):构建向量知识库
langchain·rag·大模型应用
麦麦大数据8 天前
M004_基于Langchain+RAG的银行智能客服系统设计与开发
typescript·langchain·flask·vue3·faiss·rag
小小工匠9 天前
大模型开发 - SpringAI 之高级 RAG 组件
rag·spring ai
Johnny.Cheung9 天前
面试:LLM RAG的三种算法和使用场景Reranking
llm·向量检索·rag