diff --git a/assembly/bin/supersonic-build.bat b/assembly/bin/supersonic-build.bat index eade7d668..0895d2c4d 100644 --- a/assembly/bin/supersonic-build.bat +++ b/assembly/bin/supersonic-build.bat @@ -31,20 +31,23 @@ set requirementPath="%baseDir%/../chat/core/src/main/python/requirements.txt" %pip_path% install -r %requirementPath% echo "install python modules success" -rem 6. reset runtime -rd /s /q "%runtimeDir%" -mkdir "%runtimeDir%" -tar -zxvf "%buildDir%\supersonic-standalone.tar.gz" -C "%runtimeDir%" -for /d %%f in ("%runtimeDir%\launchers-standalone-*") do ( - move "%%f" "%runtimeDir%\supersonic-standalone" -) +call :BUILD_RUNTIME -rem 7. copy webapp to runtime -tar -zxvf "%buildDir%\supersonic-webapp.tar.gz" -C "%buildDir%" -if not exist "%runtimeDir%\supersonic-standalone\webapp" mkdir "%runtimeDir%\supersonic-standalone\webapp" -xcopy /s /e /h /y "%buildDir%\supersonic-webapp\*" "%runtimeDir%\supersonic-standalone\webapp" -if not exist "%runtimeDir%\supersonic-standalone\conf\webapp" mkdir "%runtimeDir%\supersonic-standalone\conf\webapp" -xcopy /s /e /h /y "%runtimeDir%\supersonic-standalone\webapp\*" "%runtimeDir%\supersonic-standalone\conf\webapp" -rd /s /q "%buildDir%\supersonic-webapp" +:BUILD_RUNTIME + rem 6. reset runtime + rd /s /q "%runtimeDir%" + mkdir "%runtimeDir%" + tar -zxvf "%buildDir%\supersonic-standalone.tar.gz" -C "%runtimeDir%" + for /d %%f in ("%runtimeDir%\launchers-standalone-*") do ( + move "%%f" "%runtimeDir%\supersonic-standalone" + ) + + rem 7. copy webapp to runtime + tar -zxvf "%buildDir%\supersonic-webapp.tar.gz" -C "%buildDir%" + if not exist "%runtimeDir%\supersonic-standalone\webapp" mkdir "%runtimeDir%\supersonic-standalone\webapp" + xcopy /s /e /h /y "%buildDir%\supersonic-webapp\*" "%runtimeDir%\supersonic-standalone\webapp" + if not exist "%runtimeDir%\supersonic-standalone\conf\webapp" mkdir "%runtimeDir%\supersonic-standalone\conf\webapp" + xcopy /s /e /h /y "%runtimeDir%\supersonic-standalone\webapp\*" "%runtimeDir%\supersonic-standalone\conf\webapp" + rd /s /q "%buildDir%\supersonic-webapp" endlocal \ No newline at end of file diff --git a/assembly/bin/supersonic-daemon.bat b/assembly/bin/supersonic-daemon.bat index 623a863f1..c4368daa2 100644 --- a/assembly/bin/supersonic-daemon.bat +++ b/assembly/bin/supersonic-daemon.bat @@ -21,6 +21,8 @@ if "%service%"=="" ( set "service=%standalone_service%" ) +call :BUILD_RUNTIME + if "%command%"=="restart" ( call :STOP call :START @@ -96,4 +98,21 @@ if "%command%"=="restart" ( :RELOAD_EXAMPLE cd "%runtimeDir%\supersonic-standalone\llmparser\sql" start %python_path% examples_reload_run.py - goto :EOF \ No newline at end of file + goto :EOF + +:BUILD_RUNTIME + rem 6. reset runtime + if exist "%runtimeDir%" goto :EOF + mkdir "%runtimeDir%" + tar -zxvf "%buildDir%\supersonic-standalone.tar.gz" -C "%runtimeDir%" + for /d %%f in ("%runtimeDir%\launchers-standalone-*") do ( + move "%%f" "%runtimeDir%\supersonic-standalone" + ) + + rem 7. copy webapp to runtime + tar -zxvf "%buildDir%\supersonic-webapp.tar.gz" -C "%buildDir%" + if not exist "%runtimeDir%\supersonic-standalone\webapp" mkdir "%runtimeDir%\supersonic-standalone\webapp" + xcopy /s /e /h /y "%buildDir%\supersonic-webapp\*" "%runtimeDir%\supersonic-standalone\webapp" + if not exist "%runtimeDir%\supersonic-standalone\conf\webapp" mkdir "%runtimeDir%\supersonic-standalone\conf\webapp" + xcopy /s /e /h /y "%runtimeDir%\supersonic-standalone\webapp\*" "%runtimeDir%\supersonic-standalone\conf\webapp" + rd /s /q "%buildDir%\supersonic-webapp" \ No newline at end of file diff --git a/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/ChatServiceImpl.java b/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/ChatServiceImpl.java index 4d985a654..ec531fa79 100644 --- a/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/ChatServiceImpl.java +++ b/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/ChatServiceImpl.java @@ -205,11 +205,10 @@ public class ChatServiceImpl implements ChatService { List solvedQueryRecallResps = solvedQueryManager.recallSolvedQuery(queryText, agentId); List queryIds = solvedQueryRecallResps.stream() .map(SolvedQueryRecallResp::getQueryId).collect(Collectors.toList()); - List queryIds = solvedQueryRecallResps.stream().map(SolvedQueryRecallResp::getQueryId) - .collect(Collectors.toList()); PageQueryInfoReq pageQueryInfoReq = new PageQueryInfoReq(); pageQueryInfoReq.setIds(queryIds); pageQueryInfoReq.setPageSize(100); + pageQueryInfoReq.setCurrent(1); //2. remove low score query int lowScoreThreshold = 3; PageInfo queryRespPageInfo = chatQueryRepository.getChatQuery(pageQueryInfoReq, null); diff --git a/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/QueryServiceImpl.java b/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/QueryServiceImpl.java index 29fc2754f..e339a1ad3 100644 --- a/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/QueryServiceImpl.java +++ b/chat/core/src/main/java/com/tencent/supersonic/chat/service/impl/QueryServiceImpl.java @@ -205,11 +205,7 @@ public class QueryServiceImpl implements QueryService { if (queryReq.isSaveAnswer() && QueryState.SUCCESS.equals(queryResult.getQueryState())) { chatCtx.setParseInfo(parseInfo); chatService.updateContext(chatCtx); - solvedQueryManager.saveSolvedQuery(SolvedQueryReq.builder().parseId(queryReq.getParseId()) - .queryId(queryReq.getQueryId()) - .agentId(chatQueryDO.getAgentId()) - .modelId(parseInfo.getModelId()) - .queryText(queryReq.getQueryText()).build()); + saveSolvedQuery(queryReq, parseInfo, chatQueryDO, queryResult); } chatCtx.setQueryText(queryReq.getQueryText()); chatCtx.setUser(queryReq.getUser().getName()); @@ -242,6 +238,18 @@ public class QueryServiceImpl implements QueryService { } } + private void saveSolvedQuery(ExecuteQueryReq queryReq, SemanticParseInfo parseInfo, + ChatQueryDO chatQueryDO, QueryResult queryResult) { + if (queryResult.getResponse() == null && CollectionUtils.isEmpty(queryResult.getQueryResults())) { + return; + } + solvedQueryManager.saveSolvedQuery(SolvedQueryReq.builder().parseId(queryReq.getParseId()) + .queryId(queryReq.getQueryId()) + .agentId(chatQueryDO.getAgentId()) + .modelId(parseInfo.getModelId()) + .queryText(queryReq.getQueryText()).build()); + } + @Override public QueryResult executeQuery(QueryReq queryReq) throws Exception { QueryContext queryCtx = new QueryContext(queryReq);