功能说明:支持gpt-3.5-turbo 支持流式问答支持代理语音转文字语音翻译 ## 快速使用 ### 一、引入依赖 ```xml``` ### 二、application.yml 配置 ```yaml openai: api-key: "YOUR OWNER KEY" proxy: enable: true type: http hostname: 127.0.0.1 port: 1087 connect-timeout: 10000 read-timeout: 30000 ``` ### 三、示例代码 ```java @SpringBootApplication public class SampleApplication implements ApplicationRunner { @Autowired private ChatService chatService; public static void main(String[] args) { SpringApplication.run(SampleApplication.class, args); } @Override public void run(ApplicationArguments args) throws Exception { Completions completions = new Completions(); List cn.m9d2.chatgpt chatgpt0.0.2 messages = new ArrayList<>(); Message message = new Message(); message.setContent("你好"); message.setRole("user"); messages.add(message); completions.setMessages(messages); CompletionsResponse response = chatService.completions(completions); for (CompletionsResponse.Choice choice : response.getChoices()) { System.out.print(choice.getMessage().getContent()); } } } ``` Github地址:https://github.com/m9d2/chatgpt