Avoid form editor barrel imports

This commit is contained in:
2026-06-10 10:29:27 +08:00
parent 6ff08d53bf
commit e25e5a71f7
3 changed files with 52 additions and 35 deletions
@@ -16,7 +16,7 @@ import type {
* - agent-debug: 智能体编辑器调试模式
* - agent-chat: 智能体正式对话模式(支持历史、反馈)
*/
import { computed, onUnmounted, ref, watch } from 'vue';
import { computed, defineAsyncComponent, onUnmounted, ref, watch } from 'vue';
import { Close, Setting } from '@element-plus/icons-vue';
@@ -31,19 +31,31 @@ import {
import { AiWorkingAnimation } from '#/components/ai-loading';
import { ChatBox } from '#/components/ChatBox';
import {
AppDesignPanel,
AppSettingsPanel,
DashboardBasicInfoConfirmPanel,
DashboardDesignConfirmPanel,
DashboardPublishConfirmPanel,
DesignEditorPanel,
SystemSummaryConfirmPanel,
} from '#/components/form-editor';
import { useChatApi } from './composables/useChatApi';
import { useEventHandler } from './composables/useEventHandler';
const DesignEditorPanel = defineAsyncComponent(
() => import('#/components/form-editor/DesignEditorPanel.vue'),
);
const AppDesignPanel = defineAsyncComponent(
() => import('#/components/form-editor/AppDesignPanel.vue'),
);
const AppSettingsPanel = defineAsyncComponent(
() => import('#/components/form-editor/AppSettingsPanel.vue'),
);
const DashboardBasicInfoConfirmPanel = defineAsyncComponent(
() => import('#/components/form-editor/DashboardBasicInfoConfirmPanel.vue'),
);
const DashboardDesignConfirmPanel = defineAsyncComponent(
() => import('#/components/form-editor/DashboardDesignConfirmPanel.vue'),
);
const DashboardPublishConfirmPanel = defineAsyncComponent(
() => import('#/components/form-editor/DashboardPublishConfirmPanel.vue'),
);
const SystemSummaryConfirmPanel = defineAsyncComponent(
() => import('#/components/form-editor/SystemSummaryConfirmPanel.vue'),
);
// ==================== Props ====================
const props = withDefaults(defineProps<AiChatPanelProps>(), {
mode: 'workflow',
@@ -11,7 +11,14 @@ import type { ChatMessage } from '#/components/ChatBox/index';
* Agent 对话面板组件
* 可复用于 Agent 编辑页面和 Agent 对话页面
*/
import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
import {
computed,
defineAsyncComponent,
nextTick,
onUnmounted,
ref,
watch,
} from 'vue';
import { $t } from '@vben/locales';
@@ -23,10 +30,16 @@ import {
sendAgentMessageStream,
} from '#/api/ai-platform/ai-platform';
import { ChatBox } from '#/components/ChatBox/index';
import { AppDesignPanel, DesignEditorPanel } from '#/components/form-editor';
import AiWorkingAnimation from '../../../../components/ai-loading/AiWorkingAnimation.vue';
const DesignEditorPanel = defineAsyncComponent(
() => import('#/components/form-editor/DesignEditorPanel.vue'),
);
const AppDesignPanel = defineAsyncComponent(
() => import('#/components/form-editor/AppDesignPanel.vue'),
);
const props = defineProps<{
/** Agent 详情(可选,用于显示名称和欢迎配置) */
agent?: Agent | null;
@@ -1,15 +1,13 @@
<script setup lang="ts">
import type { WorkflowStreamEvent } from '#/api/ai-platform/ai-platform';
import type { ChatMessage, ReasoningStep } from '#/components/ChatBox/index';
import type {
AppDesignData,
AppSettingsData,
DashboardBasicInfoData,
DashboardDesignData,
DashboardPublishData,
DesignData,
SystemSummaryData,
} from '#/components/form-editor';
import type { AppDesignData } from '#/components/form-editor/AppDesignPanel.vue';
import type { AppSettingsData } from '#/components/form-editor/AppSettingsPanel.vue';
import type { DashboardBasicInfoData } from '#/components/form-editor/DashboardBasicInfoConfirmPanel.vue';
import type { DashboardDesignData } from '#/components/form-editor/DashboardDesignConfirmPanel.vue';
import type { DashboardPublishData } from '#/components/form-editor/DashboardPublishConfirmPanel.vue';
import type { DesignData } from '#/components/form-editor/DesignEditorPanel.vue';
import type { SystemSummaryData } from '#/components/form-editor/SystemSummaryConfirmPanel.vue';
import { computed, defineAsyncComponent, onUnmounted, ref, watch } from 'vue';
@@ -31,31 +29,25 @@ import {
} from '#/api/ai-platform/ai-platform';
import { ChatBox } from '#/components/ChatBox/index';
const DesignEditorPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then((mod) => mod.DesignEditorPanel),
import('#/components/form-editor/DesignEditorPanel.vue'),
);
const AppDesignPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then((mod) => mod.AppDesignPanel),
import('#/components/form-editor/AppDesignPanel.vue'),
);
const AppSettingsPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then((mod) => mod.AppSettingsPanel),
import('#/components/form-editor/AppSettingsPanel.vue'),
);
const DashboardBasicInfoConfirmPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then(
(mod) => mod.DashboardBasicInfoConfirmPanel,
),
import('#/components/form-editor/DashboardBasicInfoConfirmPanel.vue'),
);
const DashboardDesignConfirmPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then(
(mod) => mod.DashboardDesignConfirmPanel,
),
import('#/components/form-editor/DashboardDesignConfirmPanel.vue'),
);
const DashboardPublishConfirmPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then(
(mod) => mod.DashboardPublishConfirmPanel,
),
import('#/components/form-editor/DashboardPublishConfirmPanel.vue'),
);
const SystemSummaryConfirmPanel = defineAsyncComponent(() =>
import('#/components/form-editor').then((mod) => mod.SystemSummaryConfirmPanel),
import('#/components/form-editor/SystemSummaryConfirmPanel.vue'),
);
const props = defineProps<{