ai-error-assistant-mobile 0.0.1
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/README.md +33 -0
- package/components/demo/api/index.js +123 -0
- package/components/demo/index.js +7 -0
- package/components/demo/plugins/cache.js +77 -0
- package/components/demo/src/chat-tools.vue +477 -0
- package/components/demo/src/chat.vue +618 -0
- package/components/demo/src/error-chat.vue +384 -0
- package/components/demo/src/main.vue +408 -0
- package/components/demo/static/bg-img.png +0 -0
- package/components/demo/static/cai-active.png +0 -0
- package/components/demo/static/cai.png +0 -0
- package/components/demo/static/correct.png +0 -0
- package/components/demo/static/delete.png +0 -0
- package/components/demo/static/error.png +0 -0
- package/components/demo/static/logo.png +0 -0
- package/components/demo/static/robot.png +0 -0
- package/components/demo/static/send-icon.png +0 -0
- package/components/demo/static/zan-active.png +0 -0
- package/components/demo/static/zan.png +0 -0
- package/components/demo/utils/aes-utils.js +35 -0
- package/components/demo/utils/config.js +99 -0
- package/components/demo/utils/constants.js +15 -0
- package/components/demo/utils/request.js +72 -0
- package/components/index.js +16 -0
- package/dist/ai-error-assistant-mobile.common.js +14916 -0
- package/dist/ai-error-assistant-mobile.common.js.map +1 -0
- package/dist/ai-error-assistant-mobile.css +1 -0
- package/dist/ai-error-assistant-mobile.umd.js +14935 -0
- package/dist/ai-error-assistant-mobile.umd.js.map +1 -0
- package/dist/ai-error-assistant-mobile.umd.min.js +18 -0
- package/dist/ai-error-assistant-mobile.umd.min.js.map +1 -0
- package/dist/demo.html +1 -0
- package/dist/img/robot.7ad12cd4.png +0 -0
- package/package.json +47 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="error-chat-contain">
|
|
3
|
+
<div class="exercises-answer">
|
|
4
|
+
<div class="exercises-answer-bg"></div>
|
|
5
|
+
<p class="question-stem" v-html="questionStem.title"></p>
|
|
6
|
+
<div class="answer-part" v-if="questionStem.type === 'single' || questionStem.type === 'multiple'">
|
|
7
|
+
<div class="answer-list" v-for="(item, index) in questionStem.options" :key="index">
|
|
8
|
+
<div class="check-content" style="width: 24px">
|
|
9
|
+
<img src="../static/correct.png"
|
|
10
|
+
v-if="questionStem.answer.indexOf(item) > -1"
|
|
11
|
+
alt=""
|
|
12
|
+
style="width: 24px">
|
|
13
|
+
</div>
|
|
14
|
+
<div class="answer-list" v-html="item"></div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="answer-part"
|
|
18
|
+
style="padding-bottom: 24px"
|
|
19
|
+
v-if="questionStem.type === 'judge'">
|
|
20
|
+
正确答案: <span style="margin-left: 8px">{{ questionStem.answer.join(',') }}</span>
|
|
21
|
+
</div>
|
|
22
|
+
<!-- <div class="answer-part"-->
|
|
23
|
+
<!-- style="padding-bottom: 24px"-->
|
|
24
|
+
<!-- v-if="questionStem.type === 'gapfilling'">-->
|
|
25
|
+
<!-- 正确答案:-->
|
|
26
|
+
<!-- <span style="margin-left: 8px"-->
|
|
27
|
+
<!-- v-for="(item, index) in questionStem.answer"-->
|
|
28
|
+
<!-- :key="index">-->
|
|
29
|
+
<!-- {{ item }}<span v-if="index !== questionStem.answer.length - 1">,</span>-->
|
|
30
|
+
<!-- </span>-->
|
|
31
|
+
<!-- </div>-->
|
|
32
|
+
<div class="answer-part"
|
|
33
|
+
style="padding-bottom: 24px"
|
|
34
|
+
v-if="questionStem.type === 'shortanswer' || questionStem.type === 'gapfilling'">
|
|
35
|
+
<span style="vertical-align: inherit; display: inline-block">正确答案:</span>
|
|
36
|
+
<span style="margin-left: 8px; display: inline-block; width: calc(100% - 82px); vertical-align: top;"
|
|
37
|
+
v-html="questionStem.answer.join(',')"></span>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="student-answer-part">
|
|
40
|
+
<div class="check-content" style="width: 24px; margin-right: 16px">
|
|
41
|
+
<img src="../static/error.png" style="width: 24px">
|
|
42
|
+
</div>
|
|
43
|
+
<div v-if="questionStem.type === 'single' || questionStem.type === 'multiple'">
|
|
44
|
+
<div v-for="(item, index) in questionStem.studentAnswer"
|
|
45
|
+
style="margin-right: 16px; font-size: 0.875rem; margin-top: -10px;"
|
|
46
|
+
:key="index"
|
|
47
|
+
v-html="item">
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div v-if="questionStem.type === 'judge'">
|
|
51
|
+
<span style="margin-left: 8px">{{ questionStem.studentAnswer.join(',') }}</span>
|
|
52
|
+
</div>
|
|
53
|
+
<!-- <span style="margin-left: 8px"-->
|
|
54
|
+
<!-- v-if="questionStem.type === 'gapfilling'"-->
|
|
55
|
+
<!-- v-for="(item, index) in questionStem.studentAnswer"-->
|
|
56
|
+
<!-- :key="index">-->
|
|
57
|
+
<!-- {{ item }}<span v-if="index !== questionStem.studentAnswer.length - 1">,</span>-->
|
|
58
|
+
<!-- </span>-->
|
|
59
|
+
<div v-if="questionStem.type === 'shortanswer' || questionStem.type === 'gapfilling'">
|
|
60
|
+
<span style="margin-left: 8px" v-html="questionStem.studentAnswer.join(',')"></span>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="ai-analyze-content"
|
|
65
|
+
element-loading-text="分析中,请稍后"
|
|
66
|
+
v-loading="!Object.keys(analysisData).length > 0">
|
|
67
|
+
<div class="title-label">题目解析</div>
|
|
68
|
+
<div class="answer-content" v-html="analysisData.analysis"></div>
|
|
69
|
+
<div class="title-label">错因分析</div>
|
|
70
|
+
<div class="answer-content" v-html="analysisData.reason"></div>
|
|
71
|
+
<div class="title-label"
|
|
72
|
+
v-if="businessSource !== '2' && analysisData.recommend && analysisData.recommend.length > 0 && !allIdWithStart">
|
|
73
|
+
推荐资料
|
|
74
|
+
</div>
|
|
75
|
+
<div class="answer-content" v-if="businessSource !== '2' ">
|
|
76
|
+
<div v-for="(list,index) in analysisData.recommend" :key="index" style="margin-bottom: 8px">
|
|
77
|
+
<a :href="'https://ai-yuliao.hep.com.cn' + list.url"
|
|
78
|
+
target="_blank"
|
|
79
|
+
v-if="!list.title.startsWith(chatMajorId)">{{ list.title }}
|
|
80
|
+
</a>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<chat-tools type="error"
|
|
84
|
+
:chatId="chatId"
|
|
85
|
+
:detailData="detailData"
|
|
86
|
+
@on-reanswer="reanswer"/>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
<script>
|
|
91
|
+
import ChatTools from './chat-tools.vue';
|
|
92
|
+
import {erranalysis, retryAnalysis} from '../api/index'
|
|
93
|
+
|
|
94
|
+
export default {
|
|
95
|
+
name: 'ErrorChart',
|
|
96
|
+
components: {
|
|
97
|
+
ChatTools
|
|
98
|
+
},
|
|
99
|
+
props: {
|
|
100
|
+
questionStem: {},
|
|
101
|
+
businessSource: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: ''
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
data() {
|
|
107
|
+
return {
|
|
108
|
+
detailData: {}, // 记录页面点赞 踩情况
|
|
109
|
+
analysisData: {}, // 记录页面点赞 踩情况
|
|
110
|
+
chatId: '', // 对话id
|
|
111
|
+
chatMajorId: '', // 智能体id
|
|
112
|
+
allIdWithStart: true // 智能体id
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
watch: {
|
|
116
|
+
questionStem: {
|
|
117
|
+
handler() {
|
|
118
|
+
if (this.questionStem) this.getErrorAnalysis();
|
|
119
|
+
},
|
|
120
|
+
immediate: true
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
async getErrorAnalysis() {
|
|
125
|
+
try {
|
|
126
|
+
this.analysisData = {};
|
|
127
|
+
const analysisRes = await erranalysis({
|
|
128
|
+
courseId: this.questionStem.courseId,
|
|
129
|
+
busId: this.questionStem.busId,
|
|
130
|
+
questionType: this.questionStem.type,
|
|
131
|
+
title: this.questionStem.title,
|
|
132
|
+
answer: this.questionStem.answer.join(','),
|
|
133
|
+
studentAnswer: this.questionStem.studentAnswer.join(','),
|
|
134
|
+
optionList: this.questionStem.options,
|
|
135
|
+
});
|
|
136
|
+
const {
|
|
137
|
+
eaAnalysisDtoList: [{content, errId, chatId, contentId, type}],
|
|
138
|
+
xhModelDetailVoList
|
|
139
|
+
} = analysisRes;
|
|
140
|
+
if (xhModelDetailVoList) this.chatMajorId = xhModelDetailVoList[0].chatMajorId;
|
|
141
|
+
// 传入工具中的值
|
|
142
|
+
this.chatId = chatId;
|
|
143
|
+
this.detailData = {
|
|
144
|
+
msgId: contentId,
|
|
145
|
+
zan: type === 1,
|
|
146
|
+
cai: type === 2
|
|
147
|
+
}
|
|
148
|
+
this.$emit('on-init', xhModelDetailVoList, chatId);
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
this.analysisData = JSON.parse(content);
|
|
152
|
+
this.detailData.errId = errId;
|
|
153
|
+
if (this.analysisData.recommend && this.analysisData.recommend.length > 0) {
|
|
154
|
+
for (let item of this.analysisData.recommend) {
|
|
155
|
+
if (!item.title.startsWith(this.chatMajorId)) {
|
|
156
|
+
this.allIdWithStart = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch (e) {
|
|
161
|
+
this.$message.warning('解析失败' + e);
|
|
162
|
+
this.analysisData = {key: true};
|
|
163
|
+
console.log(e);
|
|
164
|
+
}
|
|
165
|
+
} catch (e) {
|
|
166
|
+
throw new Error(e);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
async reanswer(list) {
|
|
170
|
+
const cache = {...this.analysisData};
|
|
171
|
+
this.analysisData = {};
|
|
172
|
+
const analysisRes = await retryAnalysis(list.errId);
|
|
173
|
+
if (!analysisRes) {
|
|
174
|
+
this.analysisData = {...cache};
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const {eaAnalysisDtoList: [{content, errId, contentId, type}]} = analysisRes;
|
|
178
|
+
this.detailData = {
|
|
179
|
+
msgId: contentId,
|
|
180
|
+
zan: type === 1,
|
|
181
|
+
cai: type === 2
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
this.analysisData = JSON.parse(content);
|
|
185
|
+
this.detailData.errId = errId;
|
|
186
|
+
} catch (e) {
|
|
187
|
+
this.$message.warn('解析失败');
|
|
188
|
+
this.analysisData = {key: true};
|
|
189
|
+
console.log(e);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
</script>
|
|
195
|
+
<style lang="scss" scoped>
|
|
196
|
+
.error-chat-contain {
|
|
197
|
+
width: 100%;
|
|
198
|
+
max-width: 100%;
|
|
199
|
+
margin: 0 auto;
|
|
200
|
+
padding: 0 1rem;
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.exercises-answer {
|
|
205
|
+
position: relative;
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
padding: 1.5rem;
|
|
208
|
+
border-radius: 0.75rem;
|
|
209
|
+
background: #fff;
|
|
210
|
+
margin-bottom: 1.5rem;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.question-stem {
|
|
214
|
+
position: relative;
|
|
215
|
+
z-index: 1;
|
|
216
|
+
font-size: 1rem;
|
|
217
|
+
color: #202840;
|
|
218
|
+
line-height: 1.5;
|
|
219
|
+
font-weight: 500;
|
|
220
|
+
margin: 0;
|
|
221
|
+
word-break: break-word;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.answer-part {
|
|
225
|
+
margin-top: 1.5rem;
|
|
226
|
+
margin-left: 0.5rem;
|
|
227
|
+
padding-bottom: 0.5rem;
|
|
228
|
+
border-bottom: 1px solid #d3d4e1;
|
|
229
|
+
|
|
230
|
+
.check-content {
|
|
231
|
+
margin-right: 1rem;
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: center;
|
|
234
|
+
|
|
235
|
+
img {
|
|
236
|
+
width: 1.5rem;
|
|
237
|
+
height: 1.5rem;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.answer-list {
|
|
243
|
+
display: flex;
|
|
244
|
+
margin-bottom: 0.5rem;
|
|
245
|
+
align-items: flex-start;
|
|
246
|
+
font-size: 0.875rem;
|
|
247
|
+
|
|
248
|
+
> div:last-child {
|
|
249
|
+
flex: 1;
|
|
250
|
+
word-break: break-word;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.student-answer-part {
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: flex-start;
|
|
257
|
+
padding-top: 1rem;
|
|
258
|
+
padding-left: 0.5rem;
|
|
259
|
+
/* flex-wrap: wrap; */
|
|
260
|
+
|
|
261
|
+
.check-content {
|
|
262
|
+
width: 24px;
|
|
263
|
+
margin-right: 16px;
|
|
264
|
+
flex-shrink: 0;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
> div:nth-child(2) {
|
|
268
|
+
flex-grow: 1;
|
|
269
|
+
min-width: 0;
|
|
270
|
+
word-break: break-word;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.ai-analyze-content {
|
|
275
|
+
border-radius: 0.75rem;
|
|
276
|
+
background: #fff;
|
|
277
|
+
padding: 1.5rem;
|
|
278
|
+
margin-top: 1.5rem;
|
|
279
|
+
|
|
280
|
+
.title-label {
|
|
281
|
+
display: inline-block;
|
|
282
|
+
padding: 0.5rem 1rem;
|
|
283
|
+
font-weight: 700;
|
|
284
|
+
font-size: 0.875rem;
|
|
285
|
+
color: rgba(96, 96, 224, 1);
|
|
286
|
+
border: 1px solid rgba(96, 96, 224, 1);
|
|
287
|
+
text-align: center;
|
|
288
|
+
border-radius: 0 50px 50px 50px;
|
|
289
|
+
background: linear-gradient(to bottom, #DDDDFB, #FFFFFF);
|
|
290
|
+
margin-bottom: 1rem;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.answer-content {
|
|
294
|
+
font-size: 0.875rem;
|
|
295
|
+
line-height: 1.5;
|
|
296
|
+
color: #666;
|
|
297
|
+
margin-bottom: 1.5rem;
|
|
298
|
+
word-break: break-word;
|
|
299
|
+
|
|
300
|
+
:deep(p) {
|
|
301
|
+
margin: 0.5rem 0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
:deep(pre) {
|
|
305
|
+
background: #f5f5f5;
|
|
306
|
+
padding: 0.75rem;
|
|
307
|
+
border-radius: 0.25rem;
|
|
308
|
+
overflow-x: auto;
|
|
309
|
+
margin: 0.5rem 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
:deep(code) {
|
|
313
|
+
font-family: monospace;
|
|
314
|
+
background: #f5f5f5;
|
|
315
|
+
padding: 0.125rem 0.25rem;
|
|
316
|
+
border-radius: 0.25rem;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
a {
|
|
320
|
+
color: #1890ff;
|
|
321
|
+
text-decoration: none;
|
|
322
|
+
|
|
323
|
+
&:hover {
|
|
324
|
+
text-decoration: underline;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// 移动端适配
|
|
331
|
+
@media screen and (max-width: 768px) {
|
|
332
|
+
.error-chat-contain {
|
|
333
|
+
padding: 0 0.75rem;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.exercises-answer {
|
|
337
|
+
padding: 1rem;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.question-stem {
|
|
341
|
+
font-size: 0.9375rem;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.ai-analyze-content {
|
|
345
|
+
padding: 1rem;
|
|
346
|
+
|
|
347
|
+
.title-label {
|
|
348
|
+
font-size: 0.8125rem;
|
|
349
|
+
padding: 0.5rem 1rem;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.answer-content {
|
|
353
|
+
font-size: 0.8125rem;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@media screen and (max-width: 480px) {
|
|
359
|
+
.error-chat-contain {
|
|
360
|
+
padding: 0 0.5rem;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.exercises-answer {
|
|
364
|
+
padding: 0.75rem;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.question-stem {
|
|
368
|
+
font-size: 0.875rem;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.ai-analyze-content {
|
|
372
|
+
padding: 0.75rem;
|
|
373
|
+
|
|
374
|
+
.title-label {
|
|
375
|
+
font-size: 0.75rem;
|
|
376
|
+
padding: 0.5rem 1rem;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.answer-content {
|
|
380
|
+
font-size: 0.875rem;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
</style>
|