ragflow/agent/component
zhangcdian bf0d516e49
Agent Update: Fix Role Issue and Enhance KB Search (#5842)
### What problem does this PR solve?

**generate.py 更新:**
问题:部分模型提供商对输入对话内容的格式有严格校验,要求第一条内容的 role 不能为 assistant,否则会报错。
解决:删除了系统设置的 agent 开场白,确保传递给模型的对话内容中,第一条内容的 role 不为 assistant。

**retrieval.py 更新:**
问题:当前知识库检索使用全部对话内容作为输入,可能导致检索结果不准确。
解决:改为仅使用用户最后提出的一个问题进行知识库检索,提高检索的准确性。

**Update generate.py:**
Issue: Some model providers have strict validation rules for the format
of input conversation content, requiring that the role of the first
content must not be assistant. Otherwise, an error will occur.
Solution: Removed the system-set agent opening statement to ensure that
the role of the first content in the conversation passed to the model is
not assistant.

**Update retrieval.py:**
Issue: The current knowledge base retrieval uses the entire conversation
content as input, which may lead to inaccurate retrieval results.
Solution: Changed the retrieval logic to use only the last question
asked by the user for knowledge base retrieval, improving retrieval
accuracy.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Performance Improvement
2025-03-10 18:29:58 +08:00
..
__init__.py Update comments (#4569) 2025-01-21 20:52:28 +08:00
akshare.py Import akshare lazzily. (#4708) 2025-02-05 12:04:11 +08:00
answer.py Code refactor. (#4291) 2024-12-30 18:38:51 +08:00
arxiv.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
baidu.py Add iteration for agent. (#4258) 2024-12-27 11:38:33 +08:00
baidufanyi.py Fix BaiduFanyi TestRun parameter validation and debug method missing … (#4275) 2024-12-30 10:34:57 +08:00
base.py Fix spelling errors (#5224) 2025-02-21 15:47:27 +08:00
begin.py Support debug components. (#3994) 2024-12-11 19:23:59 +08:00
bing.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
categorize.py Fix spelling errors (#5224) 2025-02-21 15:47:27 +08:00
concentrator.py Format: dos2unix (#4467) 2025-01-13 18:19:01 +08:00
crawler.py Fix potential SSRF attack vulnerability (#4334) 2025-01-02 18:45:45 +08:00
deepl.py Fix errors detected by Ruff (#3918) 2024-12-08 14:21:12 +08:00
duckduckgo.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
email.py Email sending tool (#3837) 2024-12-04 11:21:17 +08:00
exesql.py Feat: add data type invoke (#5126) 2025-02-27 16:15:33 +08:00
generate.py Agent Update: Fix Role Issue and Enhance KB Search (#5842) 2025-03-10 18:29:58 +08:00
github.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
google.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
googlescholar.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
invoke.py Feat: add data type invoke (#5126) 2025-02-27 16:15:33 +08:00
iteration.py Add iteration for agent. (#4258) 2024-12-27 11:38:33 +08:00
iterationitem.py Add iteration for agent. (#4258) 2024-12-27 11:38:33 +08:00
jin10.py Format: dos2unix (#4467) 2025-01-13 18:19:01 +08:00
keyword.py Component debugging funcionality. (#4012) 2024-12-13 08:50:32 +08:00
message.py Add graphrag (#1793) 2024-08-02 18:51:14 +08:00
pubmed.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
qweather.py Fix component qweather (#2240) 2024-09-04 17:53:11 +08:00
relevant.py Component debugging funcionality. (#4012) 2024-12-13 08:50:32 +08:00
retrieval.py Agent Update: Fix Role Issue and Enhance KB Search (#5842) 2025-03-10 18:29:58 +08:00
rewrite.py Refa: make Rewrite component effective to relative data expression. (#5752) 2025-03-07 13:48:13 +08:00
switch.py Fix errors detected by Ruff (#3918) 2024-12-08 14:21:12 +08:00
template.py Fix spelling errors (#5224) 2025-02-21 15:47:27 +08:00
tushare.py Format: dos2unix (#4467) 2025-01-13 18:19:01 +08:00
wencai.py Format: dos2unix (#4467) 2025-01-13 18:19:01 +08:00
wikipedia.py Use consistent log file names, introduced initLogger (#3403) 2024-11-14 17:13:48 +08:00
yahoofinance.py Format: dos2unix (#4467) 2025-01-13 18:19:01 +08:00