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%",
    "建议": "难",
    "专业": "计算机类"
  ]

恢复正常

相关推荐
论文复现现场3 小时前
企业知识库 RAG 用什么模型便宜?GLM-5.3-Flash 长文本 API 实测
python·rag·企业知识库·大模型api·glm-5.3-flash
云烟成雨TD7 小时前
LlamaIndex 系列【32】检索增强策略:自问自答(Self Ask)
ai·agent·rag·llamaindex
云烟成雨TD8 小时前
LlamaIndex 系列【35】节点后处理器(Node Postprocessor)
ai·agent·rag·llamaindex
jianpeng的工程笔记12 小时前
WeKnora 搭建研发 EDA 知识库:Docker 部署、RAG 与 Wiki 实践
docker·知识库·eda·rag
ysu_031412 小时前
【2026】AI Agent 工程化落地六大挑战:从路径坍缩到成本失控
人工智能·ai·rag·ai agent·大模型应用·langgraph·agent工程化
Experience-摆渡1 天前
Deep Dive:LLM Wiki 企业知识库范式——从 RAG 到知识预编译的架构与实践
rag
云烟成雨TD2 天前
LlamaIndex 系列【31】检索增强策略:命名实体识别(NER)
ai·agent·rag·llamaindex
Experience-摆渡2 天前
开源RAG知识库WeKnora深度调研:让知识自己长成体系
爬虫·docker·开源·rag
东莞市云毅网络有限公司2 天前
用 SQLite FTS5 给企业文档建本地全文索引:中文分词与权重调优
python·数据清洗·rag·企业知识库·文档解析
霸道流氓气质2 天前
RAG检索增强:12种Chunking策略深度对比
rag