ai-assistant-pro 0.0.13 → 0.0.15
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 +39 -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 +169 -43
- package/components/demo/src/main.vue +266 -80
- 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 +23 -0
- package/dist/ai-assistant-pro.common.js +23464 -192
- 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 +23456 -176
- 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
|
@@ -6,67 +6,99 @@
|
|
|
6
6
|
<img src="../static/logo.png" alt="" style="width: 48px; height: 48px">
|
|
7
7
|
<span class="title-font">学习助手</span>
|
|
8
8
|
</div>
|
|
9
|
-
<div class="
|
|
10
|
-
<
|
|
9
|
+
<div class="operator-wrap">
|
|
10
|
+
<chat-type @on-type-change="changeType" :stop="stop"></chat-type>
|
|
11
|
+
<div class="icon-close" @click="closeMessage">
|
|
12
|
+
<i class="el-icon-close"></i>
|
|
13
|
+
</div>
|
|
11
14
|
</div>
|
|
12
15
|
</div>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
16
|
+
<template v-if="courseFlag">
|
|
17
|
+
<div class="ai-main-content">
|
|
18
|
+
<hot-search v-show="!chatShow"
|
|
19
|
+
:resId="resId"
|
|
20
|
+
@select-module="selectModule"
|
|
21
|
+
@init-info="initInfo"/>
|
|
22
|
+
<chat v-if="chatShow"
|
|
23
|
+
ref="chatRef"
|
|
24
|
+
:activeKey="activeKey"
|
|
25
|
+
:resId="resId"
|
|
26
|
+
:open-course-id="openCourseId"
|
|
27
|
+
:chatId="chatId"
|
|
28
|
+
:key-word="aiMessageKeyWord"
|
|
29
|
+
:message-data="messageList"
|
|
30
|
+
:chat-major-id="chatMajorId"
|
|
31
|
+
:show-more-q-a="showMoreQA"
|
|
32
|
+
:show-file="showFile"
|
|
33
|
+
@on-reanser="reanserMethod"
|
|
34
|
+
@on-message-finish="messageFinish"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="tools-wrap">
|
|
38
|
+
<span @click="addNewChat" v-if="activeKey === 'chat'">新增对话</span>
|
|
39
|
+
<span @click="clearChat">清空对话</span>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="ai-message-send" @keyup.enter="goChat">
|
|
42
|
+
<el-popover
|
|
43
|
+
v-if="activeKey === 'chat'"
|
|
44
|
+
popper-class="srkj-tools-agent-content"
|
|
45
|
+
placement="top-start"
|
|
46
|
+
v-model="formulaVisible"
|
|
47
|
+
>
|
|
48
|
+
<div class="agent-list-container" style="width: 782px; height: 420px">
|
|
49
|
+
<iframe :src="`https://zjyw.icve.com.cn/kityformula-editor/kityFormula.html?c=${formulaValue}`"
|
|
50
|
+
ref="editorFrame"
|
|
51
|
+
class="iframe-editor">
|
|
52
|
+
</iframe>
|
|
53
|
+
<el-button type="primary" class="save-button" @click="saveFormula">保存</el-button>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="formula" slot="reference" ref="formulaBtn" @click="formulaValue = ''"></div>
|
|
56
|
+
</el-popover>
|
|
57
|
+
<Editor
|
|
58
|
+
v-if="resizeInput"
|
|
59
|
+
class="editor-input"
|
|
60
|
+
v-model="aiMessage"
|
|
61
|
+
:defaultConfig="editorConfig"
|
|
62
|
+
:mode="mode"
|
|
63
|
+
@onCreated="onCreated"
|
|
64
|
+
/>
|
|
65
|
+
<div class="ai-send-icon" @click="goChat">
|
|
66
|
+
<img src="../static/send-icon.png" alt="" style="width: 24px; height: 24px">
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
<div v-if="!courseFlag" class="message-wrap">
|
|
71
|
+
<div class="message-line">{{message}}</div>
|
|
72
|
+
<div class="message-line">不能交流</div>
|
|
47
73
|
</div>
|
|
48
|
-
<!-- <p class="disclaimer">-->
|
|
49
|
-
<!-- 此功能公测期间对正式版用户开放-->
|
|
50
|
-
<!-- </p>-->
|
|
51
|
-
</template>
|
|
52
|
-
<div v-if="!courseFlag" class="message-wrap">
|
|
53
|
-
<div class="message-line">{{message}}</div>
|
|
54
|
-
<div class="message-line">不能交流</div>
|
|
55
|
-
</div>
|
|
56
74
|
</div>
|
|
57
75
|
</template>
|
|
58
76
|
<script>
|
|
59
77
|
import HotSearch from './hot-search.vue';
|
|
60
78
|
import Chat from './chat.vue';
|
|
61
79
|
import Cookies from "js-cookie";
|
|
80
|
+
import ChatType from "./chat-type.vue";
|
|
62
81
|
import { marked } from 'marked';
|
|
63
|
-
import {
|
|
82
|
+
import { Editor } from '@wangeditor/editor-for-vue'
|
|
83
|
+
import formulaModule from "@wangeditor/plugin-formula"
|
|
84
|
+
import { Boot, DomEditor, SlateTransforms } from "@wangeditor/editor";
|
|
85
|
+
import { getUserInfo, editorCurrentData } from '../utils/config';
|
|
64
86
|
import { newChat, chartClear, getDetailList, countAccess,checkCourseIdIsExist } from '../api/index';
|
|
87
|
+
import { FormulaShow } from '../plugins/Formula-show';
|
|
88
|
+
const formulaInstance = new FormulaShow();
|
|
89
|
+
const formulaShow = {
|
|
90
|
+
key: 'formulaShow', // 定义 menu key :要保证唯一、不重复(重要)
|
|
91
|
+
factory() {
|
|
92
|
+
return formulaInstance // 把 `YourMenuClass` 替换为你菜单的 class
|
|
93
|
+
},
|
|
94
|
+
}
|
|
65
95
|
export default {
|
|
66
96
|
name: 'AiAssistant',
|
|
67
97
|
components: {
|
|
68
98
|
HotSearch,
|
|
69
|
-
Chat
|
|
99
|
+
Chat,
|
|
100
|
+
ChatType,
|
|
101
|
+
Editor
|
|
70
102
|
},
|
|
71
103
|
props: {
|
|
72
104
|
visible: true,
|
|
@@ -82,17 +114,21 @@ export default {
|
|
|
82
114
|
watch: {
|
|
83
115
|
visible() {
|
|
84
116
|
if (this.visible){
|
|
117
|
+
this.activeKey = 'chat';
|
|
85
118
|
checkCourseIdIsExist(this.resId).then(res=>{
|
|
86
119
|
if (res.flag ==true){
|
|
87
120
|
this.courseFlag = true;
|
|
88
121
|
this.queryList();
|
|
122
|
+
countAccess(this.resId);
|
|
89
123
|
}else{
|
|
90
124
|
this.courseFlag = false;
|
|
91
125
|
this.message = res.message;
|
|
92
126
|
}
|
|
93
127
|
});
|
|
128
|
+
this.registerLatex();
|
|
129
|
+
} else {
|
|
130
|
+
this.unloadLatex();
|
|
94
131
|
}
|
|
95
|
-
|
|
96
132
|
},
|
|
97
133
|
},
|
|
98
134
|
data() {
|
|
@@ -108,6 +144,26 @@ export default {
|
|
|
108
144
|
chatMajorId: '',
|
|
109
145
|
showMoreQA: false,
|
|
110
146
|
showFile: false,
|
|
147
|
+
activeKey: 'chat',
|
|
148
|
+
chartIdType: {
|
|
149
|
+
chat: undefined,
|
|
150
|
+
image: undefined,
|
|
151
|
+
translate: undefined,
|
|
152
|
+
multimodal: undefined
|
|
153
|
+
},
|
|
154
|
+
formulaVisible: false,
|
|
155
|
+
formulaValue : '',
|
|
156
|
+
// wangEditor
|
|
157
|
+
editorConfig: {
|
|
158
|
+
placeholder: '可以提出问题...',
|
|
159
|
+
hoverbarKeys: {
|
|
160
|
+
formula: {
|
|
161
|
+
menuKeys: ['formulaShow'], // “编辑公式”菜单
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
mode: 'simple',
|
|
166
|
+
resizeInput: true,
|
|
111
167
|
}
|
|
112
168
|
},
|
|
113
169
|
mounted() {
|
|
@@ -116,6 +172,14 @@ export default {
|
|
|
116
172
|
}
|
|
117
173
|
this.messageList = [];
|
|
118
174
|
getUserInfo(Cookies.get("token"));
|
|
175
|
+
// 更新传入的 vue 实例
|
|
176
|
+
formulaInstance.upDataParent(this);
|
|
177
|
+
try {
|
|
178
|
+
Boot.registerMenu(formulaShow);
|
|
179
|
+
Boot.registerModule(formulaModule);
|
|
180
|
+
} catch (e) {
|
|
181
|
+
// 重复注册问题
|
|
182
|
+
}
|
|
119
183
|
},
|
|
120
184
|
methods: {
|
|
121
185
|
closeMessage() {
|
|
@@ -124,6 +188,9 @@ export default {
|
|
|
124
188
|
}
|
|
125
189
|
this.$emit('close');
|
|
126
190
|
},
|
|
191
|
+
onCreated(editor) {
|
|
192
|
+
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
|
|
193
|
+
},
|
|
127
194
|
selectModule(hotKey) {
|
|
128
195
|
this.chatShow = true;
|
|
129
196
|
this.aiMessage = hotKey;
|
|
@@ -132,9 +199,8 @@ export default {
|
|
|
132
199
|
showHot() {
|
|
133
200
|
this.chatShow = false;
|
|
134
201
|
},
|
|
135
|
-
async queryList() {
|
|
136
|
-
|
|
137
|
-
const listRes = await getDetailList(this.resId);
|
|
202
|
+
async queryList(type) {
|
|
203
|
+
const listRes = await getDetailList(this.resId, type);
|
|
138
204
|
if (!listRes || listRes.length < 1) return;
|
|
139
205
|
let currentList = listRes[0].contents.reverse();
|
|
140
206
|
const { chatMajorId } = listRes[0];
|
|
@@ -149,9 +215,16 @@ export default {
|
|
|
149
215
|
}
|
|
150
216
|
});
|
|
151
217
|
}
|
|
218
|
+
let message = list.content;
|
|
219
|
+
if (this.activeKey === 'chat') {
|
|
220
|
+
message = list.role === 'assistant' ? marked.parse(list.content || '') : list.content.replace(/\n/g, '<br>')
|
|
221
|
+
}
|
|
222
|
+
if (this.activeKey === 'image' || this.activeKey === 'translate') {
|
|
223
|
+
message = list.content || ','
|
|
224
|
+
}
|
|
152
225
|
const obj = {
|
|
153
226
|
type: list.role === 'assistant' ? 'robot' : 'user',
|
|
154
|
-
message
|
|
227
|
+
message,
|
|
155
228
|
zan: list.type === 1,
|
|
156
229
|
cai: list.type === 2,
|
|
157
230
|
stop: list.status === 1,
|
|
@@ -165,13 +238,18 @@ export default {
|
|
|
165
238
|
};
|
|
166
239
|
cacheArray.push(obj);
|
|
167
240
|
})
|
|
168
|
-
if (currentList[0])
|
|
241
|
+
if (currentList[0]) {
|
|
242
|
+
this.chatId = currentList[0].chatId;
|
|
243
|
+
this.chartIdType.chat = currentList[0].chatId;
|
|
244
|
+
}
|
|
169
245
|
this.messageList = cacheArray;
|
|
170
246
|
if (this.messageList.length > 0) {
|
|
171
247
|
this.chatShow = true;
|
|
172
248
|
setTimeout(() => {
|
|
173
249
|
this.$refs.chatRef.scrollToBottom();
|
|
174
250
|
});
|
|
251
|
+
} else {
|
|
252
|
+
this.chatShow = false;
|
|
175
253
|
}
|
|
176
254
|
},
|
|
177
255
|
async addNewChat() {
|
|
@@ -195,6 +273,7 @@ export default {
|
|
|
195
273
|
this.resizeChat();
|
|
196
274
|
this.$message.success('对话清除成功!');
|
|
197
275
|
this.chatId = undefined;
|
|
276
|
+
this.chartIdType[this.activeKey] = undefined;
|
|
198
277
|
},
|
|
199
278
|
goChat(event) {
|
|
200
279
|
if (event.shiftKey) {
|
|
@@ -211,7 +290,7 @@ export default {
|
|
|
211
290
|
this.$message.error('输入内容为空');
|
|
212
291
|
return
|
|
213
292
|
}
|
|
214
|
-
this.aiMessageKeyWord = this.
|
|
293
|
+
this.aiMessageKeyWord = editorCurrentData(this.editor.getHtml());
|
|
215
294
|
this.chatShow = true;
|
|
216
295
|
this.stop = true;
|
|
217
296
|
setTimeout(() => {
|
|
@@ -230,17 +309,96 @@ export default {
|
|
|
230
309
|
},
|
|
231
310
|
resizeChat() {
|
|
232
311
|
this.messageList = [];
|
|
233
|
-
this.chatShow = false;
|
|
312
|
+
if (this.activeKey === 'tab') this.chatShow = false;
|
|
234
313
|
},
|
|
235
314
|
messageFinish(chatId) {
|
|
236
315
|
this.stop = false;
|
|
237
316
|
this.chatId = chatId;
|
|
317
|
+
this.chartIdType[this.activeKey] = chatId;
|
|
238
318
|
},
|
|
239
319
|
initInfo(info) {
|
|
240
320
|
const { ifProbe, isShowFile } = info;
|
|
241
321
|
this.showMoreQA = !!ifProbe;
|
|
242
322
|
this.showFile = !!isShowFile;
|
|
243
|
-
}
|
|
323
|
+
},
|
|
324
|
+
changeType(type) {
|
|
325
|
+
this.activeKey = type;
|
|
326
|
+
this.chatId = this.chartIdType[type];
|
|
327
|
+
this.messageList = [];
|
|
328
|
+
let params = undefined;
|
|
329
|
+
this.aiMessage = undefined;
|
|
330
|
+
this.resizeInput = false;
|
|
331
|
+
if (type === 'chat') {
|
|
332
|
+
params = undefined;
|
|
333
|
+
}
|
|
334
|
+
if (type === 'image') {
|
|
335
|
+
params = '_comqapicture';
|
|
336
|
+
}
|
|
337
|
+
if (type === 'translate') {
|
|
338
|
+
params = '_comqatranslate';
|
|
339
|
+
}
|
|
340
|
+
if (type === 'multimodal') {
|
|
341
|
+
params = '_comqamodal';
|
|
342
|
+
}
|
|
343
|
+
this.queryList(params);
|
|
344
|
+
setTimeout(() => this.resizeInput = true)
|
|
345
|
+
},
|
|
346
|
+
registerLatex() {
|
|
347
|
+
window.addEventListener('message', this.latexMessage);
|
|
348
|
+
},
|
|
349
|
+
unloadLatex(){
|
|
350
|
+
window.removeEventListener('message', this.latexMessage);
|
|
351
|
+
},
|
|
352
|
+
latexMessage(event) {
|
|
353
|
+
const { mceAction, content } = event.data;
|
|
354
|
+
if (mceAction === 'insertContent') {
|
|
355
|
+
const match = content.match(/data-latex="([^"]+)"/);
|
|
356
|
+
if (match) {
|
|
357
|
+
const latexValue = match[1];
|
|
358
|
+
let latex = latexValue.replace(/\s/g, ""); // 去掉空格
|
|
359
|
+
if (latex !== '\\placeholder') {
|
|
360
|
+
const formulaNode = {
|
|
361
|
+
type: "formula",
|
|
362
|
+
value: latex,
|
|
363
|
+
children: [
|
|
364
|
+
{
|
|
365
|
+
text: "",
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
};
|
|
369
|
+
if (!this.formulaValue) {
|
|
370
|
+
this.editor.insertNode(formulaNode);
|
|
371
|
+
} else {
|
|
372
|
+
// 翻源码得 ↓
|
|
373
|
+
this.editor.restoreSelection();
|
|
374
|
+
const selectedElem = this.getSelectedElem(this.editor);
|
|
375
|
+
const path = DomEditor.findPath(this.editor, selectedElem)
|
|
376
|
+
const props = { value: latex };
|
|
377
|
+
SlateTransforms.setNodes(this.editor, props, { at: path });
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
console.log('公式值获取失败');
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
getSelectedElem(editor) {
|
|
386
|
+
const node = DomEditor.getSelectedNodeByType(editor, 'formula')
|
|
387
|
+
if (node == null) return null;
|
|
388
|
+
return node;
|
|
389
|
+
},
|
|
390
|
+
saveFormula() {
|
|
391
|
+
this.$refs.editorFrame.contentWindow.postMessage('message' ,'*');
|
|
392
|
+
setTimeout(() => {
|
|
393
|
+
this.formulaVisible = false;
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
editFormula(value) {
|
|
397
|
+
setTimeout(() => {
|
|
398
|
+
this.formulaValue = encodeURIComponent(value);
|
|
399
|
+
this.formulaVisible = true;
|
|
400
|
+
}, 100);
|
|
401
|
+
},
|
|
244
402
|
}
|
|
245
403
|
}
|
|
246
404
|
</script>
|
|
@@ -324,16 +482,8 @@ export default {
|
|
|
324
482
|
.ai-main-content {
|
|
325
483
|
position: relative;
|
|
326
484
|
z-index: 1;
|
|
327
|
-
//height: calc(100% - 53px - 86px - 32px - 17px);
|
|
328
485
|
height: calc(100% - 53px - 86px - 32px);
|
|
329
|
-
padding: 16px 0
|
|
330
|
-
}
|
|
331
|
-
.disclaimer {
|
|
332
|
-
margin: 0;
|
|
333
|
-
font-size: 14px;
|
|
334
|
-
color: #cfcfcf;
|
|
335
|
-
text-align: center;
|
|
336
|
-
margin-top: 6px;
|
|
486
|
+
padding: 16px 0 8px 8px;
|
|
337
487
|
}
|
|
338
488
|
.bg-image {
|
|
339
489
|
position: absolute;
|
|
@@ -345,25 +495,24 @@ export default {
|
|
|
345
495
|
border-radius: 16px 0;
|
|
346
496
|
}
|
|
347
497
|
:deep {
|
|
348
|
-
.
|
|
349
|
-
.
|
|
498
|
+
.editor-input {
|
|
499
|
+
.w-e-text-container {
|
|
500
|
+
background: transparent;
|
|
350
501
|
height: 60px;
|
|
351
|
-
font-size: 16px;
|
|
352
|
-
resize: none;
|
|
353
|
-
color: rgba(51,51,51,.75);
|
|
354
|
-
border: 0;
|
|
355
|
-
border-radius: 40px;
|
|
356
|
-
background: linear-gradient(to bottom, #fff, #d8f0fb);
|
|
357
|
-
padding: 8px 56px 0 24px;
|
|
358
|
-
&::placeholder {
|
|
359
|
-
color: rgba(51,51,51,.75);
|
|
360
|
-
}
|
|
361
|
-
&::-webkit-scrollbar {
|
|
362
|
-
width: 0 !important; /* 针对 WebKit 浏览器 */
|
|
363
|
-
}
|
|
364
502
|
}
|
|
365
503
|
}
|
|
366
504
|
}
|
|
505
|
+
.editor-input {
|
|
506
|
+
background: #fff;
|
|
507
|
+
font-size: 16px;
|
|
508
|
+
color: rgba(51,51,51,.75);
|
|
509
|
+
border: 0;
|
|
510
|
+
border-radius: 40px;
|
|
511
|
+
box-shadow: 0 2px 8px rgba(32, 40, 64, 0.24);
|
|
512
|
+
background: linear-gradient(to bottom, #fff, #d8f0fb);
|
|
513
|
+
padding: 0 56px;
|
|
514
|
+
text-align: left;
|
|
515
|
+
}
|
|
367
516
|
.message-wrap {
|
|
368
517
|
height: calc(100% - 53px );
|
|
369
518
|
align-items: center;
|
|
@@ -376,4 +525,41 @@ export default {
|
|
|
376
525
|
font-size: 25px;
|
|
377
526
|
margin: 8px 0; /* 上下各 8px 的间距 */
|
|
378
527
|
}
|
|
379
|
-
|
|
528
|
+
.operator-wrap {
|
|
529
|
+
display: flex;
|
|
530
|
+
}
|
|
531
|
+
.formula {
|
|
532
|
+
position: absolute;
|
|
533
|
+
bottom: 1px;
|
|
534
|
+
width: 32px;
|
|
535
|
+
height: 32px;
|
|
536
|
+
cursor: pointer;
|
|
537
|
+
margin: 16px;
|
|
538
|
+
z-index: 1;
|
|
539
|
+
background: url("../static/formula.png");
|
|
540
|
+
}
|
|
541
|
+
.save-button {
|
|
542
|
+
position: absolute;
|
|
543
|
+
right: 24px;
|
|
544
|
+
bottom: 10px;
|
|
545
|
+
}
|
|
546
|
+
.agent-list-container {
|
|
547
|
+
position: relative;
|
|
548
|
+
padding: 24px;
|
|
549
|
+
border-radius: 16px;
|
|
550
|
+
background: linear-gradient(103.5deg, rgba(255, 238, 238, 1) 0%, rgba(255, 255, 255, 1) 29%, rgba(255, 255, 255, 1) 71%, rgba(204, 238, 255, 1) 100%);
|
|
551
|
+
}
|
|
552
|
+
.iframe-editor {
|
|
553
|
+
width: 100%;
|
|
554
|
+
height: 100%;
|
|
555
|
+
outline: none;
|
|
556
|
+
border: none;
|
|
557
|
+
}
|
|
558
|
+
</style>
|
|
559
|
+
<style lang="scss">
|
|
560
|
+
.srkj-tools-agent-content {
|
|
561
|
+
padding: 2px;
|
|
562
|
+
border-radius: 16px;
|
|
563
|
+
}
|
|
564
|
+
</style>
|
|
565
|
+
<style src="@wangeditor/editor/dist/css/style.css"></style>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -59,4 +59,27 @@ export const cacheMessageList = [
|
|
|
59
59
|
export const getUserInfo = async (token) => {
|
|
60
60
|
await ssoAuth(token);
|
|
61
61
|
cache.session.setJSON('SRKJ_TOKEN_CACHE', token);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const editorCurrentData = (html) => {
|
|
65
|
+
// 创建一个临时的 div 元素来解析 HTML
|
|
66
|
+
const tempDiv = document.createElement('div');
|
|
67
|
+
tempDiv.innerHTML = html;
|
|
68
|
+
|
|
69
|
+
// 获取所有的 p 标签
|
|
70
|
+
const pElements = tempDiv.querySelectorAll('p');
|
|
71
|
+
|
|
72
|
+
// 遍历所有的 p 标签
|
|
73
|
+
pElements.forEach(pElement => {
|
|
74
|
+
// 遍历 p 标签内的所有 span 节点
|
|
75
|
+
const spanElements = pElement.querySelectorAll('span[data-w-e-type="formula"]');
|
|
76
|
+
spanElements.forEach(span => {
|
|
77
|
+
const formulaValue = span.getAttribute('data-value');
|
|
78
|
+
// 替换 span 节点为公式文本
|
|
79
|
+
span.outerHTML = `$$${formulaValue}$$`;
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// 获取处理后的 HTML
|
|
84
|
+
return tempDiv.innerHTML;
|
|
62
85
|
}
|