@nebulars/sseengine 1.3.54 → 1.3.56
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 +1 -1
- package/src/components/sse-answer/index.vue +3 -0
- package/src/components/sse-checken/index.vue +91 -0
- package/src/components/sse-hub/modify.less +4 -0
- package/src/components/sse-query/index.vue +3 -0
- package/src/components/sse-sharing/index.vue +60 -0
- package/src/store/index.js +12 -0
- package/src/store/snap.js +65 -0
- package/src/store/sse.js +4 -0
package/package.json
CHANGED
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
23
|
<section class="fqa-answer fqa-conversation" :answer-id="item.id" :x-trace-id="item.x_trace_id">
|
|
24
|
+
<!-- Sharing -->
|
|
25
|
+
<sse-sharing :id="item.id" type="answer" content="" />
|
|
26
|
+
|
|
24
27
|
<!-- Worry -->
|
|
25
28
|
<fqa-worry :source="$util.anxious(item)" :item="item" :type="item.type" :produce="sseengine.produce" v-model:compliance="item.compliance" :up="item.id" :rag="item.rag" :finally_status="item.finally_status" />
|
|
26
29
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<style lang="less" scoped>
|
|
2
|
+
.sse-checken {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
|
|
6
|
+
&-checkbox {
|
|
7
|
+
div {
|
|
8
|
+
top: 5px;
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="sse-checken">
|
|
17
|
+
<a-checkbox v-model:checked="checked" class="sse-checken-checkbox">
|
|
18
|
+
<div>全选</div>
|
|
19
|
+
</a-checkbox>
|
|
20
|
+
|
|
21
|
+
<a-space class="sse-checken-righter">
|
|
22
|
+
<a-button type="primary" @click="sharingHandler">确认分享并获取链接</a-button>
|
|
23
|
+
<a-button @click="cleanHandler">取消分享</a-button>
|
|
24
|
+
</a-space>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
computed: {
|
|
31
|
+
checked: {
|
|
32
|
+
// Get Checked
|
|
33
|
+
get() {
|
|
34
|
+
// Get $
|
|
35
|
+
const { $ } = this.$util;
|
|
36
|
+
|
|
37
|
+
// Get Count
|
|
38
|
+
const [checkCount, truthCount] = [$('[data-checked]').length, this.$store.state.sseengine.choosen.length];
|
|
39
|
+
|
|
40
|
+
console.log(40, checkCount, truthCount);
|
|
41
|
+
|
|
42
|
+
// Checked Count
|
|
43
|
+
return truthCount > 0 && checkCount === truthCount;
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// Set Checked
|
|
47
|
+
async set(checked) {
|
|
48
|
+
// Get $
|
|
49
|
+
const { $ } = this.$util;
|
|
50
|
+
|
|
51
|
+
// All
|
|
52
|
+
if (checked) {
|
|
53
|
+
// Get Snaps
|
|
54
|
+
const snaps = $('[data-checked]')
|
|
55
|
+
.map((_, e) => $(e).data())
|
|
56
|
+
.get();
|
|
57
|
+
|
|
58
|
+
// Checked All
|
|
59
|
+
await this.$store.dispatch('sseengine/SNAP_ALL', snaps);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Empty
|
|
63
|
+
else {
|
|
64
|
+
await this.$store.dispatch('sseengine/SNAP_CLEAN');
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
methods: {
|
|
71
|
+
async sharingHandler() {
|
|
72
|
+
if (!this.$store.state.sseengine.choosen.length) {
|
|
73
|
+
return this.$util.toast.info('请选择问题');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const link = await this.$store.dispatch('sseengine/SNAP_SHARING', { session_id: this.app.id, title: this.sseengine.info.title });
|
|
77
|
+
|
|
78
|
+
// Copy
|
|
79
|
+
await this.$util.copy(link);
|
|
80
|
+
|
|
81
|
+
// Toast
|
|
82
|
+
await this.$util.toast.success('链接已复制');
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
async cleanHandler() {
|
|
86
|
+
await this.$store.dispatch('sseengine/SSE_MODE');
|
|
87
|
+
await this.$store.dispatch('sseengine/SNAP_CLEAN');
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
@@ -78,6 +78,9 @@
|
|
|
78
78
|
|
|
79
79
|
<template>
|
|
80
80
|
<section class="fqa-query fqa-conversation" :query-id="item.id" :x-trace-id="item.x_trace_id" @mouseenter.stop="enterHandler" @mouseleave.stop="leaveHandler">
|
|
81
|
+
<!-- Sharing -->
|
|
82
|
+
<sse-sharing :id="item.id" type="query" content="" />
|
|
83
|
+
|
|
81
84
|
<!-- Editable -->
|
|
82
85
|
<div class="fqa-query-editable" v-if="editable && !sseengine.produce">
|
|
83
86
|
<a-textarea class="fqa-query-input" :auto-size="{ minRows: 3, maxRows: 10 }" v-model:value="origin" @press-enter="e => enterHandler(e, item)" />
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<style lang="less" scoped>
|
|
2
|
+
.sse-sharing {
|
|
3
|
+
top: @space;
|
|
4
|
+
left: -@space;
|
|
5
|
+
position: absolute;
|
|
6
|
+
}
|
|
7
|
+
</style>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="sse-sharing" v-if="sseengine.mode === 'snap'">
|
|
11
|
+
<a-checkbox v-model:checked="checked" :data-checked="checked" :data-id="id" :data-type="type" :data-content="content"></a-checkbox>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
props: {
|
|
18
|
+
id: {
|
|
19
|
+
type: [String],
|
|
20
|
+
default: '',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
type: {
|
|
24
|
+
type: [String],
|
|
25
|
+
default: 'root',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
content: {
|
|
29
|
+
type: [String],
|
|
30
|
+
default: '',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
computed: {
|
|
35
|
+
checked: {
|
|
36
|
+
// Get Checked
|
|
37
|
+
get() {
|
|
38
|
+
return this.$store.state.sseengine.choosen.some(item => item.id === this.id);
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Set Checked
|
|
42
|
+
async set(checked) {
|
|
43
|
+
// Add
|
|
44
|
+
if (checked) {
|
|
45
|
+
await this.$store.dispatch('sseengine/SNAP_ADD', {
|
|
46
|
+
id: this.id,
|
|
47
|
+
type: this.type,
|
|
48
|
+
content: this.content,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Delete
|
|
53
|
+
else {
|
|
54
|
+
await this.$store.dispatch('sseengine/SNAP_DELETE', this.id);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|
package/src/store/index.js
CHANGED
|
@@ -19,6 +19,9 @@ import { default as SUP } from './sup';
|
|
|
19
19
|
// Use Tub
|
|
20
20
|
import { default as TUB } from './tub';
|
|
21
21
|
|
|
22
|
+
// Use Snap
|
|
23
|
+
import { default as SNAP } from './snap';
|
|
24
|
+
|
|
22
25
|
// Use Session
|
|
23
26
|
import { default as SESSION } from './session';
|
|
24
27
|
|
|
@@ -53,6 +56,9 @@ export default (proxy = {}) => {
|
|
|
53
56
|
25000: '模型似乎遇到了问题,请重试~', // '回复失败/错误/无回复',
|
|
54
57
|
},
|
|
55
58
|
|
|
59
|
+
// Mode of Sharing
|
|
60
|
+
mode: 'sse',
|
|
61
|
+
|
|
56
62
|
// Code for Status
|
|
57
63
|
code: 0,
|
|
58
64
|
|
|
@@ -145,6 +151,9 @@ export default (proxy = {}) => {
|
|
|
145
151
|
|
|
146
152
|
// Snap
|
|
147
153
|
snap: '',
|
|
154
|
+
|
|
155
|
+
// Snap Choosen
|
|
156
|
+
choosen: [],
|
|
148
157
|
};
|
|
149
158
|
|
|
150
159
|
// Reset
|
|
@@ -184,6 +193,9 @@ export default (proxy = {}) => {
|
|
|
184
193
|
// Tub
|
|
185
194
|
...TUB(proxy),
|
|
186
195
|
|
|
196
|
+
// Snap
|
|
197
|
+
...SNAP(proxy),
|
|
198
|
+
|
|
187
199
|
// One Session
|
|
188
200
|
...SESSION(proxy),
|
|
189
201
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export default ({ http, link }) => {
|
|
2
|
+
return {
|
|
3
|
+
async SNAP_MODE({}, mode = 'snap') {
|
|
4
|
+
return { mode };
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
async SNAP_CHECK({ state }, id) {
|
|
8
|
+
return state.choosen.find(item => item.id === id) || null;
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
async SNAP_ADD({ state, dispatch }, item) {
|
|
12
|
+
if (await dispatch('SNAP_CHECK', item.id)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Get Choosen
|
|
17
|
+
const { choosen } = state;
|
|
18
|
+
|
|
19
|
+
// Add Item into Choosen
|
|
20
|
+
choosen.push(item);
|
|
21
|
+
|
|
22
|
+
// Update Choosen
|
|
23
|
+
return { choosen };
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
async SNAP_DELETE({ state }, id) {
|
|
27
|
+
// Get Choosen
|
|
28
|
+
const { choosen } = state;
|
|
29
|
+
|
|
30
|
+
// Get Index
|
|
31
|
+
const index = choosen.findIndex(item => item.id === id);
|
|
32
|
+
|
|
33
|
+
// No Index
|
|
34
|
+
if (~index) {
|
|
35
|
+
choosen.splice(index, 1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Update Choosen
|
|
39
|
+
return { choosen };
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
async SNAP_ALL({ dispatch }, group = []) {
|
|
43
|
+
group.forEach(async item => await dispatch('SNAP_ADD', item));
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
async SNAP_CLEAN({ state }) {
|
|
47
|
+
// Set Empty Choosen
|
|
48
|
+
const choosen = [];
|
|
49
|
+
|
|
50
|
+
// Update Choosen
|
|
51
|
+
return { choosen };
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async SNAP_SHARING({ state }, { session_id, title }) {
|
|
55
|
+
// Get Choosen
|
|
56
|
+
const { choosen: snapshot_data } = state;
|
|
57
|
+
|
|
58
|
+
// Create Sharing
|
|
59
|
+
const { data } = await http.api.shareCreateShare({ session_id, title, snapshot_data });
|
|
60
|
+
|
|
61
|
+
// Get Link ID
|
|
62
|
+
return link(`/snapshot?c=${data}`);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|