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