Kaynağa Gözat

接入阿里百炼ai

sorelythrob 1 hafta önce
ebeveyn
işleme
23f5e522ae

+ 2 - 2
webchat-aigc/src/main/java/com/webchat/aigc/llm/AliBaiLianAIService.java

@@ -34,7 +34,7 @@ public class AliBaiLianAIService extends AbstractLLMChatService {
     public ChatCompletionResponse chat(List<ChatCompletionMessage> messageList) throws Exception {
         AliBaiLianAIClient client = new AliBaiLianAIClient(aliBaiLianLLMPropertiesConfig.getApiKey());
         final List<ChatCompletionMessage> messages = messageList;
-        return client.ChatCompletion(new ChatCompletionRequest(
+        return client.chatCompletion(new ChatCompletionRequest(
                 aliBaiLianLLMPropertiesConfig.getModel(),
                 messages,
                 2000,
@@ -58,7 +58,7 @@ public class AliBaiLianAIService extends AbstractLLMChatService {
         AliBaiLianAIClient client = new AliBaiLianAIClient(aliBaiLianLLMPropertiesConfig.getApiKey());
         final List<ChatCompletionMessage> messages = messageList;
         try {
-            client.ChatCompletionStream(new ChatCompletionRequest(
+            client.chatCompletionStream(new ChatCompletionRequest(
                     aliBaiLianLLMPropertiesConfig.getModel(),
                     messages,
                     2000,

+ 2 - 2
webchat-common/src/main/java/com/webchat/common/util/llm/AliBaiLianAIClient.java

@@ -76,7 +76,7 @@ public class AliBaiLianAIClient {
     }
 
 
-    public ChatCompletionResponse ChatCompletion(ChatCompletionRequest request) throws IOException {
+    public ChatCompletionResponse chatCompletion(ChatCompletionRequest request) throws IOException {
         request.stream = false;
         OkHttpClient client = new OkHttpClient.Builder()
                 .connectTimeout(2, TimeUnit.MINUTES)
@@ -104,7 +104,7 @@ public class AliBaiLianAIClient {
     }
 
     // return a stream of ChatCompletionStreamResponse
-    public Flowable<ChatCompletionStreamResponse> ChatCompletionStream(ChatCompletionRequest request) throws IOException {
+    public Flowable<ChatCompletionStreamResponse> chatCompletionStream(ChatCompletionRequest request) throws IOException {
         request.stream = true;
         OkHttpClient client = new OkHttpClient();
         okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json");