@nebulars/sseengine 1.3.108 → 1.3.110
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/package.json +2 -2
- package/src/components/sse-answer/index.vue +4 -1
- package/src/components/sse-chat/index.vue +38 -3
- package/src/components/sse-feedback/index.vue +13 -2
- package/src/components/sse-hots/index.vue +1 -0
- package/src/components/sse-reply/index.vue +170 -0
- package/src/store/index.js +6 -0
- package/src/store/reply.js +8 -0
- package/src/store/tub.js +23 -9
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulars/sseengine",
|
|
3
3
|
"description": "An engine for sse",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.110",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "forage serve --name sseengine",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"axios": "^1.11.0",
|
|
20
20
|
"vuex-fast": "^2.2.2"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "002fbb7fcff5ddba21df5bb5f92b911a14c01928"
|
|
23
23
|
}
|
|
@@ -67,7 +67,10 @@
|
|
|
67
67
|
</template>
|
|
68
68
|
|
|
69
69
|
<!-- Feedback -->
|
|
70
|
-
<sse-feedback :id="item.id" v-model:feedback="item.feedback" :visible="!sseengine.produce" />
|
|
70
|
+
<sse-feedback :id="item.id" v-model:feedback="item.feedback" v-model:open="item.open" :visible="!sseengine.produce" />
|
|
71
|
+
|
|
72
|
+
<!-- Reply -->
|
|
73
|
+
<sse-reply :id="item.id" :feedback="item.feedback" v-model:open="item.open" />
|
|
71
74
|
|
|
72
75
|
<!-- Next -->
|
|
73
76
|
<sse-recursion v-if="item.children.length" :source="item.children" :active="active" />
|
|
@@ -116,11 +116,14 @@ export default {
|
|
|
116
116
|
},
|
|
117
117
|
|
|
118
118
|
async tubHandler({ target }) {
|
|
119
|
+
// Get Cash
|
|
120
|
+
const { $, closest } = this.$util;
|
|
121
|
+
|
|
119
122
|
// Get Container
|
|
120
|
-
const container =
|
|
123
|
+
const container = closest(target, '.markdown-table-ops', true);
|
|
121
124
|
|
|
122
125
|
// Get Element by Closest
|
|
123
|
-
const element =
|
|
126
|
+
const element = closest(target, '[data-event]', true);
|
|
124
127
|
|
|
125
128
|
// No Element
|
|
126
129
|
if (!container || !element) return;
|
|
@@ -135,7 +138,39 @@ export default {
|
|
|
135
138
|
const markdown = snap ? decodeURIComponent(snap) : null;
|
|
136
139
|
|
|
137
140
|
// Get Table
|
|
138
|
-
|
|
141
|
+
let { nextSibling: table } = container;
|
|
142
|
+
|
|
143
|
+
// Tolerance Table
|
|
144
|
+
if (!table) {
|
|
145
|
+
table = $(closest(container, '.ant-modal-body')).find('table').get(0);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Get Query and Title
|
|
149
|
+
let { query, title } = table.dataset;
|
|
150
|
+
|
|
151
|
+
// No Query
|
|
152
|
+
if (!query) {
|
|
153
|
+
// Get Wrapper
|
|
154
|
+
const wrapper = closest(table, '[query-id]', true);
|
|
155
|
+
|
|
156
|
+
// Get Query ID
|
|
157
|
+
query = wrapper.getAttribute('query-id');
|
|
158
|
+
|
|
159
|
+
// Set Data
|
|
160
|
+
table.setAttribute('data-query', query);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// No Title
|
|
164
|
+
if (!title) {
|
|
165
|
+
// Get Wrapper
|
|
166
|
+
const wrapper = closest(table, '[query-id]', true);
|
|
167
|
+
|
|
168
|
+
// Get Title
|
|
169
|
+
title = $(wrapper).find('.fqa-query-content').html();
|
|
170
|
+
|
|
171
|
+
// Set Data
|
|
172
|
+
table.setAttribute('data-title', title);
|
|
173
|
+
}
|
|
139
174
|
|
|
140
175
|
// Trigger Action
|
|
141
176
|
await this.$store.dispatch(`sseengine/TUB_${namespace}`, { table, markdown });
|
|
@@ -88,6 +88,11 @@ export default {
|
|
|
88
88
|
type: [Boolean],
|
|
89
89
|
default: false,
|
|
90
90
|
},
|
|
91
|
+
|
|
92
|
+
open: {
|
|
93
|
+
type: [Boolean],
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
91
96
|
},
|
|
92
97
|
|
|
93
98
|
data() {
|
|
@@ -114,8 +119,11 @@ export default {
|
|
|
114
119
|
// Get Markdown
|
|
115
120
|
const { html } = await this.context(e);
|
|
116
121
|
|
|
122
|
+
// Remove Footage
|
|
123
|
+
const footage = html.replace(/\[\d+\]/g, '');
|
|
124
|
+
|
|
117
125
|
// Add to Copy
|
|
118
|
-
await this.$util.copy(
|
|
126
|
+
await this.$util.copy(footage);
|
|
119
127
|
|
|
120
128
|
// Toast
|
|
121
129
|
await this.$util.toast.success('已复制到剪贴板');
|
|
@@ -159,8 +167,11 @@ export default {
|
|
|
159
167
|
|
|
160
168
|
// Success
|
|
161
169
|
if (status === 'success') {
|
|
162
|
-
// Update
|
|
170
|
+
// Update Feedback
|
|
163
171
|
this.$emit('update:feedback', feedback);
|
|
172
|
+
|
|
173
|
+
// Update Open
|
|
174
|
+
this.$emit('update:open', !!feedback);
|
|
164
175
|
}
|
|
165
176
|
},
|
|
166
177
|
},
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<style lang="less" scoped>
|
|
2
|
+
.sse-reply {
|
|
3
|
+
background-color: white;
|
|
4
|
+
padding: @gap;
|
|
5
|
+
border-radius: @radiu;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
&-container {
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-input {
|
|
13
|
+
width: calc(100% - 60px - @gap);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-submit {
|
|
17
|
+
width: 60px;
|
|
18
|
+
right: @gap;
|
|
19
|
+
bottom: @gap;
|
|
20
|
+
position: absolute;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-close {
|
|
24
|
+
top: @gap;
|
|
25
|
+
right: @gap;
|
|
26
|
+
position: absolute;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div class="sse-reply" v-if="open">
|
|
33
|
+
<a-space direction="vertical" class="sse-reply-container">
|
|
34
|
+
<div class="sse-reply-title">
|
|
35
|
+
<span>{{ titles[active] }}</span>
|
|
36
|
+
<span v-if="feedback === 2"></span>
|
|
37
|
+
</div>
|
|
38
|
+
<div></div>
|
|
39
|
+
<div class="sse-reply-select">
|
|
40
|
+
<a-checkbox-group v-model:value="reply" :options="replies[active]" />
|
|
41
|
+
</div>
|
|
42
|
+
<div class="sse-reply-remark" v-if="other">
|
|
43
|
+
<a-input class="sse-reply-input" v-model:value="remark" placeholder="(可选)告诉我们更多关于你的使用体验" />
|
|
44
|
+
</div>
|
|
45
|
+
</a-space>
|
|
46
|
+
|
|
47
|
+
<a-button type="primary" class="sse-reply-submit" @click="submit">提交</a-button>
|
|
48
|
+
|
|
49
|
+
<fqa-icon icon="CloseOutlined" class="sse-reply-close" @click="close" />
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
export default {
|
|
55
|
+
props: {
|
|
56
|
+
id: {
|
|
57
|
+
type: [String],
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
60
|
+
feedback: {
|
|
61
|
+
type: [Number, String],
|
|
62
|
+
default: 0,
|
|
63
|
+
},
|
|
64
|
+
open: {
|
|
65
|
+
type: [Boolean],
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
titles: [
|
|
73
|
+
// 1 as 0
|
|
74
|
+
'你觉得什么让你满意?',
|
|
75
|
+
// 2 as 1
|
|
76
|
+
'你觉得什么让你不满意?',
|
|
77
|
+
],
|
|
78
|
+
replies: [
|
|
79
|
+
// 1 as 0
|
|
80
|
+
[
|
|
81
|
+
{ label: '内容准确', value: '内容准确' },
|
|
82
|
+
{ label: '内容完善', value: '内容完善' },
|
|
83
|
+
{ label: '数据准确', value: '数据准确' },
|
|
84
|
+
{ label: '逻辑清晰', value: '逻辑清晰' },
|
|
85
|
+
{ label: '其他', value: 0 },
|
|
86
|
+
],
|
|
87
|
+
// 2 as 1
|
|
88
|
+
[
|
|
89
|
+
{ label: '没有帮助', value: '没有帮助' },
|
|
90
|
+
{ label: '内容不完善', value: '内容不完善' },
|
|
91
|
+
{ label: '数据不准确', value: '数据不准确' },
|
|
92
|
+
{ label: '逻辑不清晰', value: '逻辑不清晰' },
|
|
93
|
+
{ label: '其他', value: 0 },
|
|
94
|
+
],
|
|
95
|
+
],
|
|
96
|
+
reply: [],
|
|
97
|
+
remark: '',
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
watch: {
|
|
102
|
+
feedback: {
|
|
103
|
+
handler(value) {
|
|
104
|
+
this.reset();
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
deep: true,
|
|
108
|
+
immediate: true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
computed: {
|
|
113
|
+
active() {
|
|
114
|
+
return this.feedback - 1;
|
|
115
|
+
},
|
|
116
|
+
other() {
|
|
117
|
+
return this.reply.includes(0);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
methods: {
|
|
122
|
+
reset() {
|
|
123
|
+
this.reply = [];
|
|
124
|
+
this.other = false;
|
|
125
|
+
this.remark = '';
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
async submit() {
|
|
129
|
+
// Set Cloner
|
|
130
|
+
const cloner = [...this.reply];
|
|
131
|
+
|
|
132
|
+
// Get Has
|
|
133
|
+
const has = cloner.includes(0);
|
|
134
|
+
|
|
135
|
+
// Check Has
|
|
136
|
+
if (has) {
|
|
137
|
+
// Get Remark
|
|
138
|
+
const remark = this.remark.replace(/^\s+|\s+$/g, '');
|
|
139
|
+
|
|
140
|
+
// Check Empty
|
|
141
|
+
if (!remark.length) {
|
|
142
|
+
return this.$util.toast.info('提交信息不能为空');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Update
|
|
146
|
+
cloner[cloner.length - 1] = this.remark;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Submit
|
|
150
|
+
const success = await this.$store.dispatch('sseengine/REPLY_SUBMIT', { answer_id: this.id, type: this.feedback, feedback_content: cloner.join(',') });
|
|
151
|
+
|
|
152
|
+
// Close
|
|
153
|
+
this.$emit('update:open', false);
|
|
154
|
+
|
|
155
|
+
// Update Open
|
|
156
|
+
if (success) {
|
|
157
|
+
this.$util.toast.success('反馈成功');
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
close() {
|
|
162
|
+
// Reset
|
|
163
|
+
this.reset();
|
|
164
|
+
|
|
165
|
+
// Close
|
|
166
|
+
this.$emit('update:open', false);
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
</script>
|
package/src/store/index.js
CHANGED
|
@@ -25,6 +25,9 @@ import { default as SNAP } from './snap';
|
|
|
25
25
|
// Use Hots
|
|
26
26
|
import { default as HOTS } from './hots';
|
|
27
27
|
|
|
28
|
+
// Use Reply
|
|
29
|
+
import { default as REPLY } from './reply';
|
|
30
|
+
|
|
28
31
|
// Use Session
|
|
29
32
|
import { default as SESSION } from './session';
|
|
30
33
|
|
|
@@ -205,6 +208,9 @@ export default (proxy = {}) => {
|
|
|
205
208
|
// Snap
|
|
206
209
|
...SNAP(proxy),
|
|
207
210
|
|
|
211
|
+
// Reply
|
|
212
|
+
...REPLY(proxy),
|
|
213
|
+
|
|
208
214
|
// Hots
|
|
209
215
|
...HOTS(proxy),
|
|
210
216
|
|
package/src/store/tub.js
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
export default ({ http, closest, copy, toimg, download, excel, time, toast, blob, $ }) => {
|
|
2
2
|
return {
|
|
3
3
|
async TUB_FULLSCREEN({ state }, { table }) {
|
|
4
|
+
// The Table
|
|
5
|
+
const tabler = $(table);
|
|
6
|
+
|
|
4
7
|
// Set Cloner
|
|
5
|
-
const cloner =
|
|
8
|
+
const cloner = tabler.clone().prop('outerHTML');
|
|
9
|
+
|
|
10
|
+
// Set Ops
|
|
11
|
+
const operat = tabler.prev().clone();
|
|
12
|
+
|
|
13
|
+
// Insert
|
|
14
|
+
const out = setTimeout(() => {
|
|
15
|
+
// Get Dom
|
|
16
|
+
const container = $('#fullscreen-operat');
|
|
17
|
+
|
|
18
|
+
// Sync Space
|
|
19
|
+
container.width(tabler.outerWidth());
|
|
20
|
+
|
|
21
|
+
// Clean Dom and Insert
|
|
22
|
+
container.empty().append(operat);
|
|
23
|
+
|
|
24
|
+
// Clear Timeout
|
|
25
|
+
clearTimeout(out);
|
|
26
|
+
}, 600);
|
|
6
27
|
|
|
7
28
|
// Set Fullscreen
|
|
8
29
|
const fullscreen = true;
|
|
@@ -76,15 +97,8 @@ export default ({ http, closest, copy, toimg, download, excel, time, toast, blob
|
|
|
76
97
|
// Set Book
|
|
77
98
|
excel.utils.book_append_sheet(book, sheet, 'Gold Data');
|
|
78
99
|
|
|
79
|
-
// Get ID
|
|
80
|
-
// const query = closest(table, '[query-id]', true).getAttribute('query-id');
|
|
81
|
-
// const answer = closest(table, '[answer-id]', true).getAttribute('answer-id');
|
|
82
|
-
|
|
83
|
-
// Get Query
|
|
84
|
-
const query = closest(table, '[query-id]', true);
|
|
85
|
-
|
|
86
100
|
// Get Title from Query
|
|
87
|
-
const title =
|
|
101
|
+
const title = table.dataset.title;
|
|
88
102
|
|
|
89
103
|
// Get Time
|
|
90
104
|
const fmt = time.Format(new Date(), 'YYYY-MM-DD');
|