|
@@ -1,5 +1,6 @@
|
|
|
<!-- Chat.vue -->
|
|
|
<template>
|
|
|
+
|
|
|
<div class="chat-container items-center">
|
|
|
<div v-if="!messages.length && !msgLoading" class="message-list">
|
|
|
<pageMask />
|
|
@@ -20,7 +21,10 @@
|
|
|
<div class="content" v-if="message.role === 'system'"
|
|
|
:class="{ 'loading-content': message.content === '' }">
|
|
|
<formTable v-if="message.type === 'form'" :content="message.rawContent" />
|
|
|
- <span v-else v-html="message.content"></span>
|
|
|
+ <div v-else>
|
|
|
+ <div v-html="compiledMarkdown(message.rawContent)" class="markdown-body" style="font-size: small"></div>
|
|
|
+ <!-- <link rel="stylesheet" href="/node_modules/github-markdown-css/github-markdown-dark.css"> -->
|
|
|
+ </div>
|
|
|
<span class="loading-indicator" v-if="sendLoading && index === messages.length - 1">
|
|
|
<span class="dot"></span>
|
|
|
<span class="dot"></span>
|
|
@@ -61,8 +65,6 @@
|
|
|
<div v-show="isShowPage" style="border-bottom: 1px solid #F0F0F0;">
|
|
|
<div class="card_list">
|
|
|
<template v-for="(v, i) in pageInfoList" :key="i">
|
|
|
-
|
|
|
-
|
|
|
<div class="card_image " v-if="v.type === 'image'">
|
|
|
<el-image v-loading="v.isUpload" class="w-full h-full p-0.5 object-cover" :src="v.url" :zoom-rate="1.2"
|
|
|
:max-scale="7" :min-scale="0.2" :preview-src-list="[v.url]" :initial-index="4" fit="cover" />
|
|
@@ -156,6 +158,9 @@ import { useUserStore } from '@/store/modules/user'
|
|
|
import { putChat, uploadFile } from "@/api/index.js";
|
|
|
import { askQues, getFormKey } from '@/api/modal.js'
|
|
|
import { debounce } from 'lodash'
|
|
|
+import {renderMarkdown} from './utils/markdown.js'
|
|
|
+import "github-markdown-css"
|
|
|
+// import "/node_modules/github-markdown-css/github-markdown-dark.css"
|
|
|
const userStore = useUserStore()
|
|
|
// 在其他状态变量附近添加
|
|
|
const isLoadingMore = ref(false)
|
|
@@ -187,6 +192,12 @@ const {
|
|
|
const inputMessage = ref('')
|
|
|
const pageInfo = ref('')
|
|
|
const summaryHtml = ref(false)
|
|
|
+
|
|
|
+const compiledMarkdown = computed(() => {
|
|
|
+ return (val)=>{
|
|
|
+ return renderMarkdown(val)
|
|
|
+ }
|
|
|
+})
|
|
|
function handleStopAsk() {
|
|
|
inputMessage.value = ''
|
|
|
pageInfoList.value = []
|
|
@@ -536,7 +547,7 @@ async function createWS(msg) {
|
|
|
isShowPage.value = false
|
|
|
} else {
|
|
|
obj.rawContent += event.data;
|
|
|
- obj.content = obj.type === 'form' ? obj.rawContent : formatMessage(obj.rawContent);
|
|
|
+ obj.content = obj.type === 'form' ? obj.rawContent : obj.rawContent; //formatMessage(obj.rawContent)
|
|
|
// 滚动到底部
|
|
|
nextTick(() => {
|
|
|
if (scrollbar.value && scrollbar.value.wrapRef) {
|