chengjie 4 月之前
父節點
當前提交
9428173253
共有 5 個文件被更改,包括 252 次插入325 次删除
  1. 158 63
      src/api/yjbdc/aiController.js
  2. 1 0
      src/api/yjbdc/routes.js
  3. 53 93
      src/api/yjbdc/yjbdcController.js
  4. 11 1
      src/config/index.js
  5. 29 168
      src/util/constant/index.js

+ 158 - 63
src/api/yjbdc/aiController.js

@@ -1,4 +1,5 @@
1 1
 import axios from 'axios';
2
+import crypto from 'crypto';
2 3
 import config from '../../config/index.js';
3 4
 import { enhanceFormsOfWords } from './enhanceFormsOfWords.js';
4 5
 
@@ -17,6 +18,42 @@ class AIProvider {
17 18
     }
18 19
 }
19 20
 
21
+/**
22
+ * OpenAI平台实现
23
+ */
24
+class OpenAIProvider extends AIProvider {
25
+    constructor() {
26
+        super();
27
+        this.headers = {
28
+            "Authorization": "Bearer " + config.openai.apikey,
29
+            "Content-Type": "application/json"
30
+        };
31
+        this.url = "https://api.openai.com/v1/chat/completions";
32
+        this.model = "gpt-3.5-turbo";
33
+    }
34
+
35
+    async generateArticle(content) {
36
+        const postJSON = {
37
+            "model": this.model,
38
+            "messages": [
39
+                {
40
+                    "role": "user",
41
+                    "content": content,
42
+                }
43
+            ]
44
+        };
45
+
46
+        try {
47
+            const response = await axios.post(this.url, postJSON, { headers: this.headers });
48
+            return response.data.choices[0].message.content;
49
+        } catch (error) {
50
+            console.error("OpenAI API error:", error);
51
+            throw error;
52
+        }
53
+    }
54
+}
55
+
56
+
20 57
 /**
21 58
  * 火山云AI平台实现
22 59
  */
