Merge branch 'main' of github.com:maxkb-dev/maxkb

This commit is contained in:
shaohuzhang1 2023-12-14 10:43:56 +08:00
commit 4274504b31
5 changed files with 36 additions and 13 deletions

View File

@ -26,6 +26,8 @@
"markdown-it-sup": "^1.0.0", "markdown-it-sup": "^1.0.0",
"markdown-it-task-lists": "^2.1.1", "markdown-it-task-lists": "^2.1.1",
"markdown-it-toc-done-right": "^4.2.0", "markdown-it-toc-done-right": "^4.2.0",
"md-editor-v3": "^4.9.0",
"medium-zoom": "^1.1.0",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"npm": "^10.2.4", "npm": "^10.2.4",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",

View File

@ -61,11 +61,9 @@
回答中 <span class="dotting"></span> 回答中 <span class="dotting"></span>
</el-card> </el-card>
</div> </div>
<el-card v-else shadow="always" class="dialog-card"> <el-card v-else shadow="always" class="dialog-card">
<MarkdownRenderer <MdPreview ref="editorRef" editorId="preview-only" :modelValue="item.answer_text" />
:source="item.answer_text"
:inner_suffix="false"
></MarkdownRenderer>
</el-card> </el-card>
<div class="flex-between mt-8" v-if="log"> <div class="flex-between mt-8" v-if="log">
<LogOperationButton :data="item" :applicationId="appId" /> <LogOperationButton :data="item" :applicationId="appId" />
@ -137,6 +135,8 @@ import applicationApi from '@/api/application'
import { ChatManagement, type chatType } from '@/api/type/application' import { ChatManagement, type chatType } from '@/api/type/application'
import { randomId } from '@/utils/utils' import { randomId } from '@/utils/utils'
import useStore from '@/stores' import useStore from '@/stores'
import { MdPreview } from 'md-editor-v3'
defineOptions({ name: 'AiChat' }) defineOptions({ name: 'AiChat' })
const route = useRoute() const route = useRoute()
const { const {

View File

@ -4,3 +4,5 @@
@import './element-plus.scss'; @import './element-plus.scss';
@import 'nprogress/nprogress.css'; @import 'nprogress/nprogress.css';
@import 'highlight.js/styles/default.css'; @import 'highlight.js/styles/default.css';
@import 'md-editor-v3/lib/preview.css';
@import './md-editor.scss';

View File

@ -0,0 +1,19 @@
.md-editor-preview {
padding: 0;
margin: 0;
font-size: inherit;
p {
padding: 0 !important;
}
.md-editor-admonition {
margin: 0;
padding: 0;
}
img {
border: 0 !important;
}
}
.md-editor-preview-wrapper {
padding: 0;
}

View File

@ -1,11 +1,5 @@
<template> <template>
<el-drawer <el-drawer v-model="visible" size="50%" @close="closeHandel" class="chat-record-drawer">
v-model="visible"
size="50%"
append-to-body
@close="closeHandel"
class="chat-record-drawer"
>
<template #header> <template #header>
<h4>{{ application?.name }}</h4> <h4>{{ application?.name }}</h4>
</template> </template>
@ -49,7 +43,7 @@ const props = withDefaults(
/** /**
* 对话 记录id * 对话 记录id
*/ */
chartId?: string chartId: string
/** /**
* 下一条 * 下一条
*/ */
@ -66,7 +60,7 @@ const props = withDefaults(
{} {}
) )
defineEmits(['update:chartId']) const emit = defineEmits(['update:chartId'])
const route = useRoute() const route = useRoute()
const { const {
@ -107,6 +101,12 @@ watch(
} }
) )
watch(visible, (bool) => {
if (!bool) {
emit('update:chartId', '')
}
})
const open = () => { const open = () => {
getChatRecord() getChatRecord()
visible.value = true visible.value = true