mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-10 21:09:03 +08:00
Fix: LLM generated tag issue. (#7301)
### What problem does this PR solve? #7298 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
eead838353
commit
b271cc34b3
@ -355,15 +355,22 @@ Output:
|
|||||||
raise Exception(kwd)
|
raise Exception(kwd)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return json_repair.loads(kwd)
|
obj = json_repair.loads(kwd)
|
||||||
except json_repair.JSONDecodeError:
|
except json_repair.JSONDecodeError:
|
||||||
try:
|
try:
|
||||||
result = kwd.replace(prompt[:-1], "").replace("user", "").replace("model", "").strip()
|
result = kwd.replace(prompt[:-1], "").replace("user", "").replace("model", "").strip()
|
||||||
result = "{" + result.split("{")[1].split("}")[0] + "}"
|
result = "{" + result.split("{")[1].split("}")[0] + "}"
|
||||||
return json_repair.loads(result)
|
obj = json_repair.loads(result)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(f"JSON parsing error: {result} -> {e}")
|
logging.exception(f"JSON parsing error: {result} -> {e}")
|
||||||
raise e
|
raise e
|
||||||
|
res = {}
|
||||||
|
for k, v in obj.items():
|
||||||
|
try:
|
||||||
|
res[str(k)] = int(v)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
def vision_llm_describe_prompt(page=None) -> str:
|
def vision_llm_describe_prompt(page=None) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user