diff --git a/web/apps/web-ele/.env.development b/web/apps/web-ele/.env.development index ee383f3..aecd79a 100644 --- a/web/apps/web-ele/.env.development +++ b/web/apps/web-ele/.env.development @@ -16,3 +16,5 @@ VITE_DEVTOOLS=false # 是否注入全局loading VITE_INJECT_APP_LOADING=true +VITE_ENABLE_ONLINE_DEV_DESIGN=false +VITE_ENABLE_DASHBOARD_ADVANCED_WIDGETS=false diff --git a/web/apps/web-ele/.env.production b/web/apps/web-ele/.env.production index a5b255e..55045f9 100644 --- a/web/apps/web-ele/.env.production +++ b/web/apps/web-ele/.env.production @@ -7,3 +7,5 @@ VITE_PWA=false VITE_ROUTER_HISTORY=history VITE_INJECT_APP_LOADING=true VITE_ARCHIVER=false +VITE_ENABLE_ONLINE_DEV_DESIGN=false +VITE_ENABLE_DASHBOARD_ADVANCED_WIDGETS=false diff --git a/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue b/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue index f1458d2..4680d96 100644 --- a/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue +++ b/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue @@ -35,27 +35,44 @@ import { ChatBox } from '#/components/ChatBox'; import { useChatApi } from './composables/useChatApi'; import { useEventHandler } from './composables/useEventHandler'; -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 DesignEditorPanel = defineAsyncComponent(() => - import('#/components/form-editor/DesignEditorPanel.vue'), -); -const SystemSummaryConfirmPanel = defineAsyncComponent(() => - import('#/components/form-editor/SystemSummaryConfirmPanel.vue'), -); +const ENABLE_ONLINE_DEV_DESIGN = + import.meta.env.VITE_ENABLE_ONLINE_DEV_DESIGN === 'true'; + +const AppDesignPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/AppDesignPanel.vue'), + ) + : undefined; +const AppSettingsPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/AppSettingsPanel.vue'), + ) + : undefined; +const DashboardBasicInfoConfirmPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/DashboardBasicInfoConfirmPanel.vue'), + ) + : undefined; +const DashboardDesignConfirmPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/DashboardDesignConfirmPanel.vue'), + ) + : undefined; +const DashboardPublishConfirmPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/DashboardPublishConfirmPanel.vue'), + ) + : undefined; +const DesignEditorPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/DesignEditorPanel.vue'), + ) + : undefined; +const SystemSummaryConfirmPanel = ENABLE_ONLINE_DEV_DESIGN + ? defineAsyncComponent(() => + import('#/components/form-editor/SystemSummaryConfirmPanel.vue'), + ) + : undefined; // ==================== Props ==================== const props = withDefaults(defineProps(), { @@ -235,13 +252,14 @@ const loadingAnimationTitle = ref('AI 正在开发...'); // 是否有任何设计面板打开 const hasAnyDesignPanelOpen = computed( () => - showDesignPanel.value || - showAppDesignPanel.value || - showAppSettingsPanel.value || - showDashboardBasicInfoPanel.value || - showDashboardDesignPanel.value || - showDashboardPublishPanel.value || - showSystemSummaryPanel.value || + (ENABLE_ONLINE_DEV_DESIGN && + (showDesignPanel.value || + showAppDesignPanel.value || + showAppSettingsPanel.value || + showDashboardBasicInfoPanel.value || + showDashboardDesignPanel.value || + showDashboardPublishPanel.value || + showSystemSummaryPanel.value)) || showLoadingAnimation.value, ); @@ -290,6 +308,8 @@ const handleDesignPreview = (data: DesignPreviewData) => { // 关闭加载动画 showLoadingAnimation.value = false; + if (!ENABLE_ONLINE_DEV_DESIGN) return; + switch (data.type) { case 'app_design': { currentAppDesign.value = data; @@ -343,7 +363,7 @@ const { handleStreamEvent, updateAssistantMessage } = useEventHandler({ waitingConfig, running, conversationId: safeConversationId, - onDesignPreview: handleDesignPreview, + onDesignPreview: ENABLE_ONLINE_DEV_DESIGN ? handleDesignPreview : undefined, }); // ==================== 加载历史消息 ==================== @@ -462,6 +482,7 @@ const runMessageWithExistingUserMsg = ( ) => { // 如果是 application 类型工作流且是全屏布局,显示加载动画 if ( + ENABLE_ONLINE_DEV_DESIGN && props.layout === 'fullscreen' && props.agent?.workflow_type === 'application' ) { @@ -533,6 +554,7 @@ const runMessage = ( // 如果是 application 类型工作流且是全屏布局,显示加载动画 if ( + ENABLE_ONLINE_DEV_DESIGN && props.layout === 'fullscreen' && props.agent?.workflow_type === 'application' ) { @@ -629,6 +651,7 @@ const handleInteractionSubmit = (messageId: string, value: any) => { // 全屏布局且是 application 类型工作流时,显示加载动画 if ( + ENABLE_ONLINE_DEV_DESIGN && props.layout === 'fullscreen' && props.agent?.workflow_type === 'application' ) { @@ -667,6 +690,7 @@ const handleInteractionCancel = (messageId: string) => { // 全屏布局且是 application 类型工作流时,显示加载动画 if ( + ENABLE_ONLINE_DEV_DESIGN && props.layout === 'fullscreen' && props.agent?.workflow_type === 'application' ) { @@ -778,6 +802,7 @@ const createDesignConfirmHandler = ( // 全屏布局且是 application 类型工作流时,显示加载动画 if ( + ENABLE_ONLINE_DEV_DESIGN && props.layout === 'fullscreen' && props.agent?.workflow_type === 'application' ) { @@ -1019,7 +1044,7 @@ onUnmounted(() => { { { { { { { { -