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

恢复正常

相关推荐
G.E.N.4 天前
开源!RAG竞技场(2):标准RAG算法
大数据·人工智能·深度学习·神经网络·算法·llm·rag
booooooty6 天前
基于Spring AI Alibaba的多智能体RAG应用
java·人工智能·spring·多智能体·rag·spring ai·ai alibaba
knqiufan6 天前
深度解析影响 RAG 召回率的四大支柱——模型、数据、索引与检索
llm·milvus·向量数据库·rag
在未来等你8 天前
RAG实战指南 Day 4:LlamaIndex框架实战指南
大语言模型·rag·llamaindex·检索增强生成·ai开发
ZHOU_WUYI17 天前
Ragflow 源码:ragflow_server.py
ragflow
_pass_19 天前
Docker 运行RAGFlow 搭建RAG知识库
ollama·ragflow
ZHOU_WUYI19 天前
Ragflow 源码:task_executor.py
数据库·agent·ragflow
ZHOU_WUYI19 天前
Ragflow源码:launch_backend_service.sh
agent·ragflow
Florian19 天前
Graph ⋈ Agent:Chat2Graph 如何重构 GraphRAG 范式?
知识图谱·agent·rag·graphrag·chat2graph·符号主义
5ycode20 天前
深度拆解RAGFlow分片引擎之切片实现
知识库·rag·ragflow