chengjie vor 1 Woche
Ursprung
Commit
a41e656d18
1 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen
  1. 15 2
      src/api/miaoguo/literacyController.js

+ 15 - 2
src/api/miaoguo/literacyController.js

@@ -492,14 +492,27 @@ async function getAiDataEng(word){
492 492
     content=JSON.stringify(content);
493 493
     //console.log(content);
494 494
 
495
-    let aiProvider="llama-4-maverick-17b-128e-instruct";
496
-    aiProvider="ali-qwen-plus-2025-07-14";
495
+    let aiProvider="";
496
+    //aiProvider="llama-4-maverick-17b-128e-instruct";
497
+    //aiProvider="ali-qwen-plus-2025-07-14";
498
+    aiProvider="doubao-deepseek-v3-2-251201";
497 499
     
500
+
498 501
     //生成结果
499 502
     result = await aiController.generateArticle(content, aiProvider);
500 503
     
504
+    // 处理可能的Markdown代码块标记
505
+    if (result.startsWith('```json') || result.startsWith('```')) {
506
+        // 移除开头的```json或```
507
+        result = result.replace(/^```(?:json)?\s*\n/, '');
508
+        // 移除结尾的```
509
+        result = result.replace(/\n```\s*$/, '');
510
+    }
511
+
501 512
     result=JSON.parse(result);
502 513
 
514
+    
515
+
503 516
     if (result.ENG && result.ENG.Soundmark){
504 517
         result.ENG.Soundmark.EngSound="https://sp0.baidu.com/-rM1hT4a2gU2pMbgoY3K/gettts?lan=uk&text="+result.ENG.Word+"&spd=3&source=alading";
505 518
         result.ENG.Soundmark.AmESound="https://sp0.baidu.com/-rM1hT4a2gU2pMbgoY3K/gettts?lan=en&text="+result.ENG.Word+"&spd=3&source=alading";