mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
(improvement)(chat) Modify the order of demo loaders (#542)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@Order(5)
|
||||
@Order(2)
|
||||
public class ApplicationStartedListener implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public class DemoLoader implements CommandLineRunner {
|
||||
}
|
||||
modelDataDemoLoader.doRun();
|
||||
benchMarkDemoLoader.doRun();
|
||||
chatDemoLoader.doRun();
|
||||
}
|
||||
|
||||
private boolean checkLoadDemo() {
|
||||
|
||||
Reference in New Issue
Block a user