diff --git a/web/apps/web-ele/src/components/ai-chat-panel/DesignPreviewDialog.vue b/web/apps/web-ele/src/components/ai-chat-panel/DesignPreviewDialog.vue index f4bc01e..9db5168 100644 --- a/web/apps/web-ele/src/components/ai-chat-panel/DesignPreviewDialog.vue +++ b/web/apps/web-ele/src/components/ai-chat-panel/DesignPreviewDialog.vue @@ -3,7 +3,11 @@ import type { DesignPreviewData } from './types'; import { computed, ref, watch } from 'vue'; -import { Check, Copy, X } from '@vben/icons'; +import { + Check, + Close as X, + CopyDocument as Copy, +} from '@element-plus/icons-vue'; import { ElButton, @@ -71,13 +75,14 @@ const summaryItems = computed(() => { const fieldItems = computed(() => { const source = payload.value as Record; - const fields = source.form_fields || source.fields || source.schema?.fields; + const fields = + source.schema_fields || source.form_fields || source.fields || source.schema?.fields; return Array.isArray(fields) ? fields.slice(0, 12) : []; }); const tableItems = computed(() => { const source = payload.value as Record; - const tables = source.table_configs || source.tables || source.data_sources; + const tables = source.data_sources || source.table_configs || source.tables; return Array.isArray(tables) ? tables.slice(0, 8) : []; }); diff --git a/web/apps/web-ele/src/components/ai-chat-panel/composables/useChatApi.ts b/web/apps/web-ele/src/components/ai-chat-panel/composables/useChatApi.ts index a421958..1ac6996 100644 --- a/web/apps/web-ele/src/components/ai-chat-panel/composables/useChatApi.ts +++ b/web/apps/web-ele/src/components/ai-chat-panel/composables/useChatApi.ts @@ -91,7 +91,7 @@ export function useChatApi(props: AiChatPanelProps): { const adapter: ChatApiAdapter = { sendMessage: ( message: string, - inputs: Record | undefined, + _inputs: Record | undefined, onEvent: (event: StreamEvent) => void, onError: (error: Error) => void, onComplete: () => void, @@ -110,16 +110,12 @@ export function useChatApi(props: AiChatPanelProps): { type: att.type, })); - // 从 inputs 中提取 form_code(如果存在) - const formCode = inputs?.form_code; - return sendAgentMessageStream( props.agentId, { message, conversation_id: conversationId.value || undefined, attachments: attachmentInputs, - form_code: formCode, }, (event) => { // 捕获 conversation_id diff --git a/web/apps/web-ele/src/components/ai-chat-panel/composables/useEventHandler.ts b/web/apps/web-ele/src/components/ai-chat-panel/composables/useEventHandler.ts index ce2f6a0..4865e6e 100644 --- a/web/apps/web-ele/src/components/ai-chat-panel/composables/useEventHandler.ts +++ b/web/apps/web-ele/src/components/ai-chat-panel/composables/useEventHandler.ts @@ -97,8 +97,8 @@ export function useEventHandler(config: EventHandlerConfig) { title: configData.title || '设计预览', data: configData.data || {}, nodeId: event.node_id || '', - form_fields: configData.form_fields, - table_configs: configData.table_configs, + data_sources: configData.data_sources || configData.table_configs, + schema_fields: configData.schema_fields || configData.form_fields, layoutOptions: configData.layoutOptions, themeOptions: configData.themeOptions, }; diff --git a/web/apps/web-ele/src/components/ai-chat-panel/types.ts b/web/apps/web-ele/src/components/ai-chat-panel/types.ts index 8fa0f7c..70b027d 100644 --- a/web/apps/web-ele/src/components/ai-chat-panel/types.ts +++ b/web/apps/web-ele/src/components/ai-chat-panel/types.ts @@ -70,8 +70,8 @@ export interface DesignPreviewData { title: string; data: Record; nodeId: string; - form_fields?: any[]; - table_configs?: any[]; + data_sources?: any[]; + schema_fields?: any[]; layoutOptions?: any[]; themeOptions?: any[]; } @@ -89,6 +89,7 @@ export interface NodeEvent { node_id: string; node_type?: string; node_label?: string; + event_type?: string; status?: 'failed' | 'running' | 'success'; inputs?: Record; outputs?: Record; @@ -96,6 +97,7 @@ export interface NodeEvent { tokens_used?: number; error_message?: string; loop_iteration?: number; + warnings?: any[]; } /** 循环迭代事件 */ @@ -132,7 +134,7 @@ export interface AiChatPanelProps { agent?: AgentInfo | null; /** 当前对话 ID(agent-chat 模式用于加载历史) */ conversationId?: null | string; - /** 初始输入参数(如 form_code 等系统变量) */ + /** 初始输入参数 */ initialInputs?: Record; // ========== 功能开关 ========== diff --git a/web/apps/web-ele/src/views/ai-platform/agent/components/AgentChatPanel.vue b/web/apps/web-ele/src/views/ai-platform/agent/components/AgentChatPanel.vue index b69d930..3dd7b74 100644 --- a/web/apps/web-ele/src/views/ai-platform/agent/components/AgentChatPanel.vue +++ b/web/apps/web-ele/src/views/ai-platform/agent/components/AgentChatPanel.vue @@ -71,9 +71,9 @@ const waitingConfig = ref(null); // 设计面板状态 const currentDesign = ref(null); @@ -273,7 +273,7 @@ async function doSendMessage(message: string, addUserMessage: boolean = true) { scrollToBottom(); // 发送流式请求 - // 系统变量(application_id 等)由 API 层自动注入 + // 业务上下文由 API 层按 Agent 配置解析 cancelStream = sendAgentMessageStream( props.agentId, { @@ -491,8 +491,8 @@ function handleStreamEvent( $t('ai-platform.agent.chatPanel.designPreview'), data: configData.data || {}, nodeId: event.node_id || '', - form_fields: configData.form_fields || [], - table_configs: configData.table_configs || [], + data_sources: configData.data_sources || configData.table_configs || [], + schema_fields: configData.schema_fields || configData.form_fields || [], }; showDesignPanel.value = true; @@ -838,8 +838,8 @@ onUnmounted(() => { title: currentDesign.title, data: currentDesign.data, nodeId: currentDesign.nodeId, - form_fields: currentDesign.form_fields, - table_configs: currentDesign.table_configs, + data_sources: currentDesign.data_sources, + schema_fields: currentDesign.schema_fields, }" @confirm="handleDesignConfirm" @close="handleDesignCancel" diff --git a/web/apps/web-ele/src/views/ai-platform/workflow/editor/components/ChatPanel.vue b/web/apps/web-ele/src/views/ai-platform/workflow/editor/components/ChatPanel.vue index 1d88cf9..9c91f9c 100644 --- a/web/apps/web-ele/src/views/ai-platform/workflow/editor/components/ChatPanel.vue +++ b/web/apps/web-ele/src/views/ai-platform/workflow/editor/components/ChatPanel.vue @@ -215,7 +215,7 @@ const runWorkflow = (userMessage: string, inputs: Record) => { running.value = true; // 流式运行(编辑器调试模式,使用草稿版本) - // 系统变量(application_id 等)由 API 层自动注入 + // 业务上下文由 API 层按 Workflow 配置解析 cancelStream = runWorkflowStreamApi( props.workflowId, inputs, @@ -589,8 +589,10 @@ const handleStreamEvent = (event: WorkflowStreamEvent, msgId: string) => { $t('ai-platform.workflow.editor.chatPanel.designPreviewTitle'), data: configData.data || {}, nodeId: event.node_id || '', - form_fields: configData.form_fields || [], // 传递表单字段列表(用于列表设计) - table_configs: configData.table_configs || [], // 传递数据表配置(用于表单设计) + data_sources: + configData.data_sources || configData.table_configs || [], + schema_fields: + configData.schema_fields || configData.form_fields || [], }; showDesignPanel.value = true; } diff --git a/web/apps/web-ele/src/views/ai-platform/workflow/editor/panels/StartPanel.vue b/web/apps/web-ele/src/views/ai-platform/workflow/editor/panels/StartPanel.vue index a1a8643..fadf456 100644 --- a/web/apps/web-ele/src/views/ai-platform/workflow/editor/panels/StartPanel.vue +++ b/web/apps/web-ele/src/views/ai-platform/workflow/editor/panels/StartPanel.vue @@ -1,7 +1,7 @@