anderx преди 1 година
родител
ревизия
76a3512118

+ 2 - 2
src/main/java/com/goafanti/ChatAI/service/impl/ChatAiServiceImpl.java

@@ -37,8 +37,8 @@ public class ChatAiServiceImpl implements ChatAiService {
         SseMap.sseEmitterMap.put(in.getUserId(), new SseResult(in.getUserId(), System.currentTimeMillis(), sseEmitter));
         try {
 //            先将数据返回,异步调用返回数据
-//            baiduChatUtils.sendBaiduAiStream(in);
-            baiduChatUtils.sendERNIEBOT4Stream(in);
+//            baiduChatUtils.sendERNIEBOT4Stream(in);
+            baiduChatUtils.sendErnieSpeed128K(in);
         } catch (IOException e) {
             e.printStackTrace();
             throw new BusinessException("文言一心调用失败"+e.getLocalizedMessage());

+ 6 - 0
src/main/java/com/goafanti/common/utils/BaiduChatUtils.java

@@ -39,6 +39,7 @@ public class BaiduChatUtils {
     private static final String BAIDU_CHAT_ERNIE_LITE_URL="https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant?access_token=";
     /*ERNIE_BOT_4*/
     private static final String ERNIE_BOT_4="https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=";
+    private static final String ERNIE_SPEED_128K="https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-speed-128k?access_token=";
     /*accessToken获取地址*/
     private static final String BAIDU_ACCESSTOKEN_URL="https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&";
 
@@ -58,6 +59,11 @@ public class BaiduChatUtils {
         LoggerUtils.debug(getClass(),"ERNIE_BOT_4");
         sendStream(inputSendChat,ERNIE_BOT_4);
     }
+    @Async
+    public void sendErnieSpeed128K(InputSendChat inputSendChat) throws IOException {
+        LoggerUtils.debug(getClass(),"ERNIE_SPEED_128K");
+        sendStream(inputSendChat,ERNIE_SPEED_128K);
+    }
 
     @Async
     public void sendStream(InputSendChat inputSendChat,String httpUrl) throws IOException {