소스 검색

修复think问题

李富豪 7 달 전
부모
커밋
7a9fb2efc0
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      app/client/platforms/bigModel.ts

+ 10 - 1
app/client/platforms/bigModel.ts

@@ -152,7 +152,16 @@ export class BigModelApi implements LLMApi {
           }
           // 获取当前的数据
           const currentData = info.data;
-          remainText += currentData;
+          const formatStart = '```think';
+          const formatEnd = 'think```';
+
+          if (currentData?.startsWith(formatStart)) {
+            remainText += currentData.replace(formatStart, '```think\n');
+          } else if (currentData?.startsWith(formatEnd)) {
+            remainText += currentData.replace(formatEnd, '```');
+          } else {
+            remainText += currentData;
+          }
         },
         async onclose() {
           finish();