package com.lanyuanxiaoyao.service.ai.chat;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.ai.openai.api.OpenAiApi;
import reactor.core.Disposable;

/**
 * @author lanyuanxiaoyao
 * @version 20250514
 */
public class TestChat {
  public static void main(String[] args) {
    ChatClient client = ChatClient.builder(
            OpenAiChatModel.builder()
                .openAiApi(
                    OpenAiApi.builder()
                        .baseUrl("http://132.121.206.65:10086")
                        .apiKey("*XMySqV%>hR&v>>g*NwCs3tpQ5FVMFEF2VHVTj<MYQd$&@$sY7CgqNyea4giJi4")
                        .build()
                )
                .defaultOptions(
                    OpenAiChatOptions.builder()
                        .model("Qwen3-1.7")
                        .build()
                )
                .build()
        )
        .build();
    String content = client.prompt()
        .user("你好")
        .call()
        .content();
    System.out.println(content);
  }
}
