首页>代码>Spring AI + Ollama + Deepseek简单交互>/src/main/java/cn/temptation/config/CommonConfiguration.java
package cn.temptation.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CommonConfiguration {
    @Bean
    public ChatClient chatClient(OllamaChatModel model) {
        return ChatClient
                .builder(model)
                .defaultSystem("你是一个热心可爱的小朋友,你的名字是小代码,请以热情可爱的语气回答问题")   // 预设角色
                .defaultAdvisors(new SimpleLoggerAdvisor())     // 设定日志环绕顾问
                .build();
    }
}
最近下载更多
sky丶小十  LV7 9月15日
lee123321  LV22 8月4日
jhkhk313  LV1 6月9日
kirito0721  LV1 6月8日
yigu123  LV6 6月4日
zhaixunfei  LV8 5月30日
vincemokea  LV9 5月11日
魏彪毅  LV1 5月7日
gshnlj  LV15 5月6日
15838634741  LV18 4月7日
最近浏览更多
jimodeai  LV15 10月21日
天天吃面  LV27 10月20日
求学的熊猫  LV11 10月10日
唐僧洗头爱飘柔  LV22 10月9日
fellowfun  LV12 9月28日
superlogin  LV8 9月26日
sky丶小十  LV7 9月15日
wwkddjjj  LV8 9月4日
WBelong  LV8 9月2日
290185866  LV5 8月29日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友