ai-read-over-pro 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 +81 -0
- package/components/demo/index.js +7 -0
- package/components/demo/plugins/cache.js +77 -0
- package/components/demo/src/chat-tools.vue +275 -0
- package/components/demo/src/main.vue +378 -0
- package/components/demo/src/member-table.vue +204 -0
- package/components/demo/src/read-over.vue +238 -0
- package/components/demo/src/tab-filter.vue +223 -0
- package/components/demo/static/bg-img.svg +10 -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/error.png +0 -0
- package/components/demo/static/filter-block.svg +23 -0
- package/components/demo/static/filter-block_hover.svg +23 -0
- package/components/demo/static/filter-block_selected.svg +23 -0
- package/components/demo/static/filter.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 +42 -0
- package/components/demo/utils/constants.js +13 -0
- package/components/demo/utils/request.js +69 -0
- package/components/index.js +15 -0
- package/dist/ai-read-over-pro.common.js +12858 -0
- package/dist/ai-read-over-pro.common.js.map +1 -0
- package/dist/ai-read-over-pro.css +1 -0
- package/dist/ai-read-over-pro.umd.js +12877 -0
- package/dist/ai-read-over-pro.umd.js.map +1 -0
- package/dist/ai-read-over-pro.umd.min.js +23 -0
- package/dist/ai-read-over-pro.umd.min.js.map +1 -0
- package/dist/demo.html +1 -0
- package/dist/img/bg-img.a3a40197.svg +10 -0
- package/dist/img/filter-block.6f369747.svg +23 -0
- package/dist/img/filter-block_hover.5314be0a.svg +23 -0
- package/dist/img/filter-block_selected.f523d7f3.svg +23 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ai-questtion
|
|
2
|
+
|
|
3
|
+
## Project setup
|
|
4
|
+
```
|
|
5
|
+
npm install
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
### Compiles and minifies for production
|
|
9
|
+
```
|
|
10
|
+
npm run build
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Customize configuration
|
|
14
|
+
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### test-project是测试组件项目
|
|
18
|
+
|
|
19
|
+
### 公司自用组件 npm i ai-question
|
|
20
|
+
|
|
21
|
+
### 调用方法
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
this.$refs.name.showAddQuestion()
|
|
25
|
+
...
|
|
26
|
+
|
|
27
|
+
### top控制侧边弹框到顶部的距离
|
|
28
|
+
|
|
29
|
+
### knowledgeList根据elment传参格式传入树形数据
|
|
30
|
+
|
|
31
|
+
### propFormat知识点传参格式修改 {value : 'xxx',label : 'xxx','children' : 'xxx'}
|
|
32
|
+
|
|
33
|
+
### join加入题库
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import request from '../utils/request'
|
|
2
|
+
const baseURL = sessionStorage.getItem('AI_BASE_URL_FOR_TEST') || 'https://zjyw.icve.com.cn/ai-api';
|
|
3
|
+
const prefix = sessionStorage.getItem('AI_PRE_FIX_FOR_TEST') || '/heatp';
|
|
4
|
+
import cache from '../plugins/cache';
|
|
5
|
+
import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
6
|
+
export const ssoAuth = (token) => {
|
|
7
|
+
return request({
|
|
8
|
+
url: prefix + '/sso/assistant',
|
|
9
|
+
method: 'get',
|
|
10
|
+
params: {
|
|
11
|
+
token: token,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const authUser = (headers) => {
|
|
17
|
+
return request({
|
|
18
|
+
url: '/uc/authuser',
|
|
19
|
+
method: 'get',
|
|
20
|
+
headers: headers,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const criticismApply = (id) => {
|
|
25
|
+
return request({
|
|
26
|
+
url: prefix + `/criticism/${id}/apply`,
|
|
27
|
+
method: 'post',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const generateReview = (data, sseSessionId, courseId) =>{
|
|
32
|
+
return request({
|
|
33
|
+
url: prefix + '/criticism',
|
|
34
|
+
method: 'post',
|
|
35
|
+
data: data,
|
|
36
|
+
headers: {
|
|
37
|
+
'X-Sse-SessionId': sseSessionId
|
|
38
|
+
},
|
|
39
|
+
params: {
|
|
40
|
+
courseId: courseId
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const reanswerReview = (sseSessionId, courseId) =>{
|
|
46
|
+
return request({
|
|
47
|
+
url: prefix + '/criticism/comment',
|
|
48
|
+
method: 'put',
|
|
49
|
+
headers: {
|
|
50
|
+
'X-Sse-SessionId': sseSessionId
|
|
51
|
+
},
|
|
52
|
+
params: {
|
|
53
|
+
commentId: courseId
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const setFeedback = (params, data) => {
|
|
59
|
+
return request({
|
|
60
|
+
url: prefix + `/criticism/feedback`,
|
|
61
|
+
method: 'post',
|
|
62
|
+
data,
|
|
63
|
+
params
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const registerSse = (sseSessionId, fn) => {
|
|
68
|
+
const source = new EventSourcePolyfill(baseURL + prefix + '/sse?id=' + sseSessionId, {
|
|
69
|
+
headers: {
|
|
70
|
+
'X-Id-Token': cache.session.getJSON('SRKJ_TOKEN_CACHE'),
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
source.addEventListener('CRITICISM_ANSWER', (event) => {
|
|
74
|
+
const data = event.data;
|
|
75
|
+
fn(JSON.parse(data))
|
|
76
|
+
});
|
|
77
|
+
source.addEventListener('CRITICISM_COMMENT', (event) => {
|
|
78
|
+
const data = event.data;
|
|
79
|
+
fn({comments: [JSON.parse(data)]}, 'reanswer');
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const sessionCache = {
|
|
2
|
+
set (key, value) {
|
|
3
|
+
if (!sessionStorage) {
|
|
4
|
+
return
|
|
5
|
+
}
|
|
6
|
+
if (key != null && value != null) {
|
|
7
|
+
sessionStorage.setItem(key, value)
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
get (key) {
|
|
11
|
+
if (!sessionStorage) {
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
if (key == null) {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
return sessionStorage.getItem(key)
|
|
18
|
+
},
|
|
19
|
+
setJSON (key, jsonValue) {
|
|
20
|
+
if (jsonValue != null) {
|
|
21
|
+
this.set(key, JSON.stringify(jsonValue))
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
getJSON (key) {
|
|
25
|
+
const value = this.get(key)
|
|
26
|
+
if (value != null) {
|
|
27
|
+
return JSON.parse(value)
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
remove (key) {
|
|
31
|
+
sessionStorage.removeItem(key);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const localCache = {
|
|
35
|
+
set (key, value) {
|
|
36
|
+
if (!localStorage) {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
if (key != null && value != null) {
|
|
40
|
+
localStorage.setItem(key, value)
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
get (key) {
|
|
44
|
+
if (!localStorage) {
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
if (key == null) {
|
|
48
|
+
return null
|
|
49
|
+
}
|
|
50
|
+
return localStorage.getItem(key)
|
|
51
|
+
},
|
|
52
|
+
setJSON (key, jsonValue) {
|
|
53
|
+
if (jsonValue != null) {
|
|
54
|
+
this.set(key, JSON.stringify(jsonValue))
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
getJSON (key) {
|
|
58
|
+
const value = this.get(key)
|
|
59
|
+
if (value != null) {
|
|
60
|
+
return JSON.parse(value)
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
remove (key) {
|
|
64
|
+
localStorage.removeItem(key);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
/**
|
|
70
|
+
* 会话级缓存
|
|
71
|
+
*/
|
|
72
|
+
session: sessionCache,
|
|
73
|
+
/**
|
|
74
|
+
* 本地缓存
|
|
75
|
+
*/
|
|
76
|
+
local: localCache
|
|
77
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="robot-tools">
|
|
3
|
+
<div class="robot-reanswer" @click="reAnswer(listData)">
|
|
4
|
+
<i class="el-icon-refresh-right"></i>
|
|
5
|
+
重新回答
|
|
6
|
+
</div>
|
|
7
|
+
<div class="stopMsg" style="color: #cfcfcf; cursor: default" v-if="type !== 'error'">已停止生成</div>
|
|
8
|
+
<div class="stopMsg" v-if="type !== 'error'">
|
|
9
|
+
停止输出
|
|
10
|
+
</div>
|
|
11
|
+
<div class="right-tools">
|
|
12
|
+
<el-tooltip content="赞" effect="light" placement="top">
|
|
13
|
+
<div class="tools-icon" @click="doZan(listData)">
|
|
14
|
+
<img src="../static/zan.png" alt="" v-if="listData.feedback !== 1">
|
|
15
|
+
<img alt="" src="../static/zan-active.png" v-else>
|
|
16
|
+
</div>
|
|
17
|
+
</el-tooltip>
|
|
18
|
+
<el-popover v-model="popover" placement="top-start" trigger="manual">
|
|
19
|
+
<div slot="reference">
|
|
20
|
+
<el-tooltip content="踩" effect="light" placement="bottom">
|
|
21
|
+
<div class="tools-icon" @click="openPopover" v-if="listData.feedback !== 2">
|
|
22
|
+
<img alt="" src="../static/cai.png">
|
|
23
|
+
</div>
|
|
24
|
+
<div class="tools-icon" v-else @click="doCai(listData)">
|
|
25
|
+
<img alt="" src="../static/cai-active.png">
|
|
26
|
+
</div>
|
|
27
|
+
</el-tooltip>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="popover-box">
|
|
30
|
+
<div class="pop-title">
|
|
31
|
+
你的反馈将 <br/>
|
|
32
|
+
帮助职教一问优化进步
|
|
33
|
+
</div>
|
|
34
|
+
<i class="el-icon-close" style="font-size: 2rem"
|
|
35
|
+
@click="cancelPopover()"></i>
|
|
36
|
+
<div class="error-list">
|
|
37
|
+
<el-checkbox-group v-model="errors">
|
|
38
|
+
<el-checkbox v-for="item in errorList"
|
|
39
|
+
:key="item.code"
|
|
40
|
+
:label="item.code"
|
|
41
|
+
border
|
|
42
|
+
class="check">
|
|
43
|
+
{{ item.name }}
|
|
44
|
+
</el-checkbox>
|
|
45
|
+
</el-checkbox-group>
|
|
46
|
+
<el-input v-model="input" :rows="4"
|
|
47
|
+
maxlength="30"
|
|
48
|
+
placeholder="其他"
|
|
49
|
+
resize="none"
|
|
50
|
+
type="textarea" />
|
|
51
|
+
<div class="sumit-button">
|
|
52
|
+
<el-button :disabled="canSubmit" @click="doCai(listData)">提交</el-button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</el-popover>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<script>
|
|
61
|
+
import {errorList} from "../utils/config";
|
|
62
|
+
import {setFeedback} from '../api/index';
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
name: 'ChatTools',
|
|
66
|
+
props: {
|
|
67
|
+
type: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'chart'
|
|
70
|
+
},
|
|
71
|
+
detailData: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: () => {}
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
data() {
|
|
77
|
+
return {
|
|
78
|
+
input: "",
|
|
79
|
+
popover: false,
|
|
80
|
+
errors: [],
|
|
81
|
+
errorList: errorList,
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
computed: {
|
|
85
|
+
canSubmit() {
|
|
86
|
+
return this.errors.length === 0 && this.input === "";
|
|
87
|
+
},
|
|
88
|
+
listData() {
|
|
89
|
+
return this.detailData;
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
cancelPopover() {
|
|
94
|
+
this.popover = false;
|
|
95
|
+
},
|
|
96
|
+
openPopover() {
|
|
97
|
+
this.popover = true;
|
|
98
|
+
},
|
|
99
|
+
reAnswer(list) {
|
|
100
|
+
this.$emit('on-reanswer', list);
|
|
101
|
+
},
|
|
102
|
+
async doZan(list) {
|
|
103
|
+
list.feedback = list.feedback === 1 ? 0 : 1;
|
|
104
|
+
const param = {
|
|
105
|
+
commentId: list.id,
|
|
106
|
+
feedbackId: list.feedbackId,
|
|
107
|
+
type: list.feedback,
|
|
108
|
+
}
|
|
109
|
+
list.feedbackId = await setFeedback(param);
|
|
110
|
+
this.$forceUpdate();
|
|
111
|
+
},
|
|
112
|
+
async doCai(list) {
|
|
113
|
+
let caiOption = {};
|
|
114
|
+
if (!list.cai) {
|
|
115
|
+
caiOption = {
|
|
116
|
+
desc: this.input,
|
|
117
|
+
tags: this.errors
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
list.feedback = list.feedback !== 2 ? 2 : 0;
|
|
121
|
+
const param = {
|
|
122
|
+
commentId: list.id,
|
|
123
|
+
feedbackId: list.feedbackId,
|
|
124
|
+
type: list.feedback,
|
|
125
|
+
}
|
|
126
|
+
list.feedbackId = await setFeedback(param, caiOption);
|
|
127
|
+
this.$forceUpdate();
|
|
128
|
+
if (list.feedback === 2) {
|
|
129
|
+
this.$message.success('感谢您的反馈');
|
|
130
|
+
}
|
|
131
|
+
this.popover = false;
|
|
132
|
+
this.input = '';
|
|
133
|
+
this.errors = [];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
<style lang="scss" scoped>
|
|
139
|
+
.robot-tools {
|
|
140
|
+
position: relative;
|
|
141
|
+
margin-top: 8px;
|
|
142
|
+
.robot-reanswer {
|
|
143
|
+
width: 104px;
|
|
144
|
+
height: 32px;
|
|
145
|
+
background-color: rgba(32, 40, 64, 0.078);
|
|
146
|
+
border-radius: 16px;
|
|
147
|
+
font-size: 13px;
|
|
148
|
+
text-align: center;
|
|
149
|
+
line-height: 32px;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
|
|
152
|
+
&:hover {
|
|
153
|
+
background: #ced0f0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
i {
|
|
157
|
+
font-size: 18px;
|
|
158
|
+
vertical-align: middle;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
.stopMsg {
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
height: 20px;
|
|
164
|
+
width: 100px;
|
|
165
|
+
font-size: 16px;
|
|
166
|
+
color: #316cff;
|
|
167
|
+
}
|
|
168
|
+
.tools-icon {
|
|
169
|
+
width: 40px;
|
|
170
|
+
height: 32px;
|
|
171
|
+
background-color: rgba(32, 40, 64, 0.078);
|
|
172
|
+
border-radius: 16px;
|
|
173
|
+
text-align: center;
|
|
174
|
+
line-height: 34px;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
margin-right: 8px;
|
|
177
|
+
|
|
178
|
+
&:hover {
|
|
179
|
+
background: #ced0f0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
.right-tools {
|
|
183
|
+
position: absolute;
|
|
184
|
+
right: 0;
|
|
185
|
+
top: 0;
|
|
186
|
+
display: flex;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
.popover-box {
|
|
190
|
+
width: 380px;
|
|
191
|
+
height: 450px;
|
|
192
|
+
border-radius: 20px;
|
|
193
|
+
padding: 20px;
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
position: relative;
|
|
196
|
+
|
|
197
|
+
.pop-title {
|
|
198
|
+
width: 220px;
|
|
199
|
+
height: 60px;
|
|
200
|
+
font-family: PingFangSC, PingFang SC;
|
|
201
|
+
font-weight: 500;
|
|
202
|
+
font-size: 22px;
|
|
203
|
+
color: #333333;
|
|
204
|
+
line-height: 30px;
|
|
205
|
+
text-align: left;
|
|
206
|
+
font-style: normal;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.el-icon-close {
|
|
210
|
+
position: absolute;
|
|
211
|
+
right: 0;
|
|
212
|
+
top: 0;
|
|
213
|
+
color: #333333;
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
transition: all 0.3s;
|
|
216
|
+
|
|
217
|
+
&:hover {
|
|
218
|
+
transform: rotate(-180deg);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.error-list {
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-wrap: wrap;
|
|
225
|
+
margin-top: 20px;
|
|
226
|
+
|
|
227
|
+
.el-textarea__inner {
|
|
228
|
+
resize: none;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.sumit-button {
|
|
232
|
+
margin-top: 20px;
|
|
233
|
+
margin-left: 114px;
|
|
234
|
+
|
|
235
|
+
.el-button {
|
|
236
|
+
width: 112px;
|
|
237
|
+
height: 42px;
|
|
238
|
+
background: linear-gradient(180deg, #5fa5ff 0%, #316cff 100%);
|
|
239
|
+
border-radius: 21px;
|
|
240
|
+
color: #fff;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
label {
|
|
245
|
+
text-align: center;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.check.is-bordered {
|
|
249
|
+
margin-right: 0;
|
|
250
|
+
width: 165px;
|
|
251
|
+
height: 42px;
|
|
252
|
+
background: #f3f7ff;
|
|
253
|
+
border-radius: 6px;
|
|
254
|
+
margin-left: 0;
|
|
255
|
+
margin-bottom: 10px;
|
|
256
|
+
|
|
257
|
+
&:nth-child(2n-1) {
|
|
258
|
+
margin-right: 10px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
::v-deep .el-checkbox__inner {
|
|
262
|
+
display: none;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
::v-deep .el-checkbox.is-bordered.is-checked {
|
|
268
|
+
border-color: #316cff;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
::v-deep .el-checkbox__input.is-checked+.el-checkbox__label {
|
|
272
|
+
color: #316cff;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
</style>
|