mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 22:25:19 +00:00
[fix][launcher]Fix Text2SQLEval.
This commit is contained in:
@@ -91,9 +91,6 @@ public abstract class S2BaseDemo implements CommandLineRunner {
|
|||||||
@Value("${s2.demo.names:S2VisitsDemo}")
|
@Value("${s2.demo.names:S2VisitsDemo}")
|
||||||
protected List<String> demoList;
|
protected List<String> demoList;
|
||||||
|
|
||||||
@Value("${s2.demo.enableLLM:true}")
|
|
||||||
protected boolean demoEnableLlm;
|
|
||||||
|
|
||||||
public void run(String... args) {
|
public void run(String... args) {
|
||||||
demoDatabase = addDatabaseIfNotExist();
|
demoDatabase = addDatabaseIfNotExist();
|
||||||
demoChatModel = addChatModelIfNotExist();
|
demoChatModel = addChatModelIfNotExist();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
|
|||||||
import com.tencent.supersonic.headless.api.pojo.response.QueryState;
|
import com.tencent.supersonic.headless.api.pojo.response.QueryState;
|
||||||
import com.tencent.supersonic.util.DataUtils;
|
import com.tencent.supersonic.util.DataUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
@TestPropertySource(properties = {"s2.demo.enableLLM = false"})
|
|
||||||
public class BaseTest extends BaseApplication {
|
public class BaseTest extends BaseApplication {
|
||||||
|
|
||||||
protected final int unit = 7;
|
protected final int unit = 7;
|
||||||
@@ -37,6 +36,9 @@ public class BaseTest extends BaseApplication {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected ChatModelService chatModelService;
|
protected ChatModelService chatModelService;
|
||||||
|
|
||||||
|
@Value("${s2.demo.enableLLM:false}")
|
||||||
|
protected boolean enableLLM;
|
||||||
|
|
||||||
protected QueryResult submitMultiTurnChat(String queryText, Integer agentId, Integer chatId)
|
protected QueryResult submitMultiTurnChat(String queryText, Integer agentId, Integer chatId)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
ParseResp parseResp = submitParse(queryText, agentId, chatId);
|
ParseResp parseResp = submitParse(queryText, agentId, chatId);
|
||||||
@@ -65,7 +67,8 @@ public class BaseTest extends BaseApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected ParseResp submitParse(String queryText, Integer agentId, Integer chatId) {
|
protected ParseResp submitParse(String queryText, Integer agentId, Integer chatId) {
|
||||||
ChatParseReq chatParseReq = DataUtils.getChatParseReq(chatId, queryText);
|
|
||||||
|
ChatParseReq chatParseReq = DataUtils.getChatParseReq(chatId, queryText, enableLLM);
|
||||||
chatParseReq.setAgentId(agentId);
|
chatParseReq.setAgentId(agentId);
|
||||||
return chatQueryService.parse(chatParseReq);
|
return chatQueryService.parse(chatParseReq);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,13 @@ import com.tencent.supersonic.common.pojo.enums.ChatModelType;
|
|||||||
import com.tencent.supersonic.util.DataUtils;
|
import com.tencent.supersonic.util.DataUtils;
|
||||||
import com.tencent.supersonic.util.LLMConfigUtils;
|
import com.tencent.supersonic.util.LLMConfigUtils;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
import org.springframework.test.context.TestPropertySource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
|
@TestPropertySource(properties = {"s2.demo.enableLLM = true"})
|
||||||
@Disabled
|
@Disabled
|
||||||
public class Text2SQLEval extends BaseTest {
|
public class Text2SQLEval extends BaseTest {
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ public class DataUtils {
|
|||||||
return User.get(3L, "tom");
|
return User.get(3L, "tom");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatParseReq getChatParseReq(Integer id, String query) {
|
public static ChatParseReq getChatParseReq(Integer id, String query, boolean enableLLM) {
|
||||||
ChatParseReq chatParseReq = new ChatParseReq();
|
ChatParseReq chatParseReq = new ChatParseReq();
|
||||||
chatParseReq.setQueryText(query);
|
chatParseReq.setQueryText(query);
|
||||||
chatParseReq.setChatId(id);
|
chatParseReq.setChatId(id);
|
||||||
chatParseReq.setUser(user_test);
|
chatParseReq.setUser(user_test);
|
||||||
chatParseReq.setDisableLLM(true);
|
chatParseReq.setDisableLLM(!enableLLM);
|
||||||
return chatParseReq;
|
return chatParseReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user