doomiaichat 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/openai.js +2 -7
- package/package.json +1 -1
- package/src/openai.ts +2 -8
package/dist/openai.js
CHANGED
|
@@ -471,12 +471,6 @@ class OpenAIGpt extends gptbase_1.default {
|
|
|
471
471
|
*/
|
|
472
472
|
pickUpQuestions(result, count, questiontype, score = 1) {
|
|
473
473
|
let answerString = result[0].message.content.trim().replace(/\t|\n|\v|\r|\f/g, '');
|
|
474
|
-
// const firstsybmol = answerString.indexOf("["); ////必须过滤出来数组
|
|
475
|
-
// const lastsybmol = answerString.lastIndexOf("]");
|
|
476
|
-
// console.log('answerString', answerString)
|
|
477
|
-
// if (firstsybmol < 0 || lastsybmol < 0 || lastsybmol <= firstsybmol) return [];
|
|
478
|
-
// answerString = answerString.substr(firstsybmol, lastsybmol - firstsybmol + 1);
|
|
479
|
-
// console.log('answerString', answerString)
|
|
480
474
|
let jsonObj = this.fixedJsonString(answerString);
|
|
481
475
|
if (!jsonObj.length)
|
|
482
476
|
return [];
|
|
@@ -516,7 +510,8 @@ class OpenAIGpt extends gptbase_1.default {
|
|
|
516
510
|
questionitem.answer = (questionitem.answer + '').replace(/,|[^ABCDEFG]/g, '').split('');
|
|
517
511
|
break;
|
|
518
512
|
case 'trueorfalse':
|
|
519
|
-
|
|
513
|
+
let rightItem = questionitem.choice.find((x) => { return x.iscorrect == 1; });
|
|
514
|
+
questionitem.answer = [(rightItem === null || rightItem === void 0 ? void 0 : rightItem.id) || 'Z']; //[(questionitem.answer + '').indexOf('正确') >= 0 ? 'A' : 'B']
|
|
520
515
|
break;
|
|
521
516
|
}
|
|
522
517
|
///单选题验证
|
package/package.json
CHANGED
package/src/openai.ts
CHANGED
|
@@ -441,13 +441,6 @@ export default class OpenAIGpt extends GptBase {
|
|
|
441
441
|
*/
|
|
442
442
|
protected pickUpQuestions(result: Array<any>, count: number, questiontype: string, score: number = 1): Array<QuestionItem> {
|
|
443
443
|
let answerString = result[0].message.content.trim().replace(/\t|\n|\v|\r|\f/g, '');
|
|
444
|
-
// const firstsybmol = answerString.indexOf("["); ////必须过滤出来数组
|
|
445
|
-
// const lastsybmol = answerString.lastIndexOf("]");
|
|
446
|
-
|
|
447
|
-
// console.log('answerString', answerString)
|
|
448
|
-
// if (firstsybmol < 0 || lastsybmol < 0 || lastsybmol <= firstsybmol) return [];
|
|
449
|
-
// answerString = answerString.substr(firstsybmol, lastsybmol - firstsybmol + 1);
|
|
450
|
-
// console.log('answerString', answerString)
|
|
451
444
|
let jsonObj = this.fixedJsonString(answerString);
|
|
452
445
|
if (!jsonObj.length) return []
|
|
453
446
|
let returnItems: QuestionItem[] = [];
|
|
@@ -487,7 +480,8 @@ export default class OpenAIGpt extends GptBase {
|
|
|
487
480
|
questionitem.answer = (questionitem.answer + '').replace(/,|[^ABCDEFG]/g, '').split('');
|
|
488
481
|
break;
|
|
489
482
|
case 'trueorfalse':
|
|
490
|
-
|
|
483
|
+
let rightItem = questionitem.choice.find((x: any) => { return x.iscorrect == 1 });
|
|
484
|
+
questionitem.answer = [rightItem?.id || 'Z'] ; //[(questionitem.answer + '').indexOf('正确') >= 0 ? 'A' : 'B']
|
|
491
485
|
break;
|
|
492
486
|
}
|
|
493
487
|
///单选题验证
|