[fix][launcher]Fix Text2SQLEval.

This commit is contained in:
jerryjzhang
2024-10-10 16:53:41 +08:00
parent 267cb6506d
commit c47b8b37b9
4 changed files with 10 additions and 8 deletions

View File

@@ -91,9 +91,6 @@ public abstract class S2BaseDemo implements CommandLineRunner {
@Value("${s2.demo.names:S2VisitsDemo}")
protected List<String> demoList;
@Value("${s2.demo.enableLLM:true}")
protected boolean demoEnableLlm;
public void run(String... args) {
demoDatabase = addDatabaseIfNotExist();
demoChatModel = addChatModelIfNotExist();

View File

@@ -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.util.DataUtils;
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.util.Set;
@@ -22,7 +22,6 @@ import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals;
@TestPropertySource(properties = {"s2.demo.enableLLM = false"})
public class BaseTest extends BaseApplication {
protected final int unit = 7;
@@ -37,6 +36,9 @@ public class BaseTest extends BaseApplication {
@Autowired
protected ChatModelService chatModelService;
@Value("${s2.demo.enableLLM:false}")
protected boolean enableLLM;
protected QueryResult submitMultiTurnChat(String queryText, Integer agentId, Integer chatId)
throws Exception {
ParseResp parseResp = submitParse(queryText, agentId, chatId);
@@ -65,7 +67,8 @@ public class BaseTest extends BaseApplication {
}
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);
return chatQueryService.parse(chatParseReq);
}

View File

@@ -12,11 +12,13 @@ import com.tencent.supersonic.common.pojo.enums.ChatModelType;
import com.tencent.supersonic.util.DataUtils;
import com.tencent.supersonic.util.LLMConfigUtils;
import org.junit.jupiter.api.*;
import org.springframework.test.context.TestPropertySource;
import java.util.List;
import java.util.Map;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestPropertySource(properties = {"s2.demo.enableLLM = true"})
@Disabled
public class Text2SQLEval extends BaseTest {

View File

@@ -37,12 +37,12 @@ public class DataUtils {
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.setQueryText(query);
chatParseReq.setChatId(id);
chatParseReq.setUser(user_test);
chatParseReq.setDisableLLM(true);
chatParseReq.setDisableLLM(!enableLLM);
return chatParseReq;
}