@@ -25,23 +62,14 @@ class VolcesAIProvider extends AIProvider {
25 62
      * 创建火山云AI提供者实例
26 63
      * @param {string} version - 版本号,如'1.5'或'1.6'
27 64
      */
28
-    constructor(version = '1-5') {
65
+    constructor(version = 'doubao-1-5-pro-32k-250115') {
29 66
         super();
30 67
         
31
-        // 根据版本选择对应的API密钥和模型
32
-        const versionConfig = {
33
-            '1-5': {
34
-                apikey: config.huoshancloud.apikeyHLR,
35
-                model: "doubao-1-5-pro-32k-250115"
36
-            },
37
-            '1-6': {
38
-                apikey: config.huoshancloud.apikeyHLR,
39
-                model: "doubao-seed-1-6-250615"
40
-            },
41
-        };
42
-        
43 68
         // 获取当前版本的配置,如果版本不存在则使用1.5版本
44
-        const currentConfig = versionConfig[version] || versionConfig['1-5'];
69
+        const currentConfig = {
70
+                apikey: config.huoshancloud.apikeyHLR,
71
+                model: version
72
+            };
45 73
         
46 74
         this.version = version;
47 75
         this.headers = {
@@ -75,54 +103,96 @@ class VolcesAIProvider extends AIProvider {
75 103
     }
76 104
 }
77 105
 
78
-// 为了保持向后兼容性,创建1.5和1.6版本的类别名
79
-class VolcesAIProvider1_5 extends VolcesAIProvider {
80
-    constructor() {
81
-        super('1-5');
82
-    }
83
-}
84
-
85
-class VolcesAIProvider1_6 extends VolcesAIProvider {
86
-    constructor() {
87
-        super('1-6');
88
-    }
89
-}
90 106
 
91 107
 /**
92
- * OpenAI平台实现
108
+ * 讯飞星火平台实现 (spark X1版本)
93 109
  */
94
-class OpenAIProvider extends AIProvider {
110
+class XunFeiYunAIProvider extends AIProvider {
95 111
     constructor() {
96 112
         super();
113
+        // 使用API Key和Secret拼接成"AK:SK"格式
114
+        this.apiKey = `${config.xfyun.apikey}:${config.xfyun.apisecret}`;
97 115
         this.headers = {
98
-            "Authorization": "Bearer " + config.openai.apikey,
99
-            "Content-Type": "application/json"
116
+            "Content-Type": "application/json",
117
+            "Authorization": `Bearer ${this.apiKey}`
100 118
         };
101
-        this.url = "https://api.openai.com/v1/chat/completions";
102
-        this.model = "gpt-3.5-turbo";
119
+        this.url = "https://spark-api-open.xf-yun.com/v2/chat/completions";
103 120
     }
104 121
 
105 122
     async generateArticle(content) {
106 123
         const postJSON = {
107
-            "model": this.model,
124
+            "model": "x1",
108 125
             "messages": [
109 126
                 {
110 127
                     "role": "user",
111
-                    "content": content,
128
+                    "content": content
112 129
                 }
113
-            ]
130
+            ],
131
+            "temperature": 0.7,
132
+            "max_tokens": 2048,
133
+            "user": "123456" // 固定用户ID
114 134
         };
115 135
 
116 136
         try {
117
-            const response = await axios.post(this.url, postJSON, { headers: this.headers });
118
-            return response.data.choices[0].message.content;
137
+            // 增加重试机制
138
+            let retries = 3;
139
+            let lastError = null;
140
+            
141
+            while (retries > 0) {
142
+                try {
143
+                    console.log(`讯飞云`);
144
+                    const response = await axios.post(this.url, postJSON, {
145
+                        headers: this.headers,
146
+                        timeout: 60000 // 增加到60秒超时
147
+                    });
148
+                    
149
+                    // 处理OpenAI兼容格式的响应
150
+                    if (response.data?.choices?.[0]?.message?.content) {
151
+                        return response.data.choices[0].message.content;
152
+                    }
153
+                    console.error("XunFeiYun X1 API response:", response.data);
154
+                    throw new Error("Invalid response format from XunFeiYun X1 API");
155
+                } catch (error) {
156
+                    lastError = error;
157
+                    retries--;
158
+                    
159
+                    if (retries > 0) {
160
+                        console.warn(`API请求失败,剩余重试次数: ${retries},等待2秒后重试...`);
161
+                        await new Promise(resolve => setTimeout(resolve, 2000));
162
+                        continue;
163
+                    }
164
+                    
165
+                    // 更详细的错误日志
166
+                    if (error.response) {
167
+                        console.error("XFYun API error response:", {
168
+                            status: error.response.status,
169
+                            data: error.response.data,
170
+                            headers: error.response.headers
171
+                        });
172
+                    } else if (error.request) {
173
+                        console.error("XFYun API request error:", {
174
+                            method: error.config.method,
175
+                            url: error.config.url,
176
+                            headers: error.config.headers,
177
+                            data: error.config.data
178
+                        });
179
+                    } else {
180
+                        console.error("XFYun API setup error:", error.message);
181
+                    }
182
+                    
183
+                    throw error;
184
+                }
185
+            }
186
+            
187
+            throw lastError || new Error("API请求失败");
119 188
         } catch (error) {
120
-            console.error("OpenAI API error:", error);
189
+            console.error("XFYun API error:", error);
121 190
             throw error;
122 191
         }
123 192
     }
124 193
 }
125 194
 
195
+
126 196
 /**
127 197
  * 阿里云通义平台实现
128 198
  */
@@ -130,7 +200,7 @@ class AliyunAIProvider extends AIProvider {
130 200
     constructor(model = 'qwen-plus') {
131 201
         super();
132 202
 
133
-        this.accessKey = config.aliyun.accessKey;
203
+        this.accessKey = config.aliyun.apikeyHLR;
134 204
         this.headers = {
135 205
             "Content-Type": "application/json",
136 206
             "Accept": "application/json"
@@ -188,6 +258,42 @@ class AliyunAIProvider extends AIProvider {
188 258
     }
189 259
 }
190 260
 
261
+/**
262
+ * 腾讯混元大模型平台实现
263
+ */
264
+class TencentHunyuanAIProvider extends AIProvider {
265
+    constructor() {
266
+        super();
267
+        this.headers = {
268
+            "Authorization": "Bearer " + config.tencentcloudHunyuan.apikey,
269
+            "Content-Type": "application/json"
270
+        };
271
+        this.url = "https://api.hunyuan.cloud.tencent.com/v1/chat/completions";
272
+        this.model = "hunyuan-turbos-latest";
273
+    }
274
+
275
+    async generateArticle(content) {
276
+        const postJSON = {
277
+            "model": this.model,
278
+            "messages": [
279
+                {
280
+                    "role": "user",
281
+                    "content": content,
282
+                }
283
+            ]
284
+        };
285
+
286
+        try {
287
+             console.log(`腾讯云${this.version}`);
288
+            const response = await axios.post(this.url, postJSON, { headers: this.headers });
289
+            return response.data.choices[0].message.content;
290
+        } catch (error) {
291
+            console.error("OpenAI API error:", error);
292
+            throw error;
293
+        }
294
+    }
295
+}
296
+
191 297
 /**
192 298
  * 百度文心一言平台实现
193 299
  */
@@ -248,41 +354,30 @@ class BaiduAIProvider extends AIProvider {
248 354
 class AIProviderFactory {
249 355
     /**
250 356
      * 获取AI提供者实例
251
-     * @param {string} provider - AI提供者名称,如'volces', 'volces1-5', 'volces1-6', 'openai', 'baidu'
357
+     * @param {string} provider - AI提供者名称
252 358
      * @returns {AIProvider} - 返回对应的AI提供者实例
253 359
      */
254
-    static getProvider(provider = 'volces1-5') {
360
+    static getProvider(provider = 'doubao-1-5-pro-32k-250115') {
255 361
         const providerLower = provider.toLowerCase();
256 362
         
257
-        // 处理火山云通用提供者格式:volces:版本号
258
-        if (providerLower.startsWith('volces:')) {
259
-            const version = providerLower.split(':')[1];
260
-            return new VolcesAIProvider(version);
261
-        }
262
-        
263
-        // 处理阿里云通义通用提供者格式:aliyun:模型名
264
-        if (providerLower.startsWith('aliyun:')) {
265
-            const model = providerLower.split(':')[1];
266
-            return new AliyunAIProvider(model);
267
-        }
268
-        
269 363
         // 处理传统提供者名称
270 364
         switch (providerLower) {
271
-            case 'volces':
272
-            case 'volces1-5':
273
-                return new VolcesAIProvider1_5('1-5');
274
-            case 'volces1-6':
275
-                return new VolcesAIProvider1_6('1-6');
276 365
             case 'openai':
277 366
                 return new OpenAIProvider();
278
-            case 'qwen-plus':
367
+            case 'doubao-1-5-pro-32k-250115':
368
+                return new VolcesAIProvider(providerLower);
369
+            case 'doubao-seed-1-6-250615':
370
+                return new VolcesAIProvider(providerLower);
371
+            case 'ali-qwen-plus':
279 372
                 return new AliyunAIProvider();
373
+            case 'xf-yun-spark-x1':
374
+                return new XunFeiYunAIProvider();
375
+            case 'tencent-hunyuan-turbos':
376
+                return new TencentHunyuanAIProvider();
280 377
             case 'baidu':
281 378
                 return new BaiduAIProvider();
282
-            case 'aliyun':
283
-                return new AliyunAIProvider(); // 默认使用qwen-turbo模型
284 379
             default:
285
-                return new VolcesAIProvider('1-5'); // 默认使用火山云1.5
380
+                return new VolcesAIProvider(providerLower); // 默认使用火山云1.5
286 381
         }
287 382
     }
288 383
 }
@@ -293,7 +388,7 @@ class AIProviderFactory {
293 388
  * @param {string} provider - AI提供者名称,默认为'volces'
294 389
  * @returns {Promise<string>} - 返回生成的文章JSON字符串
295 390
  */
296
-async function generateArticle(content, provider = 'volces1-5') {
391
+async function generateArticle(content, provider) {
297 392
     try {
298 393
         const aiProvider = AIProviderFactory.getProvider(provider);
299 394
         const result = await aiProvider.generateArticle(content);

+ 1 - 0
src/api/yjbdc/routes.js

@@ -6,6 +6,7 @@ const router = new Router();
6 6
 router.post('/api/YJBDCLogin',yjbdcController.YJBDCLogin);
7 7
 router.post('/api/OCRImageData',yjbdcController.OCRImageData);
8 8
 router.post('/api/GenerateArticle',yjbdcController.GenerateArticle);
9
+router.get('/api/GetYJBDCGenerateConfig',yjbdcController.GetYJBDCGenerateConfig);
9 10
 router.post('/api/GeneratePDF',yjbdcController.GeneratePDF);
10 11
 router.get('/api/GetYJBDCArticleList',yjbdcController.GetYJBDCArticleList);
11 12
 router.get('/api/BuildYJBDCQRCode',yjbdcController.BuildYJBDCQRCode);

+ 53 - 93
src/api/yjbdc/yjbdcController.js

@@ -8,6 +8,7 @@ import { Encrypt, Decrypt } from '../../util/crypto/index.js';
8 8
 import { stringUtils } from '../../util/stringClass.js';
9 9
 import WXBizDataCrypt from '../../util/WXBizDataCrypt.js';
10 10
 import { globalCache } from '../../util/GlobalCache.js';
11
+import constantClass from '../../util/constant/index.js';
11 12
 import yjbdc from '../../model/yjbdc.js';
12 13
 import aiController from './aiController.js';
13 14
 
@@ -185,42 +186,8 @@ export async function GenerateArticle(ctx) {
185 186
         let articleStyle = params.ArticleStyle;
186 187
 
187 188
         if (words){
188
-            //文章类型
189
-            const ARTICLE_STYLE={
190
-                "成长":"指一个人从小慢慢长大,不仅身体变高变壮,还学会更多知识,懂得更多道理,变得越来越懂事、能干。",
191
-                "童话":"充满神奇和想象的故事,里面可能有会说话的动物、美丽的公主、勇敢的王子,还有魔法和冒险,比如《白雪公主》、《小红帽》。",
192
-                "家庭亲子":"指爸爸妈妈和孩子之间的相处,比如一起玩游戏、读书、聊天,让家庭充满爱和温暖。",
193
-                "人生励志":"讲述一个人如何克服困难、努力奋斗,最终取得成功的故事,鼓励我们不要轻易放弃,比如《爱迪生发明电灯》。",
194
-                "科幻":"科学幻想故事,里面有未来科技、外星人、太空旅行等,比如《海底两万里》、《流浪地球》、《时间的折皱》。",
195
-                "奇幻":"充满魔法、神奇生物和不可思议事件的故事,比如《哈利·波特》。",
196
-                "校园生活":"发生在学校里的故事,比如上课、考试、运动会、和同学一起玩耍,与友情、团结、如何学习、克服困难有关的事情,也可能有搞笑或感人的事情。",
197
-                "节日文化":"不同节日的习俗和传统,比如春节贴春联、中秋节吃月饼、端午划龙舟、清明节扫墓、重阳节登高望远、元宵节猜灯谜,让我们了解不同文化。",
198
-                "旅行":"去不同的地方游玩,看看美丽的风景,体验不一样的生活,比如爬山、逛动物园、参观博物馆。",
199
-                "科普":"科学普及知识,用有趣的方式讲解自然、宇宙、动物、植物等科学现象,比如《十万个为什么》。",
200
-                "动物":"生活在地球上的各种生物,有的会跑,有的会飞,有的会游泳,比如猫、狗、大象、企鹅,它们都有自己的特点和习性。",
201
-                "大自然":"指环境保护、保护大自然,让地球更干净、更健康。比如节约用水、减少垃圾、种树、不乱扔塑料袋,这样空气会更清新,动物也有更好的家园。每个人都可以从小事做起爱护地球。",
202
-            };
203
-
204
-            //等级难度
205
-            const LEVEL=[
206
-                {
207
-                    Key:"小学",
208
-                    Content:"难度上是中国的小学六年级毕业的孩子可以阅读,生成的文章中除了用户提供的单词,其他全部使用人教版小学英语词汇表的单词,以及Sight words中220个单词,不要超出范围。"
209
-                },
210
-                {
211
-                    Key:"初中",
212
-                    Content:"难度上是中国的初三毕业的孩子可以阅读,生成的文章中除了用户提供的单词,其他全部使用人教版初中英语词汇表的单词,以及Sight words中220个单词,不要超出范围。"
213
-                },
214
-                {
215
-                    Key:"高中",
216
-                    Content:"难度上是中国的高三毕业的孩子可以阅读,生成的文章使用人教版高中英语词汇表的单词."
217
-                },
218
-                {
219
-                    Key:"大学",
220
-                    Content:"难度上是中国的大学毕业生的孩子可以阅读,生成的文章使用大学生六级词汇表的单词."
221
-                },
222
-            ]
223
-
189
+            
190
+            const menuConfig=constantClass.GetYJBDCGenerateConfig();
224 191
             let content = "将"+words+"这些单词生成一篇英文文章。要求"+
225 192
             "[难度];"+
226 193
             "文章类型是'"+articleStyle+"([类型])';"+
@@ -245,7 +212,7 @@ export async function GenerateArticle(ctx) {
245 212
             if (!params.Level || params.Level=="" || params.Level==undefined || params.Level>="4"){
246 213
                 params.Level="0";
247 214
             }
248
-            content = content.replace("[难度]",LEVEL[Number(params.Level)].Content);
215
+            content = content.replace("[难度]",menuConfig.Level[Number(params.Level)].Content);
249 216
             
250 217
             if (articleStyle=="随机" || articleStyle=="任意") {
251 218
                 // 获取ARTICLE_STYLE对象的所有键(文章类型)
@@ -254,21 +221,23 @@ export async function GenerateArticle(ctx) {
254 221
                 const randomIndex = stringUtils.Random(0, articleTypes.length-1);
255 222
                 articleStyle = articleTypes[randomIndex];
256 223
             }
257
-            content = content.replace("[类型]",ARTICLE_STYLE[articleStyle]);
258
-            
224
+            for(let i=0;i<menuConfig.ArticleStyle.length;i++){
225
+                if (menuConfig.ArticleStyle[i].Name==articleStyle){
226
+                    content = content.replace("[类型]",menuConfig.ArticleStyle[i].Content);
227
+                    break;
228
+                }
229
+            }
259 230
 
260 231
             //console.log("content:"+content);
261 232
             
262 233
             // 从请求参数中获取AI提供者,如果没有指定则使用默认值
263
-            let aiProvider = 'volces1-5';
264
-            if (params.AIVersion=="1.0"){
265
-                aiProvider="volces1-5";
266
-            }
267
-            else if (params.AIVersion=="1.5"){
268
-                aiProvider="volces1-6";
269
-            }
270
-            else if (params.AIVersion=="1.8"){
271
-                aiProvider="qwen-plus";
234
+            let aiProvider = 'doubao-1-5-pro-32k-250115';
235
+
236
+            for(let i=0;i<menuConfig.AIVersion.length;i++){
237
+                if (menuConfig.AIVersion[i].Version==params.AIVersion){
238
+                    aiProvider=menuConfig.AIVersion[i].Model;
239
+                    break;
240
+                }
272 241
             }
273 242
             
274 243
             try {
@@ -345,6 +314,27 @@ export async function GenerateArticle(ctx) {
345 314
     ctx.body = result;
346 315
 }
347 316
 
317
+export async function GetYJBDCGenerateConfig(ctx) {
318
+    const param = {
319
+        UserID: ctx.query.UserID || 0,
320
+    };
321
+
322
+    let result=constantClass.GetYJBDCGenerateConfig();
323
+
324
+    for (let i=0;i<result.Level.length;i++){
325
+        delete result.Level[i].English;
326
+    }
327
+
328
+    for(let i=0;i<result.ArticleStyle.length;i++){
329
+        delete result.ArticleStyle[i].English;
330
+        delete result.ArticleStyle[i].Content;
331
+    }
332
+    if (param.UserID>3){
333
+        result.AIVersion.splice(2,result.AIVersion.length-2);
334
+    }
335
+    ctx.body = {"errcode": 10000, result:result};
336
+}
337
+
348 338
 //获得文章列表或具体文章
349 339
 export async function GetYJBDCArticleList(ctx) {
350 340
     const param = {
@@ -363,24 +353,12 @@ export async function GetYJBDCArticleList(ctx) {
363 353
 
364 354
         result = await yjbdc.GetYJBDCArticleList(param);
365 355
         if (param.ID==0){
356
+            let menuConfig=constantClass.GetYJBDCGenerateConfig();
366 357
             for(let i=0;i<result.length;i++){
367 358
                 let item=result[i];
368 359
                 item.CreateTime=moment(item.CreateTime).format("YYYY年MM月DD日 HH:mm");
369 360
                 //debugger;
370
-                switch (Number(item.Level)){
371
-                    case 0:
372
-                        item.LevelStr="小学";
373
-                        break;
374
-                    case 1:
375
-                        item.LevelStr="初中";
376
-                        break;
377
-                    case 2:
378
-                        item.LevelStr="高中";
379
-                        break;
380
-                    case 3:
381
-                        item.LevelStr="大学";
382
-                        break;
383
-                }
361
+                item.LevelStr=menuConfig.Level[item.Level].Name;
384 362
             }
385 363
         }
386 364
         
@@ -468,30 +446,7 @@ export async function GeneratePDF(ctx) {
468 446
 
469 447
     const content = params.Content;
470 448
 
471
-    // 文章类型映射
472
-    const ARTICLE_STYLE = {
473
-        "成长": "Personal Growth",
474
-        "童话": "Fairy Tales",
475
-        "家庭亲子": "Family Stories",
476
-        "人生励志": "Inspirational",
477
-        "科幻": "Science Fiction",
478
-        "奇幻": "Fantasy",
479
-        "校园生活": "School Life",
480
-        "节日文化": "Cultural Stories",
481
-        "旅行": "Travel Stories",
482
-        "科普": "Popular Science",
483
-        "动物": "Animal Stories",
484
-        "环保": "Environmental Stories",
485
-    };
486
-
487
-    // 等级难度
488
-    const LEVEL = [
489
-        "Primary school vocabulary size",
490
-        "Junior high school vocabulary size",
491
-        "High school vocabulary size",
492
-        "College vocabulary size"
493
-    ];
494
-    
449
+    const menuConfig=constantClass.GetYJBDCGenerateConfig();
495 450
     try {
496 451
         // 创建新的 PDF 文档 - 使用A4尺寸
497 452
         const doc = new PDFDocument({
@@ -547,21 +502,26 @@ export async function GeneratePDF(ctx) {
547 502
             questions = content.Question;
548 503
         }
549 504
 
550
-        // doc.image('./public/images/PDF.png', 0, 0, {
551
-        //         width: pixelToPt(2100),
552
-        //         height: pixelToPt(2970)
553
-        // });
505
+
506
+        let articleStyleArr=menuConfig.ArticleStyle;
507
+        let articleStyle="Story";
508
+        for(let i=0;i<articleStyleArr.length;i++){
509
+            if (articleStyleArr[i].Name==content.ArticleStyle){
510
+                articleStyle=articleStyleArr[i].English;
511
+                break;
512
+            }
513
+        }
554 514
 
555 515
         // 1. 标题 - 文章类型
556
-        doc.font(selectFont(ARTICLE_STYLE[content.ArticleStyle] || "Story"))
516
+        doc.font(selectFont(articleStyle))
557 517
            .fontSize(pixelToPt(48))
558
-           .text(ARTICLE_STYLE[content.ArticleStyle] || "Story", 
518
+           .text(articleStyle, 
559 519
                  pixelToPt(120), pixelToPt(110));
560 520
 
561 521
         // 2. 副标题 - 难度级别
562 522
         doc.font('Helvetica')
563 523
            .fontSize(pixelToPt(30))
564
-           .text(LEVEL[content.Level] || "", 
524
+           .text(menuConfig.Level[Number(content.Level)].English || "", 
565 525
                  pixelToPt(120), pixelToPt(170));
566 526
 
567 527
         // 3. 时间

+ 11 - 1
src/config/index.js

@@ -72,12 +72,22 @@ const commonConfig = {
72 72
         secretId: "AKIDfBYjhRyLWTCl9KH3oNiplUyFPRK3dCd1",
73 73
         secretKey: "JTUK0WsBKJ8nIdopfM0TnxwkOsBJ75vp",
74 74
     },
75
+    tencentcloudHunyuan:{
76
+        apikey:"sk-OCrTvmGFTxAeRFr7ceco18NOarjWNvledM4yf9gROpBQvxqZ",
77
+    },
75 78
     huoshancloud:{
76 79
         apikeyCJ:"d276e65d-4c39-49ad-a2e2-5060c30ca9a0",
77 80
         apikeyHLR:"2b7d737e-6773-4d55-ae77-da8d4e819c96",
78 81
     },
79 82
     aliyun:{
80
-        accessKey: "sk-12e38cdfe5b1477880e5c99efbd10b48", // 需要替换为实际的阿里云AccessKey
83
+        apikeyCJ: "sk-12e38cdfe5b1477880e5c99efbd10b48",
84
+        apikeyHLR:"sk-b3ea1a818aad4386b7f50133411fb6e8",
85
+    },
86
+    xfyun:{
87
+        appid: "620d2552", // 讯飞星火APPID
88
+        apikey: "a3be608fe7fb367adae0169324faf3aa", // 讯飞星火APIKey
89
+        apisecret: "OTEyZTM2OWMxNjBhODdhMzQ3YmQ5Nzkw", // 讯飞星火APISecret
90
+        version: "v1" // API版本
81 91
     },
82 92
     BufferMemoryTimeSuperLower:1,//缓存时间1秒
83 93
     BufferMemoryTimeLower:5,//缓存时间5秒

+ 29 - 168
src/util/constant/index.js

@@ -2,6 +2,35 @@
2 2
 import { stringUtils } from '../../util/stringClass.js';
3 3
 
4 4
 export default {
5
+    GetYJBDCGenerateConfig:()=>{
6
+        let result = {};
7
+        result.Level=[
8
+            {Name:"小学",CSS:"Selected",English:"Primary school vocabulary size",Content:"难度上是中国的小学六年级毕业的孩子可以阅读,生成的文章中除了用户提供的单词,其他全部使用人教版小学英语词汇表的单词,以及Sight words中220个单词,不要超出范围。"},
9
+            {Name:"初中",CSS:"",English:"Junior high school vocabulary size",Content:"难度上是中国的初三毕业的孩子可以阅读,生成的文章中除了用户提供的单词,其他全部使用人教版初中英语词汇表的单词,以及Sight words中220个单词,不要超出范围。"},
10
+            {Name:"高中",CSS:"",English:"High school vocabulary size",Content:"难度上是中国的高三毕业的孩子可以阅读,生成的文章使用人教版高中英语词汇表的单词."},
11
+            {Name:"大学",CSS:"",English:"College vocabulary size",Content:"难度上是中国的大学毕业生的孩子可以阅读,生成的文章使用大学生六级词汇表的单词."}];            
12
+        result.ArticleStyle=[
13
+            {Name:"童话",CSS:"Selected",English:"Fairy Tales",Content:"充满神奇和想象的故事,里面可能有会说话的动物、美丽的公主、勇敢的王子,还有魔法和冒险,比如《白雪公主》、《小红帽》。"},
14
+            {Name:"奇幻",CSS:"",English:"Fantasy",Content:"充满魔法、神奇生物和不可思议事件的故事,比如《哈利·波特》。"},
15
+            {Name:"动物",CSS:"",English:"Animal Stories",Content:"生活在地球上的各种生物,有的会跑,有的会飞,有的会游泳,比如猫、狗、大象、企鹅,它们都有自己的特点和习性。"},
16
+            {Name:"校园生活",CSS:"",English:"School Life",Content:"发生在学校里的故事,比如上课、考试、运动会、和同学一起玩耍,与友情、团结、如何学习、克服困难有关的事情,也可能有搞笑或感人的事情。"},
17
+            {Name:"家庭亲子",CSS:"",English:"Family Stories",Content:"指爸爸妈妈和孩子之间的相处,比如一起玩游戏、读书、聊天,让家庭充满爱和温暖。"},
18
+            {Name:"成长",CSS:"",English:"Personal Growth",Content:"指一个人从小慢慢长大,不仅身体变高变壮,还学会更多知识,懂得更多道理,变得越来越懂事、能干。"},
19
+            {Name:"科幻",CSS:"",English:"Science Fiction",Content:"科学幻想故事,里面有未来科技、外星人、太空旅行等,比如《海底两万里》、《流浪地球》、《时间的折皱》。"},
20
+            {Name:"旅行",CSS:"",English:"Travel Stories",Content:"去不同的地方游玩,看看美丽的风景,体验不一样的生活,比如爬山、逛动物园、参观博物馆。"},
21
+            {Name:"大自然",CSS:"",English:"Environmental Stories",Content:"指环境保护、保护大自然,让地球更干净、更健康。比如节约用水、减少垃圾、种树、不乱扔塑料袋,这样空气会更清新,动物也有更好的家园。每个人都可以从小事做起爱护地球。"},
22
+            {Name:"科普",CSS:"",English:"Popular Science",Content:"科学普及知识,用有趣的方式讲解自然、宇宙、动物、植物等科学现象,比如《十万个为什么》。"},
23
+            {Name:"节日文化",CSS:"",English:"Cultural Stories",Content:"不同节日的习俗和传统,比如春节贴春联、中秋节吃月饼、端午划龙舟、清明节扫墓、重阳节登高望远、元宵节猜灯谜,让我们了解不同文化。"},
24
+            {Name:"人生励志",CSS:"",English:"Inspirational",Content:"讲述一个人如何克服困难、努力奋斗,最终取得成功的故事,鼓励我们不要轻易放弃,比如《爱迪生发明电灯》。"}];        
25
+        result.AIVersion=[
26
+            {Version:"1.0",Model:"doubao-1-5-pro-32k-250115",Content:"词句丰富,结构简明\n平均30秒生成",CSS:"Selected"},
27
+            {Version:"1.5",Model:"doubao-seed-1-6-250615",Content:"深度表达,更多要素\n平均60秒生成",CSS:""},
28
+            {Version:"x1",Model:"xf-yun-spark-x1",Content:"讯飞sparkX1\n平均60秒生成",CSS:""},
29
+            {Version:"qw3",Model:"ali-qwen-plus",Content:"通义千问plus\n平均30秒生成",CSS:""},
30
+            {Version:"hyt",Model:"tencent-hunyuan-turbos",Content:"腾讯混元turbos\n平均30秒生成",CSS:""}];
31
+
32
+        return result;
33
+    },
5 34
     GetSoundErrorArr: () => {
6 35
         return [
7 36
             {
@@ -5508,172 +5537,4 @@ export default {
5508 5537
         ];
5509 5538
         return result;
5510 5539
     },
5511
-    GetMiaoguoTipsList: () => {
5512
-        var result = [{
5513
-            Headline: "题卡制作",
5514
-            List: [{
5515
-                Title: "三条新常识——题卡方法论",
5516
-                Cover: "program_screenshot_tips_a01.png",
5517
-                Images: ["doc_tips_a0101.png", "doc_tips_a0102.png", "doc_tips_a0103.png", "doc_tips_a0104.png", "doc_tips_a0105.png", "doc_tips_a0106.png", "doc_tips_a0107.png",],
5518
-            }, {
5519
-                Title: "题卡数量的建议",
5520
-                Cover: "program_screenshot_tips_a02.png",
5521
-                Images: ["doc_tips_a0201.png", "doc_tips_a0202.png", "doc_tips_a0203.png", "doc_tips_a0204.png", "doc_tips_a0205.png",],
5522
-            }, {
5523
-                Title: "添加资料到指定段落",
5524
-                Cover: "program_screenshot_tips_a03.png",
5525
-                Images: ["doc_tips_a0301.png", "doc_tips_a0302.png",],
5526
-            }, {
5527
-                Title: "段落编辑和工具栏介绍",
5528
-                Cover: "program_screenshot_tips_a04.png",
5529
-                Images: ["doc_tips_a0401.png", "doc_tips_a0402.png", "doc_tips_a0403.png", "doc_tips_a0404.png",],
5530
-            }, {
5531
-                Title: "三种含语音题卡的制作方法",
5532
-                Cover: "program_screenshot_tips_a05.png",
5533
-                Images: ["doc_tips_a0501.png", "doc_tips_a0502.png", "doc_tips_a0503.png", "doc_tips_a0504.png",],
5534
-            }, {
5535
-                Title: "题卡的图片数量限制",
5536
-                Cover: "program_screenshot_tips_a06.png",
5537
-                Images: ["doc_tips_a0601.png", "doc_tips_a0602.png",],
5538
-            }, {
5539
-                Title: "加快录入速度的方法",
5540
-                Cover: "program_screenshot_tips_a07.png",
5541
-                Images: ["doc_tips_a0701.png", "doc_tips_a0702.png",],
5542
-            }]
5543
-        }, {
5544
-            Headline: "练习操作",
5545
-            List: [{
5546
-                Title: "督导就是伴着孩子一起长大",
5547
-                Cover: "program_screenshot_tips_b01.png",
5548
-                Images: ["doc_tips_b0101.png", "doc_tips_b0102.png", "doc_tips_b0103.png",],
5549
-            }, {
5550
-                Title: "新题卡在练习时的特别之处",
5551
-                Cover: "program_screenshot_tips_b02.png",
5552
-                Images: ["doc_tips_b0201.png",],
5553
-            }, {
5554
-                Title: "记忆评价的作用和操作",
5555
-                Cover: "program_screenshot_tips_b03.png",
5556
-                Images: ["doc_tips_b0301.png", "doc_tips_b0302.png", "doc_tips_b0303.png", "doc_tips_b0304.png", "doc_tips_b0305.png", "doc_tips_b0306.png","doc_tips_b0307.png",],
5557
-            }, {
5558
-                Title: "时间指标的作用和操作",
5559
-                Cover: "program_screenshot_tips_b04.png",
5560
-                Images: ["doc_tips_b0401.png", "doc_tips_b0402.png", "doc_tips_b0403.png",],
5561
-            }, {
5562
-                Title: "题卡到期谁优先",
5563
-                Cover: "program_screenshot_tips_b05.png",
5564
-                Images: ["doc_tips_b0501.png", "doc_tips_b0502.png", "doc_tips_b0503.png",],
5565
-            }, {
5566
-                Title: "任务量变小的原因和处理",
5567
-                Cover: "program_screenshot_tips_b06.png",
5568
-                Images: ["doc_tips_b0601.png", "doc_tips_b0602.png", "doc_tips_b0603.png", "doc_tips_b0604.png",],
5569
-            }, {
5570
-                Title: "过度点蓝的危害及要项",
5571
-                Cover: "program_screenshot_tips_b07.png",
5572
-                Images: ["doc_tips_b0701.png", "doc_tips_b0702.png", "doc_tips_b0703.png",],
5573
-            }, {
5574
-                Title: "勤勉练习的间歇期",
5575
-                Cover: "program_screenshot_tips_b08.png",
5576
-                Images: ["doc_tips_b0801.png", "doc_tips_b0802.png", "doc_tips_b0803.png",],
5577
-            }, {
5578
-                Title: "用“搁置、挪到最后”跳题",
5579
-                Cover: "program_screenshot_tips_b09.png",
5580
-                Images: ["doc_tips_b0901.png", "doc_tips_b0902.png", "doc_tips_b0903.png",],
5581
-            }, {
5582
-                Title: "显示与隐藏段落",
5583
-                Cover: "program_screenshot_tips_b10.png",
5584
-                Images: ["doc_tips_b1001.png", "doc_tips_b1002.png",],
5585
-            }, {
5586
-                Title: "调整题卡主题色",
5587
-                Cover: "program_screenshot_tips_b11.png",
5588
-                Images: ["doc_tips_b1101.png",],
5589
-            }, {
5590
-                Title: "检验语文错别字的方法",
5591
-                Cover: "program_screenshot_tips_b12.png",
5592
-                Images: ["doc_tips_b1201.png", "doc_tips_b1202.png", "doc_tips_b1203.png", "doc_tips_b1204.png", "doc_tips_b1205.png",],
5593
-            }, {
5594
-                Title: "练习中的其它处置功能",
5595
-                Cover: "program_screenshot_tips_b13.png",
5596
-                Images: ["doc_tips_b1301.png", "doc_tips_b1302.png", "doc_tips_b1303.png"],
5597
-            }, {
5598
-                Title: "到期时间与到期题卡",
5599
-                Cover: "program_screenshot_tips_b14.png",
5600
-                Images: ["doc_tips_b1401.png", "doc_tips_b1402.png"],
5601
-            }, {
5602
-                Title: "分配卡单",
5603
-                Cover: "program_screenshot_tips_b15.png",
5604
-                Images: ["doc_tips_b1501.png", "doc_tips_b1502.png", "doc_tips_b1503.png", "doc_tips_b1504.png", "doc_tips_b1505.png", "doc_tips_b1506.png", "doc_tips_b1507.png"],
5605
-            }, {
5606
-                Title: "重做今天的练习",
5607
-                Cover: "program_screenshot_tips_b16.png",
5608
-                Images: ["doc_tips_b1601.png", "doc_tips_b1602.png", "doc_tips_b1603.png", "doc_tips_b1604.png"],
5609
-            }]
5610
-        }, {
5611
-
5612
-
5613
-            Headline: "辅助功能",
5614
-            List: [{
5615
-                Title: "秒过官网网址",
5616
-                Cover: "program_screenshot_tips_c01.png",
5617
-                Images: ["doc_tips_c0101.png", "doc_tips_c0102.png", "doc_tips_c0103.png",],
5618
-            }, {
5619
-                Title: "快速启动秒过的方法",
5620
-                Cover: "program_screenshot_tips_c02.png",
5621
-                Images: ["doc_tips_c0201.png", "doc_tips_c0202.png", "doc_tips_c0203.png", "doc_tips_c0204.png",],
5622
-            }, {
5623
-                Title: "在多台设备上用秒过",
5624
-                Cover: "program_screenshot_tips_c03.png",
5625
-                Images: ["doc_tips_c0301.png", "doc_tips_c0302.png", "doc_tips_c0303.png",],
5626
-            }, {
5627
-                Title: "把两个微信号绑定在一起",
5628
-                Cover: "program_screenshot_tips_c04.png",
5629
-                Images: ["doc_tips_c0401.png", "doc_tips_c0402.png", "doc_tips_c0403.png", "doc_tips_c0404.png",],
5630
-            }, {
5631
-                Title: "勤勉接力如何生成和分享",
5632
-                Cover: "program_screenshot_tips_c05.png",
5633
-                Images: ["doc_tips_c0501.png", "doc_tips_c0502.png", "doc_tips_c0503.png",],
5634
-            }, {
5635
-                Title: "分享题卡怎么做",
5636
-                Cover: "program_screenshot_tips_c06.png",
5637
-                Images: ["doc_tips_c0601.png", "doc_tips_c0602.png",],
5638
-            }, {
5639
-                Title: "微信新号办理方法",
5640
-                Cover: "program_screenshot_tips_c07.png",
5641
-                Images: ["doc_tips_c0701.png", "doc_tips_c0702.png",],
5642
-            },]
5643
-        }, {
5644
-
5645
-
5646
-            Headline: "故障排除",
5647
-            List: [{
5648
-                Title: "官网乱码的解决方法",
5649
-                Cover: "program_screenshot_tips_d01.png",
5650
-                Images: ["doc_tips_d0101.png", "doc_tips_d0102.png", "doc_tips_d0103.png",],
5651
-            }, {
5652
-                Title: "题卡掉图的解决方法",
5653
-                Cover: "program_screenshot_tips_d02.png",
5654
-                Images: ["doc_tips_d0201.png", "doc_tips_d0202.png",],
5655
-            }, {
5656
-                Title: "播放没有声音的解决方法",
5657
-                Cover: "program_screenshot_tips_d03.png",
5658
-                Images: ["doc_tips_d0301.png", "doc_tips_d0302.png", "doc_tips_d0303.png",],
5659
-            }, {
5660
-                Title: "软件故障的三种解决方法",
5661
-                Cover: "program_screenshot_tips_d04.png",
5662
-                Images: ["doc_tips_d0401.png", "doc_tips_d0402.png",],
5663
-            }, {
5664
-                Title: "关闭APP释放内存的方法",
5665
-                Cover: "program_screenshot_tips_d05.png",
5666
-                Images: ["doc_tips_d0501.png", "doc_tips_d0502.png", "doc_tips_d0503.png", "doc_tips_d0504.png", "doc_tips_d0505.png",],
5667
-            }, {
5668
-                Title: "用删除小程序解决部分故障",
5669
-                Cover: "program_screenshot_tips_d06.png",
5670
-                Images: ["doc_tips_d0601.png", "doc_tips_d0602.png",],
5671
-            }, {
5672
-                Title: "检查微信、小程序版本号",
5673
-                Cover: "program_screenshot_tips_d07.png",
5674
-                Images: ["doc_tips_d0701.png", "doc_tips_d0702.png",],
5675
-            },]
5676
-        },];
5677
-        return result;
5678
-    }
5679 5540
 }