ai-assistant-pro 0.0.8 → 0.0.10

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.
@@ -65,6 +65,7 @@
65
65
  import { errorList, cacheMessageList } from '../utils/config';
66
66
  import ChatTools from './chat-tools.vue';
67
67
  import { sendMessageEventSource, getAutoQuestioning } from "../api";
68
+ import { marked } from 'marked';
68
69
  const controller = new AbortController();
69
70
  const signal = controller.signal;
70
71
 
@@ -147,6 +148,7 @@ export default {
147
148
  content: this.messageData[list.index - 1].message,
148
149
  }
149
150
  this.messageData[list.index].message = '';
151
+ this.messageData[list.index].cacheMessage = '';
150
152
  this.makeAutoMessage();
151
153
  }
152
154
  const params = {
@@ -170,6 +172,7 @@ export default {
170
172
  {
171
173
  type: 'robot',
172
174
  message: '',
175
+ cacheMessage: '',
173
176
  zan: false,
174
177
  cai: false,
175
178
  stop: false,
@@ -228,7 +231,8 @@ export default {
228
231
  this.$emit('on-message-finish', chatId);
229
232
  return;
230
233
  }
231
- currentList.message += content.replace(/\n/g, '<br>');
234
+ currentList.cacheMessage += content;
235
+ currentList.message = marked.parse(currentList.cacheMessage);
232
236
  currentList.msgId = msgId;
233
237
  currentList.parentMsgId = parentMsgId;
234
238
  currentList.chatId = chatId;
@@ -344,6 +348,13 @@ export default {
344
348
  line-height: 24px;
345
349
  flex: 1;
346
350
  }
351
+ :deep {
352
+ .robot-message {
353
+ p {
354
+ margin: 0;
355
+ }
356
+ }
357
+ }
347
358
 
348
359
  .user-info {
349
360
  width: auto;
@@ -53,6 +53,7 @@
53
53
  import HotSearch from './hot-search.vue';
54
54
  import Chat from './chat.vue';
55
55
  import Cookies from "js-cookie";
56
+ import { marked } from 'marked';
56
57
  import { getUserInfo } from '../utils/config';
57
58
  import { newChat, chartClear, getDetailList, countAccess,checkCourseIdIsExist } from '../api/index';
58
59
  export default {
@@ -142,7 +143,7 @@ export default {
142
143
  }
143
144
  const obj = {
144
145
  type: list.role === 'assistant' ? 'robot' : 'user',
145
- message: list.content.replace(/\n/g, '<br>'),
146
+ message: list.role === 'assistant' ? marked.parse(list.content) : list.content.replace(/\n/g, '<br>'),
146
147
  zan: list.type === 1,
147
148
  cai: list.type === 2,
148
149
  stop: list.status === 1,