Trim online context from AI chat editors

This commit is contained in:
2026-06-09 00:06:35 +08:00
parent cd355180f6
commit 0a86fa80b4
7 changed files with 29 additions and 63 deletions
@@ -71,9 +71,9 @@ const waitingConfig = ref<any>(null);
// 设计面板状态
const currentDesign = ref<null | {
data: any;
form_fields?: any[];
data_sources?: any[];
nodeId: string;
table_configs?: any[];
schema_fields?: any[];
title: string;
type: string;
}>(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"
@@ -215,7 +215,7 @@ const runWorkflow = (userMessage: string, inputs: Record<string, any>) => {
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;
}
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref, watch } from 'vue';
import { Plus, Trash2 } from '@vben/icons';
import { Delete as Trash2, Plus } from '@element-plus/icons-vue';
import { $t } from '@vben/locales';
import { ElButton, ElForm, ElInput, ElOption, ElSelect } from 'element-plus';
@@ -50,45 +50,6 @@ const handleDelete = (index: number) => {
</div>
</div>
<!-- 默认的 application_id 变量不可删除 -->
<div class="border-primary/30 bg-primary/5 rounded border p-3">
<div class="mb-2 flex items-center justify-between">
<span class="text-primary text-sm font-medium">application_id</span>
<span class="text-muted-foreground text-xs">{{
$t('ai-platform.workflow.panels.common.sysVar')
}}</span>
</div>
<div class="text-muted-foreground text-xs">
{{ $t('ai-platform.workflow.panels.start.appIdDesc') }}
</div>
</div>
<!-- 默认的 application_code 变量不可删除 -->
<div class="border-primary/30 bg-primary/5 rounded border p-3">
<div class="mb-2 flex items-center justify-between">
<span class="text-primary text-sm font-medium">application_code</span>
<span class="text-muted-foreground text-xs">{{
$t('ai-platform.workflow.panels.common.sysVar')
}}</span>
</div>
<div class="text-muted-foreground text-xs">
{{ $t('ai-platform.workflow.panels.start.appCodeDesc') }}
</div>
</div>
<!-- 默认的 form_code 变量不可删除 -->
<div class="border-primary/30 bg-primary/5 rounded border p-3">
<div class="mb-2 flex items-center justify-between">
<span class="text-primary text-sm font-medium">form_code</span>
<span class="text-muted-foreground text-xs">{{
$t('ai-platform.workflow.panels.common.sysVar')
}}</span>
</div>
<div class="text-muted-foreground text-xs">
{{ $t('ai-platform.workflow.panels.start.formCodeDesc') }}
</div>
</div>
<div class="flex items-center justify-between">
<span class="text-foreground text-sm font-medium">{{
$t('ai-platform.workflow.panels.common.customVars')