mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 02:46:56 +00:00
(improvement)(chat)多轮对话增加rewrittenQuery的MapInfo (#1599)
This commit is contained in:
@@ -38,9 +38,10 @@ class BatchTest:
|
||||
response = requests.post(url, headers=headers, data=json.dumps(data))
|
||||
return response.json()
|
||||
|
||||
def execute(self, query_text, queryId):
|
||||
def execute(self, agentId, query_text, queryId):
|
||||
url = self.base_url + 'execute'
|
||||
data = {
|
||||
'agentId': agentId,
|
||||
'queryText': query_text,
|
||||
'parseId': 1,
|
||||
'chatId': self.chatId,
|
||||
@@ -75,7 +76,7 @@ def benchmark(url:str, agentId:str, chatId:str, filePath:str, userName:str):
|
||||
# 捕获异常,防止程序中断
|
||||
try:
|
||||
parse_resp = batch_test.parse(question)
|
||||
batch_test.execute(question, parse_resp['data']['queryId'])
|
||||
batch_test.execute(agentId, question, parse_resp['data']['queryId'])
|
||||
except Exception as e:
|
||||
print('error:', e)
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pandas==2.0.3
|
||||
pandas==2.2.2
|
||||
PyJWT==2.8.0
|
||||
requests==2.28.2
|
||||
|
||||
|
||||
@@ -203,8 +203,10 @@ public class NL2SQLParser implements ChatQueryParser {
|
||||
Response<AiMessage> response = chatLanguageModel.generate(prompt.toUserMessage());
|
||||
String rewrittenQuery = response.content().text();
|
||||
keyPipelineLog.info("NL2SQLParser modelResp:{}", rewrittenQuery);
|
||||
|
||||
parseContext.setQueryText(rewrittenQuery);
|
||||
QueryNLReq rewrittenQueryNLReq = QueryReqConverter.buildText2SqlQueryReq(parseContext);
|
||||
MapResp rewrittenQueryMapResult = chatLayerService.performMapping(rewrittenQueryNLReq);
|
||||
parseContext.setMapInfo(rewrittenQueryMapResult.getMapInfo());
|
||||
log.info("Last Query: {} Current Query: {}, Rewritten Query: {}",
|
||||
lastQuery.getQueryText(), currentMapResult.getQueryText(), rewrittenQuery);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user