mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 04:57:28 +00:00
[improvement][chat]Introduce AppModule to classify chat apps.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.tencent.supersonic.common.pojo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.tencent.supersonic.common.pojo.enums.AppModule;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,4 +19,6 @@ public class ChatApp {
|
||||
private Integer chatModelId;
|
||||
@JsonIgnore
|
||||
private ChatModelConfig chatModelConfig;
|
||||
@JsonIgnore
|
||||
private AppModule appModule;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.tencent.supersonic.common.pojo.enums;
|
||||
|
||||
public enum AppModule {
|
||||
CHAT, HEADLESS
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package com.tencent.supersonic.common.util;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.tencent.supersonic.common.pojo.ChatApp;
|
||||
import com.tencent.supersonic.common.pojo.enums.AppModule;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ChatAppManager {
|
||||
private static final Map<String, ChatApp> chatApps = Maps.newConcurrentMap();
|
||||
@@ -12,7 +14,8 @@ public class ChatAppManager {
|
||||
chatApps.put(key, app);
|
||||
}
|
||||
|
||||
public static Map<String, ChatApp> getAllApps() {
|
||||
return chatApps;
|
||||
public static Map<String, ChatApp> getAllApps(AppModule appType) {
|
||||
return chatApps.entrySet().stream().filter(e -> e.getValue().getAppModule().equals(appType))
|
||||
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user