ai-assistant-pro 0.0.14 → 0.0.16
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/api/index.js +58 -2
- package/components/demo/plugins/Formula-show.js +52 -0
- package/components/demo/src/chat-tools.vue +17 -11
- package/components/demo/src/chat-type.vue +103 -0
- package/components/demo/src/chat.vue +225 -42
- package/components/demo/src/input-part.vue +324 -0
- package/components/demo/src/main.vue +170 -131
- package/components/demo/static/formula.png +0 -0
- package/components/demo/static/image-active.png +0 -0
- package/components/demo/static/image.png +0 -0
- package/components/demo/static/message-active.png +0 -0
- package/components/demo/static/message.png +0 -0
- package/components/demo/static/multimodal-active.png +0 -0
- package/components/demo/static/multimodal.png +0 -0
- package/components/demo/static/no-image.png +0 -0
- package/components/demo/static/translate-active.png +0 -0
- package/components/demo/static/translate.png +0 -0
- package/components/demo/utils/config.js +44 -1
- package/components/demo/utils/request.js +8 -0
- package/dist/ai-assistant-pro.common.js +31146 -7016
- package/dist/ai-assistant-pro.common.js.map +1 -1
- package/dist/ai-assistant-pro.css +1 -1
- package/dist/ai-assistant-pro.umd.js +31088 -6950
- package/dist/ai-assistant-pro.umd.js.map +1 -1
- package/dist/ai-assistant-pro.umd.min.js +152 -4
- package/dist/ai-assistant-pro.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 +6 -2
|
@@ -78,9 +78,10 @@ export const pustReanswerToTeacher = (params) => {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export const getDetailList = (resId) => {
|
|
81
|
+
export const getDetailList = (resId, aiId) => {
|
|
82
82
|
return request({
|
|
83
83
|
url: prefix + `/assistant/detail/v2/${resId}`,
|
|
84
|
+
params: { aiId },
|
|
84
85
|
method: 'get',
|
|
85
86
|
});
|
|
86
87
|
}
|
|
@@ -121,7 +122,13 @@ export async function getAutoQuestioning(iaId, message) {
|
|
|
121
122
|
messages: message,
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
/**
|
|
126
|
+
* 发起聊天接口(正常聊天)
|
|
127
|
+
* @param params 请求参数
|
|
128
|
+
* @param signal signal 对象
|
|
129
|
+
* @param onmessage 回调函数
|
|
130
|
+
* @returns 返回节点详情数据
|
|
131
|
+
* */
|
|
125
132
|
export async function sendMessageEventSource(params, signal, onmessage) {
|
|
126
133
|
return fetchEventSource(`${baseURL}${prefix}/assistant/conversation?token=${cache.session.getJSON('SRKJ_TOKEN_CACHE')}`, {
|
|
127
134
|
method: 'POST',
|
|
@@ -134,4 +141,53 @@ export async function sendMessageEventSource(params, signal, onmessage) {
|
|
|
134
141
|
body: JSON.stringify(params),
|
|
135
142
|
onmessage,
|
|
136
143
|
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 发起聊天接口(图文多模态翻译)
|
|
148
|
+
* @param params 请求参数
|
|
149
|
+
* @param signal signal 对象
|
|
150
|
+
* @param onmessage 回调函数
|
|
151
|
+
* @returns 返回节点详情数据
|
|
152
|
+
* */
|
|
153
|
+
export async function sendMessageMoreSource(params, signal, onmessage) {
|
|
154
|
+
return fetchEventSource(`${baseURL}${prefix}/assistant/qa/system-qa/stream?token=${cache.session.getJSON('SRKJ_TOKEN_CACHE')}`, {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
signal: signal,
|
|
157
|
+
openWhenHidden: true,
|
|
158
|
+
headers: {
|
|
159
|
+
'Content-Type': 'application/json',
|
|
160
|
+
},
|
|
161
|
+
body: JSON.stringify(params),
|
|
162
|
+
onmessage,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 自动追问
|
|
167
|
+
* @param params 请求参数
|
|
168
|
+
* @returns 返回节点详情数据
|
|
169
|
+
*/
|
|
170
|
+
export async function loopChatDetail(params) {
|
|
171
|
+
return request.post(`${prefix}/assistant/qa/get-session-dialog`, {
|
|
172
|
+
...params
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 获取前端上传的oss签名
|
|
178
|
+
*/
|
|
179
|
+
export async function getSignature(isPublic) {
|
|
180
|
+
return request.get(`${prefix}/getSignature`, { params: { isPublic: isPublic } });
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 上传oss(直接上传,不通过Nginx代理)
|
|
185
|
+
* @param uploadUrl
|
|
186
|
+
* @param params
|
|
187
|
+
*/
|
|
188
|
+
export async function uploadAction(uploadUrl, params) {
|
|
189
|
+
return request.post(uploadUrl, params, {
|
|
190
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
191
|
+
timeout: 30000000,
|
|
192
|
+
});
|
|
137
193
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export class FormulaShow { // JS 语法
|
|
2
|
+
constructor(parent) {
|
|
3
|
+
this.title = '编辑' // 自定义菜单标题
|
|
4
|
+
this.tag = 'button'
|
|
5
|
+
this.parent = parent;
|
|
6
|
+
}
|
|
7
|
+
// 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false
|
|
8
|
+
isActive(editor) { // JS 语法
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
// 获取菜单执行时的 value ,用不到则返回空 字符串或 false
|
|
12
|
+
getValue(editor) { // JS 语法
|
|
13
|
+
return ''
|
|
14
|
+
}
|
|
15
|
+
upDataParent(parent) {
|
|
16
|
+
this.parent = parent;
|
|
17
|
+
}
|
|
18
|
+
// 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false
|
|
19
|
+
isDisabled(editor) { // JS 语法
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
// 点击菜单时触发的函数
|
|
23
|
+
exec(editor, value) {
|
|
24
|
+
// Modal menu ,这个函数不用写,空着即可
|
|
25
|
+
const [currentValue] = editor.getFragment();
|
|
26
|
+
|
|
27
|
+
if (currentValue) {
|
|
28
|
+
this.parent.editFormula(currentValue.children[0].value);
|
|
29
|
+
} else {
|
|
30
|
+
console.log('currentValue ger error');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
// 弹出框 modal 的定位:1. 返回某一个 SlateNode; 2. 返回 null (根据当前选区自动定位)
|
|
35
|
+
getModalPositionNode(editor) { // JS 语法
|
|
36
|
+
return null // modal 依据选区定位
|
|
37
|
+
}
|
|
38
|
+
// 定义 modal 内部的 DOM Element
|
|
39
|
+
getModalContentElem(editor) { // JS 语法
|
|
40
|
+
const $content = $('<div></div>')
|
|
41
|
+
const $button = $('<button>do something</button>')
|
|
42
|
+
$content.append($button)
|
|
43
|
+
|
|
44
|
+
$button.on('click', () => {
|
|
45
|
+
editor.insertText(' hello ')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
return $content[0] // 返回 DOM Element 类型
|
|
49
|
+
|
|
50
|
+
// PS:也可以把 $content 缓存下来,这样不用每次重复创建、重复绑定事件,优化性能
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="robot-tools">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
<template v-if="activeKey === 'chat'">
|
|
4
|
+
<div class="robot-reanswer"
|
|
5
|
+
style="margin-bottom: 8px"
|
|
6
|
+
v-if="(listData.stop || listData.finish && !sending) && isLast"
|
|
7
|
+
@click="reAnswer(listData)">
|
|
8
|
+
<i class="el-icon-refresh-right"></i>
|
|
9
|
+
重新回答
|
|
10
|
+
</div>
|
|
11
|
+
<div class="stopMsg" style="color: #cfcfcf; cursor: default" v-if="listData.stop">已停止生成</div>
|
|
12
|
+
<div class="stopMsg"
|
|
13
|
+
@click="stopChat(listData)"
|
|
14
|
+
v-if="!listData.stop && !listData.finish && !sending">停止输出</div>
|
|
15
|
+
</template>
|
|
14
16
|
<div class="right-tools">
|
|
15
17
|
<el-tooltip content="赞" effect="light" placement="top">
|
|
16
18
|
<div class="tools-icon" @click="doZan(listData)">
|
|
@@ -90,6 +92,10 @@ export default {
|
|
|
90
92
|
type: Boolean,
|
|
91
93
|
default: false
|
|
92
94
|
},
|
|
95
|
+
activeKey: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: 'chat',
|
|
98
|
+
},
|
|
93
99
|
},
|
|
94
100
|
data() {
|
|
95
101
|
return {
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="chat-tab-wrap">
|
|
3
|
+
<div class="chat-tab-button-wrap"
|
|
4
|
+
:class="{'chat-tab-button-active': activeKey === 'chat'}">
|
|
5
|
+
<div class="chat-tab-button chat-button" @click="changeType('chat')"></div>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="chat-tab-button-wrap"
|
|
8
|
+
:class="{'chat-tab-button-active': activeKey === 'image'}">
|
|
9
|
+
<div class="chat-tab-button image-button" @click="changeType('image')"></div>
|
|
10
|
+
</div>
|
|
11
|
+
<!-- <div class="chat-tab-button-wrap"-->
|
|
12
|
+
<!-- :class="{'chat-tab-button-active': activeKey === 'translate'}">-->
|
|
13
|
+
<!-- <div class="chat-tab-button translate-button" @click="changeType('translate')"></div>-->
|
|
14
|
+
<!-- </div>-->
|
|
15
|
+
<!-- <div class="chat-tab-button-wrap"-->
|
|
16
|
+
<!-- :class="{'chat-tab-button-active': activeKey === 'multimodal'}">-->
|
|
17
|
+
<!-- <div class="chat-tab-button multimodal-button" @click="changeType('multimodal')"></div>-->
|
|
18
|
+
<!-- </div>-->
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
name: 'ChatType',
|
|
24
|
+
props: {
|
|
25
|
+
stop: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
activeKey: 'chat',
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
changeType(type) {
|
|
37
|
+
if (this.stop) {
|
|
38
|
+
this.$message.warning('对话正在进行中,请稍后重试');
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
this.activeKey = type;
|
|
42
|
+
this.$emit('on-type-change', type);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
<style lang="scss" scoped>
|
|
48
|
+
.chat-tab-wrap {
|
|
49
|
+
display: flex;
|
|
50
|
+
padding-top: 12px;
|
|
51
|
+
padding-right: 16px;
|
|
52
|
+
.chat-tab-button {
|
|
53
|
+
width: 24px;
|
|
54
|
+
height: 24px;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
display: inline-block;
|
|
57
|
+
}
|
|
58
|
+
.chat-tab-button-wrap {
|
|
59
|
+
width: 32px;
|
|
60
|
+
height: 32px;
|
|
61
|
+
border-radius: 12px;
|
|
62
|
+
background: transparent;
|
|
63
|
+
text-align: center;
|
|
64
|
+
line-height: 43px;
|
|
65
|
+
margin-right: 32px;
|
|
66
|
+
}
|
|
67
|
+
.chat-button {
|
|
68
|
+
background-image: url("../static/message.png");
|
|
69
|
+
background-size: 100%;
|
|
70
|
+
}
|
|
71
|
+
.image-button {
|
|
72
|
+
background-image: url("../static/image.png");
|
|
73
|
+
background-size: 100%;
|
|
74
|
+
}
|
|
75
|
+
.translate-button {
|
|
76
|
+
background-image: url("../static/translate.png");
|
|
77
|
+
background-size: 100%;
|
|
78
|
+
}
|
|
79
|
+
.multimodal-button {
|
|
80
|
+
background-image: url("../static/multimodal.png");
|
|
81
|
+
background-size: 100%;
|
|
82
|
+
}
|
|
83
|
+
.chat-tab-button-active {
|
|
84
|
+
background: linear-gradient(135deg, rgb(96, 160, 255) 0%, rgb(48, 96, 255) 100%);
|
|
85
|
+
.chat-button {
|
|
86
|
+
background-image: url("../static/message-active.png");
|
|
87
|
+
background-size: 100%;
|
|
88
|
+
}
|
|
89
|
+
.image-button {
|
|
90
|
+
background-image: url("../static/image-active.png");
|
|
91
|
+
background-size: 100%;
|
|
92
|
+
}
|
|
93
|
+
.translate-button {
|
|
94
|
+
background-image: url("../static/translate-active.png");
|
|
95
|
+
background-size: 100%;
|
|
96
|
+
}
|
|
97
|
+
.multimodal-button {
|
|
98
|
+
background-image: url("../static/multimodal-active.png");
|
|
99
|
+
background-size: 100%;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</style>
|