feat(ai): 添加 AI 写作、知识库、思维导图和工作流功能
- 新增 AI 写作功能,包括示例点击、重置和停止流等功能 - 实现 AI 知识库管理,支持创建、编辑和删除知识库 - 添加 AI 思维导图功能,支持预览和管理思维导图 - 实现 AI 工作流管理,支持创建、编辑和删除工作流 - 优化 API 调用,使用 Vben 组件库和 Vue 3 相关特性
This commit is contained in:
@@ -37,9 +37,11 @@ onMounted(() => {
|
||||
if (contentAreaHeight.value && !initialized) {
|
||||
/** 初始化思维导图 */
|
||||
try {
|
||||
markMap = Markmap.create(svgRef.value!);
|
||||
const { el } = Toolbar.create(markMap);
|
||||
toolBarRef.value?.append(el);
|
||||
if (!markMap) {
|
||||
markMap = Markmap.create(svgRef.value!);
|
||||
const { el } = Toolbar.create(markMap);
|
||||
toolBarRef.value?.append(el);
|
||||
}
|
||||
nextTick(update);
|
||||
} catch {
|
||||
message.error('思维导图初始化失败');
|
||||
|
||||
@@ -3,9 +3,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { AiMindmapApi } from '#/api/ai/mindmap';
|
||||
import type { SystemUserApi } from '#/api/system/user';
|
||||
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { nextTick, onMounted, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { Page, useVbenDrawer } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
@@ -15,9 +15,17 @@ import { getSimpleUserList } from '#/api/system/user';
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import Right from '../index/modules/Right.vue';
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
|
||||
const userList = ref<SystemUserApi.User[]>([]); // 用户列表
|
||||
const previewVisible = ref(false); // drawer 的显示隐藏
|
||||
const previewContent = ref('');
|
||||
const [Drawer, drawerApi] = useVbenDrawer({
|
||||
header: false,
|
||||
footer: false,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
@@ -68,6 +76,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
} as VxeTableGridOptions<AiMindmapApi.MindMapVO>,
|
||||
});
|
||||
const openPreview = async (row: AiMindmapApi.MindMapVO) => {
|
||||
previewVisible.value = false;
|
||||
drawerApi.open();
|
||||
await nextTick();
|
||||
previewVisible.value = true;
|
||||
previewContent.value = row.generatedContent;
|
||||
};
|
||||
onMounted(async () => {
|
||||
// 获得下拉数据
|
||||
userList.value = await getSimpleUserList();
|
||||
@@ -77,6 +92,15 @@ onMounted(async () => {
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<DocAlert title="AI 思维导图" url="https://doc.iocoder.cn/ai/mindmap/" />
|
||||
<Drawer class="w-[800px]">
|
||||
<Right
|
||||
v-if="previewVisible"
|
||||
:generated-content="previewContent"
|
||||
:is-end="true"
|
||||
:is-generating="false"
|
||||
:is-start="false"
|
||||
/>
|
||||
</Drawer>
|
||||
<Grid table-title="思维导图管理列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction :actions="[]" />
|
||||
@@ -89,6 +113,13 @@ onMounted(async () => {
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.cropper.preview'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['ai:api-key:update'],
|
||||
onClick: openPreview.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
|
||||
Reference in New Issue
Block a user