### What problem does this PR solve?

Close #6030 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Zhichang Yu 2025-03-14 11:29:22 +08:00 committed by GitHub
parent f16418ccf7
commit c00def5b71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@ from collections import defaultdict
from copy import deepcopy
import json_repair
import pandas as pd
import trio
from api.utils import get_uuid
from graphrag.query_analyze_prompt import PROMPTS
@ -41,7 +42,7 @@ class KGSearch(Dealer):
return response
def query_rewrite(self, llm, question, idxnms, kb_ids):
ty2ents = get_entity_type2sampels(idxnms, kb_ids)
ty2ents = trio.run(lambda: get_entity_type2sampels(idxnms, kb_ids))
hint_prompt = PROMPTS["minirag_query2kwd"].format(query=question,
TYPE_POOL=json.dumps(ty2ents, ensure_ascii=False, indent=2))
result = self._chat(llm, hint_prompt, [{"role": "user", "content": "Output:"}], {"temperature": .5})