mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
hide referece when disable cite (#1535)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -162,6 +162,7 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|||||||
|
|
||||||
def decorate_answer(answer):
|
def decorate_answer(answer):
|
||||||
nonlocal prompt_config, knowledges, kwargs, kbinfos
|
nonlocal prompt_config, knowledges, kwargs, kbinfos
|
||||||
|
refs = []
|
||||||
if knowledges and (prompt_config.get("quote", True) and kwargs.get("quote", True)):
|
if knowledges and (prompt_config.get("quote", True) and kwargs.get("quote", True)):
|
||||||
answer, idx = retrievaler.insert_citations(answer,
|
answer, idx = retrievaler.insert_citations(answer,
|
||||||
[ck["content_ltks"]
|
[ck["content_ltks"]
|
||||||
@ -177,10 +178,11 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|||||||
if not recall_docs: recall_docs = kbinfos["doc_aggs"]
|
if not recall_docs: recall_docs = kbinfos["doc_aggs"]
|
||||||
kbinfos["doc_aggs"] = recall_docs
|
kbinfos["doc_aggs"] = recall_docs
|
||||||
|
|
||||||
refs = deepcopy(kbinfos)
|
refs = deepcopy(kbinfos)
|
||||||
for c in refs["chunks"]:
|
for c in refs["chunks"]:
|
||||||
if c.get("vector"):
|
if c.get("vector"):
|
||||||
del c["vector"]
|
del c["vector"]
|
||||||
|
|
||||||
if answer.lower().find("invalid key") >= 0 or answer.lower().find("invalid api") >= 0:
|
if answer.lower().find("invalid key") >= 0 or answer.lower().find("invalid api") >= 0:
|
||||||
answer += " Please set LLM API-Key in 'User Setting -> Model Providers -> API-Key'"
|
answer += " Please set LLM API-Key in 'User Setting -> Model Providers -> API-Key'"
|
||||||
return {"answer": answer, "reference": refs}
|
return {"answer": answer, "reference": refs}
|
||||||
|
|||||||
Reference in New Issue
Block a user