From 51bc3e8a839ac5d8cbefd29a9d0a861146ffde63 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Wed, 13 Dec 2023 15:13:01 +0800 Subject: [PATCH 1/2] feat: --- ui/src/views/log/component/ChatRecordDrawer.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/src/views/log/component/ChatRecordDrawer.vue b/ui/src/views/log/component/ChatRecordDrawer.vue index d09966be0..da9dac0af 100644 --- a/ui/src/views/log/component/ChatRecordDrawer.vue +++ b/ui/src/views/log/component/ChatRecordDrawer.vue @@ -49,7 +49,7 @@ const props = withDefaults( /** * 对话 记录id */ - chartId?: string + chartId: string /** * 下一条 */ @@ -66,7 +66,7 @@ const props = withDefaults( {} ) -defineEmits(['update:chartId']) +const emit = defineEmits(['update:chartId']) const route = useRoute() const { @@ -107,6 +107,12 @@ watch( } ) +watch(visible, (bool) => { + if (!bool) { + emit('update:chartId', '') + } +}) + const open = () => { getChatRecord() visible.value = true From f46f9d32829ad4c70368b2a0184c9f0beb1fa70c Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Wed, 13 Dec 2023 19:06:13 +0800 Subject: [PATCH 2/2] feat: --- ui/package.json | 2 ++ ui/src/components/ai-chat/index.vue | 8 ++++---- ui/src/styles/index.scss | 2 ++ ui/src/styles/md-editor.scss | 19 +++++++++++++++++++ .../views/log/component/ChatRecordDrawer.vue | 8 +------- 5 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 ui/src/styles/md-editor.scss diff --git a/ui/package.json b/ui/package.json index c0bc102b1..d5fe95064 100644 --- a/ui/package.json +++ b/ui/package.json @@ -26,6 +26,8 @@ "markdown-it-sup": "^1.0.0", "markdown-it-task-lists": "^2.1.1", "markdown-it-toc-done-right": "^4.2.0", + "md-editor-v3": "^4.9.0", + "medium-zoom": "^1.1.0", "mitt": "^3.0.0", "npm": "^10.2.4", "nprogress": "^0.2.0", diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index 7b9332d4f..2a26f9089 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -61,11 +61,9 @@ 回答中 + - +
@@ -137,6 +135,8 @@ import applicationApi from '@/api/application' import { ChatManagement, type chatType } from '@/api/type/application' import { randomId } from '@/utils/utils' import useStore from '@/stores' +import { MdPreview } from 'md-editor-v3' + defineOptions({ name: 'AiChat' }) const route = useRoute() const { diff --git a/ui/src/styles/index.scss b/ui/src/styles/index.scss index abfef83c5..e467fc48c 100644 --- a/ui/src/styles/index.scss +++ b/ui/src/styles/index.scss @@ -4,3 +4,5 @@ @import './element-plus.scss'; @import 'nprogress/nprogress.css'; @import 'highlight.js/styles/default.css'; +@import 'md-editor-v3/lib/preview.css'; +@import './md-editor.scss'; \ No newline at end of file diff --git a/ui/src/styles/md-editor.scss b/ui/src/styles/md-editor.scss new file mode 100644 index 000000000..8804ac14a --- /dev/null +++ b/ui/src/styles/md-editor.scss @@ -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; +} diff --git a/ui/src/views/log/component/ChatRecordDrawer.vue b/ui/src/views/log/component/ChatRecordDrawer.vue index da9dac0af..ee0893677 100644 --- a/ui/src/views/log/component/ChatRecordDrawer.vue +++ b/ui/src/views/log/component/ChatRecordDrawer.vue @@ -1,11 +1,5 @@