Skip to content

Commit b2bdcdc

Browse files
committed
【功能新增】AI 大模型:支持思维导图的管理
1 parent 7c73b80 commit b2bdcdc

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

src/views/ai/mindmap/index/components/Right.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const props = defineProps<{
4343
isGenerating: boolean // 是否正在生成
4444
isStart: boolean // 开始状态,开始时需要清除 html
4545
}>()
46-
const contentRef = ref<HTMLDivElement>() // 右侧出来header以下的区域
46+
const contentRef = ref<HTMLDivElement>() // 右侧出来 header 以下的区域
4747
const mdContainerRef = ref<HTMLDivElement>() // markdown 的容器,用来滚动到底下的
4848
const mindMapRef = ref<HTMLDivElement>() // 思维导图的容器
4949
const svgRef = ref<SVGElement>() // 思维导图的渲染 svg
@@ -106,8 +106,7 @@ const processContent = (text: string) => {
106106
return arr.join('\n')
107107
}
108108
109-
/** 下载图片 */
110-
// download SVG to png file
109+
/** 下载图片:download SVG to png file */
111110
const downloadImage = () => {
112111
const svgElement = mindMapRef.value
113112
// 将 SVG 渲染到图片对象

src/views/ai/mindmap/index/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const rightRef = ref<InstanceType<typeof Right>>() // 右边组件
4040
4141
/** 使用已有内容直接生成 **/
4242
const directGenerate = (existPrompt: string) => {
43-
isEnd.value = false // 先设置为false再设置为true,让子组建的watch能够监听到
43+
isEnd.value = false // 先设置为 false 再设置为 true,让子组建的 watch 能够监听到
4444
generatedContent.value = existPrompt
4545
isEnd.value = true
4646
}

src/views/ai/mindmap/manager/index.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@
7070
width="180px"
7171
/>
7272
<el-table-column label="错误信息" align="center" prop="errorMessage" />
73-
<el-table-column label="操作" align="center" width="100" fixed="right">
73+
<el-table-column label="操作" align="center" width="120" fixed="right">
7474
<template #default="scope">
75+
<el-button link type="primary" @click="openPreview(scope.row)"> 预览 </el-button>
7576
<el-button
7677
link
7778
type="danger"
@@ -91,12 +92,24 @@
9192
@pagination="getList"
9293
/>
9394
</ContentWrap>
95+
96+
<!-- 思维导图的预览 -->
97+
<el-drawer v-model="previewVisible" :with-header="false" size="800px">
98+
<Right
99+
ref="rightRef"
100+
:generatedContent="previewContent"
101+
:isEnd="true"
102+
:isGenerating="false"
103+
:isStart="false"
104+
/>
105+
</el-drawer>
94106
</template>
95107

96108
<script setup lang="ts">
97109
import { dateFormatter } from '@/utils/formatTime'
98110
import { AiMindMapApi, MindMapVO } from '@/api/ai/mindmap'
99111
import * as UserApi from '@/api/system/user'
112+
import Right from '@/views/ai/mindmap/index/components/Right.vue'
100113
101114
/** AI 思维导图 列表 */
102115
defineOptions({ name: 'AiMindMapManager' })
@@ -154,6 +167,15 @@ const handleDelete = async (id: number) => {
154167
} catch {}
155168
}
156169
170+
// TODO 芋艿:预览会报错
171+
/** 预览操作按钮 */
172+
const previewVisible = ref(false)
173+
const previewContent = ref('')
174+
const openPreview = (row: MindMapVO) => {
175+
previewContent.value = row.generatedContent
176+
previewVisible.value = true
177+
}
178+
157179
/** 初始化 **/
158180
onMounted(async () => {
159181
getList()

0 commit comments

Comments
 (0)