【功能新增】AI 大模型:支持思维导图的管理

This commit is contained in:
YunaiV 2024-08-10 18:10:47 +08:00
parent 7c73b800fa
commit b2bdcdcf9c
3 changed files with 26 additions and 5 deletions

View File

@ -43,7 +43,7 @@ const props = defineProps<{
isGenerating: boolean // isGenerating: boolean //
isStart: boolean // html isStart: boolean // html
}>() }>()
const contentRef = ref<HTMLDivElement>() // header const contentRef = ref<HTMLDivElement>() // header
const mdContainerRef = ref<HTMLDivElement>() // markdown const mdContainerRef = ref<HTMLDivElement>() // markdown
const mindMapRef = ref<HTMLDivElement>() // const mindMapRef = ref<HTMLDivElement>() //
const svgRef = ref<SVGElement>() // svg const svgRef = ref<SVGElement>() // svg
@ -106,8 +106,7 @@ const processContent = (text: string) => {
return arr.join('\n') return arr.join('\n')
} }
/** 下载图片 */ /** 下载图片download SVG to png file */
// download SVG to png file
const downloadImage = () => { const downloadImage = () => {
const svgElement = mindMapRef.value const svgElement = mindMapRef.value
// SVG // SVG

View File

@ -40,7 +40,7 @@ const rightRef = ref<InstanceType<typeof Right>>() // 右边组件
/** 使用已有内容直接生成 **/ /** 使用已有内容直接生成 **/
const directGenerate = (existPrompt: string) => { const directGenerate = (existPrompt: string) => {
isEnd.value = false // falsetruewatch isEnd.value = false // false true watch
generatedContent.value = existPrompt generatedContent.value = existPrompt
isEnd.value = true isEnd.value = true
} }

View File

@ -70,8 +70,9 @@
width="180px" width="180px"
/> />
<el-table-column label="错误信息" align="center" prop="errorMessage" /> <el-table-column label="错误信息" align="center" prop="errorMessage" />
<el-table-column label="操作" align="center" width="100" fixed="right"> <el-table-column label="操作" align="center" width="120" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="openPreview(scope.row)"> 预览 </el-button>
<el-button <el-button
link link
type="danger" type="danger"
@ -91,12 +92,24 @@
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
<!-- 思维导图的预览 -->
<el-drawer v-model="previewVisible" :with-header="false" size="800px">
<Right
ref="rightRef"
:generatedContent="previewContent"
:isEnd="true"
:isGenerating="false"
:isStart="false"
/>
</el-drawer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { AiMindMapApi, MindMapVO } from '@/api/ai/mindmap' import { AiMindMapApi, MindMapVO } from '@/api/ai/mindmap'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import Right from '@/views/ai/mindmap/index/components/Right.vue'
/** AI 思维导图 列表 */ /** AI 思维导图 列表 */
defineOptions({ name: 'AiMindMapManager' }) defineOptions({ name: 'AiMindMapManager' })
@ -154,6 +167,15 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
// TODO
/** 预览操作按钮 */
const previewVisible = ref(false)
const previewContent = ref('')
const openPreview = (row: MindMapVO) => {
previewContent.value = row.generatedContent
previewVisible.value = true
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()