mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
【优化】优化 chat 初始化
This commit is contained in:
parent
4db96fa361
commit
4a6b4e5f65
@ -12,15 +12,10 @@ import cn.iocoder.yudao.framework.ai.chatyiyan.YiYanChatClient;
|
|||||||
import cn.iocoder.yudao.framework.ai.chatyiyan.YiYanOptions;
|
import cn.iocoder.yudao.framework.ai.chatyiyan.YiYanOptions;
|
||||||
import cn.iocoder.yudao.framework.ai.chatyiyan.api.YiYanApi;
|
import cn.iocoder.yudao.framework.ai.chatyiyan.api.YiYanApi;
|
||||||
import cn.iocoder.yudao.framework.ai.exception.AiException;
|
import cn.iocoder.yudao.framework.ai.exception.AiException;
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.context.ApplicationContextAware;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -65,29 +60,6 @@ public class YudaoAiAutoConfiguration {
|
|||||||
return chatMap;
|
return chatMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class InitChatClient implements InitializingBean, ApplicationContextAware {
|
|
||||||
|
|
||||||
private GenericApplicationContext applicationContext;
|
|
||||||
private YudaoAiProperties yudaoAiProperties;
|
|
||||||
|
|
||||||
public InitChatClient(YudaoAiProperties yudaoAiProperties) {
|
|
||||||
this.yudaoAiProperties = yudaoAiProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterPropertiesSet() {
|
|
||||||
|
|
||||||
|
|
||||||
System.err.println(applicationContext.getBean("qianWen"));
|
|
||||||
System.err.println(applicationContext.getBean("yiYan"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
|
||||||
this.applicationContext = (GenericApplicationContext) applicationContext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Object createChatClient(YudaoAiProperties.ChatProperties chatProperties) {
|
private static Object createChatClient(YudaoAiProperties.ChatProperties chatProperties) {
|
||||||
if (AiPlatformEnum.XING_HUO == chatProperties.getAiPlatform()) {
|
if (AiPlatformEnum.XING_HUO == chatProperties.getAiPlatform()) {
|
||||||
YudaoAiProperties.XingHuoProperties xingHuoProperties = (YudaoAiProperties.XingHuoProperties) chatProperties;
|
YudaoAiProperties.XingHuoProperties xingHuoProperties = (YudaoAiProperties.XingHuoProperties) chatProperties;
|
||||||
|
Loading…
Reference in New Issue
Block a user