(improvement)(chat) Modify the order of demo loaders (#542)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-12-18 23:15:23 +08:00
committed by GitHub
parent 3e18655c69
commit 7cb7697353
3 changed files with 16 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ import java.util.concurrent.CompletableFuture;
@Slf4j
@Component
@Order(5)
@Order(2)
public class ApplicationStartedListener implements CommandLineRunner {
@Autowired

View File

@@ -34,6 +34,8 @@ import com.tencent.supersonic.common.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
@@ -43,7 +45,8 @@ import java.util.List;
@Component
@Slf4j
public class ChatDemoLoader {
@Order(3)
public class ChatDemoLoader implements CommandLineRunner {
private User user = User.getFakeUser();
@Qualifier("chatQueryService")
@@ -60,6 +63,13 @@ public class ChatDemoLoader {
@Autowired
private SysParameterService sysParameterService;
@Override
public void run(String... args) throws Exception {
if (checkEnable()) {
doRun();
}
}
public void doRun() {
try {
addSysParameter();
@@ -490,4 +500,8 @@ public class ChatDemoLoader {
agentService.createAgent(agent, User.getFakeUser());
}
private boolean checkEnable() {
return chatService.getLastQuery(1L) == null;
}
}

View File

@@ -37,7 +37,6 @@ public class DemoLoader implements CommandLineRunner {
}
modelDataDemoLoader.doRun();
benchMarkDemoLoader.doRun();
chatDemoLoader.doRun();
}
private boolean checkLoadDemo() {