mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: no doc hits after meta data filter. (#9435)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -365,8 +365,12 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|||||||
if dialog.meta_data_filter.get("method") == "auto":
|
if dialog.meta_data_filter.get("method") == "auto":
|
||||||
filters = gen_meta_filter(chat_mdl, metas, questions[-1])
|
filters = gen_meta_filter(chat_mdl, metas, questions[-1])
|
||||||
attachments.extend(meta_filter(metas, filters))
|
attachments.extend(meta_filter(metas, filters))
|
||||||
|
if not attachments:
|
||||||
|
attachments = None
|
||||||
elif dialog.meta_data_filter.get("method") == "manual":
|
elif dialog.meta_data_filter.get("method") == "manual":
|
||||||
attachments.extend(meta_filter(metas, dialog.meta_data_filter["manual"]))
|
attachments.extend(meta_filter(metas, dialog.meta_data_filter["manual"]))
|
||||||
|
if not attachments:
|
||||||
|
attachments = None
|
||||||
|
|
||||||
if prompt_config.get("keyword", False):
|
if prompt_config.get("keyword", False):
|
||||||
questions[-1] += keyword_extraction(chat_mdl, questions[-1])
|
questions[-1] += keyword_extraction(chat_mdl, questions[-1])
|
||||||
@ -375,17 +379,16 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|||||||
|
|
||||||
thought = ""
|
thought = ""
|
||||||
kbinfos = {"total": 0, "chunks": [], "doc_aggs": []}
|
kbinfos = {"total": 0, "chunks": [], "doc_aggs": []}
|
||||||
|
|
||||||
if "knowledge" not in [p["key"] for p in prompt_config["parameters"]]:
|
|
||||||
knowledges = []
|
knowledges = []
|
||||||
else:
|
|
||||||
|
if attachments is not None and "knowledge" in [p["key"] for p in prompt_config["parameters"]]:
|
||||||
tenant_ids = list(set([kb.tenant_id for kb in kbs]))
|
tenant_ids = list(set([kb.tenant_id for kb in kbs]))
|
||||||
knowledges = []
|
knowledges = []
|
||||||
if prompt_config.get("reasoning", False):
|
if prompt_config.get("reasoning", False):
|
||||||
reasoner = DeepResearcher(
|
reasoner = DeepResearcher(
|
||||||
chat_mdl,
|
chat_mdl,
|
||||||
prompt_config,
|
prompt_config,
|
||||||
partial(retriever.retrieval, embd_mdl=embd_mdl, tenant_ids=tenant_ids, kb_ids=dialog.kb_ids, page=1, page_size=dialog.top_n, similarity_threshold=0.2, vector_similarity_weight=0.3),
|
partial(retriever.retrieval, embd_mdl=embd_mdl, tenant_ids=tenant_ids, kb_ids=dialog.kb_ids, page=1, page_size=dialog.top_n, similarity_threshold=0.2, vector_similarity_weight=0.3, doc_ids=attachments),
|
||||||
)
|
)
|
||||||
|
|
||||||
for think in reasoner.thinking(kbinfos, " ".join(questions)):
|
for think in reasoner.thinking(kbinfos, " ".join(questions)):
|
||||||
|
|||||||
@ -106,3 +106,4 @@ REMEMBER:
|
|||||||
- Each citation supports the ENTIRE sentence
|
- Each citation supports the ENTIRE sentence
|
||||||
- When in doubt, ask: "Would a fact-checker need to verify this?"
|
- When in doubt, ask: "Would a fact-checker need to verify this?"
|
||||||
- Place citations at sentence end, before punctuation
|
- Place citations at sentence end, before punctuation
|
||||||
|
- Format likes this is FORBIDDEN: [ID:0, ID:5, ID:...]. It MUST be seperated like, [ID:0][ID:5]...
|
||||||
|
|||||||
@ -191,7 +191,6 @@ class RAGFlowS3:
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
@use_prefix_path
|
|
||||||
@use_default_bucket
|
@use_default_bucket
|
||||||
def rm_bucket(self, bucket, *args, **kwargs):
|
def rm_bucket(self, bucket, *args, **kwargs):
|
||||||
for conn in self.conn:
|
for conn in self.conn:
|
||||||
|
|||||||
Reference in New Issue
Block a user