mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-11 01:41:26 +08:00
Append attachments content to last message (#17993)
This commit is contained in:
@@ -574,20 +574,9 @@ class RAGTools:
|
||||
|
||||
if self.tool_started_sink is not None:
|
||||
self.tool_started_sink()
|
||||
if self.text_attachments_content:
|
||||
self.kbinfos = {
|
||||
"chunks": [
|
||||
{
|
||||
"id": "chat_attachment",
|
||||
"chunk_id": "chat_attachment",
|
||||
"doc_id": "chat_attachment",
|
||||
"docnm_kwd": "Chat attachment",
|
||||
"content_with_weight": self.text_attachments_content,
|
||||
}
|
||||
],
|
||||
"doc_aggs": [{"doc_id": "chat_attachment", "doc_name": "Chat attachment", "count": 1}],
|
||||
}
|
||||
messages = [{"role": "user", "content": question}] if question else []
|
||||
if self.text_attachments_content and messages:
|
||||
messages[-1]["content"] += self.text_attachments_content
|
||||
final = ""
|
||||
async for kind, delta in _split_think_stream(run_agentic_rag(self, messages)):
|
||||
if kind == "answer":
|
||||
|
||||
@@ -143,8 +143,6 @@ async def agentic_research(state: dict, tools) -> dict:
|
||||
if action == "ANSWER_PARTIAL":
|
||||
return _finalize(ctx, tools, partial=True)
|
||||
if action == "ABSTAIN":
|
||||
if getattr(tools, "text_attachments_content", ""):
|
||||
return {"verdict": verdict.__dict__, "kbinfos": tools.kbinfos}
|
||||
tools.kbinfos["chunks"] = []
|
||||
return {"verdict": verdict.__dict__, "abstain": True}
|
||||
if action == "REPLAN":
|
||||
|
||||
@@ -186,8 +186,6 @@ async def decompose_and_search(state: dict, tools) -> dict:
|
||||
if action in ("ANSWER", "ANSWER_PARTIAL"):
|
||||
return _finalize(ctx, tools, partial=action == "ANSWER_PARTIAL", loop=completed_cycles)
|
||||
if action == "ABSTAIN":
|
||||
if getattr(tools, "text_attachments_content", ""):
|
||||
return {"verdict": verdict.__dict__, "kbinfos": tools.kbinfos}
|
||||
tools.kbinfos["chunks"] = []
|
||||
return {"verdict": verdict.__dict__, "abstain": True, "loop": completed_cycles}
|
||||
if action == "FALLBACK_LLM":
|
||||
|
||||
Reference in New Issue
Block a user