ai-error-assistant-mobile 0.0.13 → 0.0.14
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/components/demo/src/chat.vue +69 -3
- package/components/demo/src/error-chat.vue +50 -6
- package/components/demo/src/main.vue +2 -3
- package/dist/ai-error-assistant-mobile.common.js +18392 -32
- package/dist/ai-error-assistant-mobile.common.js.map +1 -1
- package/dist/ai-error-assistant-mobile.css +1 -1
- package/dist/ai-error-assistant-mobile.umd.js +18392 -32
- package/dist/ai-error-assistant-mobile.umd.js.map +1 -1
- package/dist/ai-error-assistant-mobile.umd.min.js +4 -4
- package/dist/ai-error-assistant-mobile.umd.min.js.map +1 -1
- package/dist/fonts/KaTeX_AMS-Regular.1608a09b.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.4aafdb68.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.a79f1c31.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.cce5b8ec.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.07ef19e7.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.9f256b85.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.b18f59e1.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.d42a5579.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.7c187121.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.d3c882a6.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ed38e79f.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.b74a1a8b.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.c3fb5ac2.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.d181c465.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.6f2bb1df.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.70d8b0a5.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.e3f82f9d.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.47373d1e.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.8916142b.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.9024d815.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.0462f03b.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.7f51fe03.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.b7f8fe9b.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.572d331f.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.a879cf83.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.f1035d8d.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.5295ba48.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.939bc644.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.f28c23ac.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.8c5b5494.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.94e1e8dc.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.bf59d231.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.3b1e59b3.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.7c9bc82b.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.b4c20c84.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.74048478.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ba21ed5f.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.d4d7ba48.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.03e9641d.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.07505710.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.fe9cbbe1.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.fabc004a.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.d6b476ec.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.fbccdabe.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.6258592b.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.a8709e36.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.d97aaf4a.ttf +0 -0
- package/package.json +2 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:class="{'user-list': list.type === 'user'}"
|
|
6
6
|
class="message">
|
|
7
7
|
<div :class="{'user-info': list.type === 'user'}" class="robot-message">
|
|
8
|
-
<div v-html="list.message"></div>
|
|
8
|
+
<div v-html="renderFormulas(list.message)"></div>
|
|
9
9
|
<div v-if="list.type === 'robot' && list.links.length > 0 && showFile" class="link">
|
|
10
10
|
<div v-if="!list.allIdWithStart">
|
|
11
11
|
<div class="link-title">参考文件</div>
|
|
@@ -82,6 +82,9 @@ import ChatTools from './chat-tools.vue';
|
|
|
82
82
|
import ErrorChat from './error-chat.vue';
|
|
83
83
|
import {marked} from 'marked';
|
|
84
84
|
import {chartClear, sendMessageEventSource, getAutoQuestioning, pdfUrlBase} from "../api";
|
|
85
|
+
import katex from 'katex';
|
|
86
|
+
import 'katex/dist/katex.min.css';
|
|
87
|
+
|
|
85
88
|
|
|
86
89
|
const controller = new AbortController();
|
|
87
90
|
const signal = controller.signal;
|
|
@@ -364,6 +367,48 @@ export default {
|
|
|
364
367
|
const baseUrl = `${pdfUrlBase}/#/pdf-view?documentUrl=${encodeURIComponent(url)}&pageIndex=${pageIndex}`;
|
|
365
368
|
window.open(baseUrl, '_blank');
|
|
366
369
|
},
|
|
370
|
+
renderFormulas(text) {
|
|
371
|
+
const {renderToString} = katex;
|
|
372
|
+
return text
|
|
373
|
+
.replace(/\$\$(.*?)\$\$/gs, (match) => {
|
|
374
|
+
try {
|
|
375
|
+
// 渲染块级公式
|
|
376
|
+
return renderToString(match.slice(2, -2), {displayMode: false});
|
|
377
|
+
} catch (error) {
|
|
378
|
+
console.error('Error rendering block formula:', error);
|
|
379
|
+
return match;
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
.replace(/\$.*?\$/g, (match) => {
|
|
383
|
+
match = match.replace(/<br>/g, '');
|
|
384
|
+
try {
|
|
385
|
+
// 渲染行内公式
|
|
386
|
+
return renderToString(match.slice(1, -1), {displayMode: false});
|
|
387
|
+
} catch (error) {
|
|
388
|
+
console.error('Error rendering inline formula:', error);
|
|
389
|
+
return match;
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
.replace(/\\\(.*?\\\)/g, (match) => {
|
|
393
|
+
try {
|
|
394
|
+
// 渲染行内公式
|
|
395
|
+
return renderToString(match.slice(2, -2), {displayMode: false});
|
|
396
|
+
} catch (error) {
|
|
397
|
+
console.error('Error rendering inline formula:', error);
|
|
398
|
+
return match;
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
.replace(/\\\[[\s\S]*?\\]/g, (match) => {
|
|
402
|
+
match = match.replace(/<br>/g, '');
|
|
403
|
+
try {
|
|
404
|
+
// 渲染块级公式
|
|
405
|
+
return renderToString(match.slice(2, -2), {displayMode: false});
|
|
406
|
+
} catch (error) {
|
|
407
|
+
console.error('Error rendering block formula:', error);
|
|
408
|
+
return match;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
},
|
|
367
412
|
},
|
|
368
413
|
}
|
|
369
414
|
</script>
|
|
@@ -421,8 +466,8 @@ export default {
|
|
|
421
466
|
border-radius: 0.25rem 1rem 1rem 1rem;
|
|
422
467
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
423
468
|
min-width: 120px;
|
|
424
|
-
max-width:
|
|
425
|
-
padding:
|
|
469
|
+
max-width: 100%;
|
|
470
|
+
padding: 12px;
|
|
426
471
|
}
|
|
427
472
|
}
|
|
428
473
|
}
|
|
@@ -502,6 +547,27 @@ export default {
|
|
|
502
547
|
font-size: 0.875rem;
|
|
503
548
|
}
|
|
504
549
|
|
|
550
|
+
:deep(table) {
|
|
551
|
+
border-collapse: collapse;
|
|
552
|
+
margin: 16px 0;
|
|
553
|
+
font-size: 14px;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
:deep(th),
|
|
557
|
+
:deep(td) {
|
|
558
|
+
border: 1px solid #e0e0e0;
|
|
559
|
+
text-align: left;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
:deep(th) {
|
|
563
|
+
background: #f3f2ff;
|
|
564
|
+
font-weight: 600;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
:deep(li) {
|
|
568
|
+
list-style: none;
|
|
569
|
+
}
|
|
570
|
+
|
|
505
571
|
:deep(a) {
|
|
506
572
|
color: #6050f0;
|
|
507
573
|
text-decoration: none;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="error-chat-contain">
|
|
3
3
|
<div class="exercises-answer">
|
|
4
4
|
<div class="exercises-answer-bg"></div>
|
|
5
|
-
<p class="question-stem" v-html="questionStem.title"></p>
|
|
5
|
+
<p class="question-stem" v-html="renderFormulas(questionStem.title)"></p>
|
|
6
6
|
<div class="answer-part" v-if="questionStem.type === 'single' || questionStem.type === 'multiple'">
|
|
7
7
|
<div class="answer-list" v-for="(item, index) in questionStem.options" :key="index">
|
|
8
8
|
<div class="check-content" style="width: 24px">
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
alt=""
|
|
12
12
|
style="width: 24px">
|
|
13
13
|
</div>
|
|
14
|
-
<div class="answer-list" v-html="item"></div>
|
|
14
|
+
<div class="answer-list" v-html="renderFormulas(item)"></div>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
17
|
<div class="answer-part"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<div v-for="(item, index) in questionStem.studentAnswer"
|
|
45
45
|
style="margin-right: 16px; font-size: 0.875rem; margin-bottom: 0.5rem;"
|
|
46
46
|
:key="index"
|
|
47
|
-
v-html="item">
|
|
47
|
+
v-html="renderFormulas(item)">
|
|
48
48
|
</div>
|
|
49
49
|
</div>
|
|
50
50
|
<div v-if="questionStem.type === 'judge'">
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
element-loading-text="分析中,请稍后"
|
|
66
66
|
v-loading="!Object.keys(analysisData).length > 0">
|
|
67
67
|
<div class="title-label">题目解析</div>
|
|
68
|
-
<div class="answer-content" v-html="analysisData.analysis"></div>
|
|
68
|
+
<div class="answer-content" v-html="renderFormulas(analysisData.analysis)"></div>
|
|
69
69
|
<div class="title-label">错因分析</div>
|
|
70
|
-
<div class="answer-content" v-html="analysisData.reason"></div>
|
|
70
|
+
<div class="answer-content" v-html="renderFormulas(analysisData.reason)"></div>
|
|
71
71
|
<div class="title-label"
|
|
72
72
|
v-if="businessSource !== '2' && analysisData.recommend && analysisData.recommend.length > 0 && !allIdWithStart">
|
|
73
73
|
推荐资料
|
|
@@ -90,6 +90,8 @@
|
|
|
90
90
|
<script>
|
|
91
91
|
import ChatTools from './chat-tools.vue';
|
|
92
92
|
import {erranalysis, retryAnalysis,pdfUrlBase} from '../api/index'
|
|
93
|
+
import katex from 'katex';
|
|
94
|
+
import 'katex/dist/katex.min.css';
|
|
93
95
|
|
|
94
96
|
export default {
|
|
95
97
|
name: 'ErrorChart',
|
|
@@ -205,7 +207,49 @@ export default {
|
|
|
205
207
|
this.analysisData = {key: true};
|
|
206
208
|
console.log(e);
|
|
207
209
|
}
|
|
208
|
-
}
|
|
210
|
+
},
|
|
211
|
+
renderFormulas(text) {
|
|
212
|
+
const {renderToString} = katex;
|
|
213
|
+
return text
|
|
214
|
+
.replace(/\$\$(.*?)\$\$/gs, (match) => {
|
|
215
|
+
try {
|
|
216
|
+
// 渲染块级公式
|
|
217
|
+
return renderToString(match.slice(2, -2), {displayMode: false});
|
|
218
|
+
} catch (error) {
|
|
219
|
+
console.error('Error rendering block formula:', error);
|
|
220
|
+
return match;
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
.replace(/\$.*?\$/g, (match) => {
|
|
224
|
+
match = match.replace(/<br>/g, '');
|
|
225
|
+
try {
|
|
226
|
+
// 渲染行内公式
|
|
227
|
+
return renderToString(match.slice(1, -1), {displayMode: false});
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.error('Error rendering inline formula:', error);
|
|
230
|
+
return match;
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
.replace(/\\\(.*?\\\)/g, (match) => {
|
|
234
|
+
try {
|
|
235
|
+
// 渲染行内公式
|
|
236
|
+
return renderToString(match.slice(2, -2), {displayMode: false});
|
|
237
|
+
} catch (error) {
|
|
238
|
+
console.error('Error rendering inline formula:', error);
|
|
239
|
+
return match;
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
.replace(/\\\[[\s\S]*?\\]/g, (match) => {
|
|
243
|
+
match = match.replace(/<br>/g, '');
|
|
244
|
+
try {
|
|
245
|
+
// 渲染块级公式
|
|
246
|
+
return renderToString(match.slice(2, -2), {displayMode: false});
|
|
247
|
+
} catch (error) {
|
|
248
|
+
console.error('Error rendering block formula:', error);
|
|
249
|
+
return match;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
},
|
|
209
253
|
}
|
|
210
254
|
}
|
|
211
255
|
</script>
|
|
@@ -400,15 +400,14 @@ export default {
|
|
|
400
400
|
|
|
401
401
|
.ai-main-content {
|
|
402
402
|
position: relative;
|
|
403
|
-
height: calc(100% -
|
|
403
|
+
height: calc(100% - 200px);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
.disclaimer {
|
|
407
|
-
margin: 0;
|
|
408
407
|
font-size: 14px;
|
|
409
408
|
color: #cfcfcf;
|
|
410
409
|
text-align: center;
|
|
411
|
-
margin
|
|
410
|
+
margin: 6px 0 0;
|
|
412
411
|
}
|
|
413
412
|
|
|
414
413
|
.message-wrap {
|