diff --git a/ui/AGENTS.md b/ui/AGENTS.md index 59e91105d36..ae80a85e2c3 100644 --- a/ui/AGENTS.md +++ b/ui/AGENTS.md @@ -209,6 +209,8 @@ Keep these behaviors: ## Frontend Implementation Notes - Prefer existing project structure and naming. +- Do not modify shared components under `src/components/` without an explicit user instruction to + change those components. Follow the modification boundary in `src/components/COMPONENT_README.md`. - Do not write `aria-label` attributes in project source. Add concise Chinese HTML comments before buttons to describe their purpose, following `src/components/COMPONENT_README.md`. - Before changing existing behavior, trace the affected flow and dependent requirements, including diff --git a/ui/src/components/COMPONENT_README.md b/ui/src/components/COMPONENT_README.md index 76796bf331f..dd7e2d2b8b2 100644 --- a/ui/src/components/COMPONENT_README.md +++ b/ui/src/components/COMPONENT_README.md @@ -6,6 +6,15 @@ ## 选型与目录 +### 公共组件修改边界 + +没有用户明确要求修改公共组件的指令,不允许修改 `src/components/` 下公共组件的内容, +包括 `global/`、`business/` 及其他共享组件目录中的模板、逻辑、样式和接口。 +“参考某组件”“使用某组件”或修改业务页面,不视为授权修改该公共组件。 +实现前先使用已有 Props、事件和插槽,在所属 View 或功能目录中完成组合与适配。 +确实需要修改公共组件时,先说明具体组件、必要性及影响范围,取得明确指令后再修改。 +此约束纳入实现前检查和提交前 diff 检查;已有其他工作留下的公共组件改动不擅自覆盖或回退。 + 依次检查全局 Mk 组件、业务组件、手动导入的共享 UI,最后使用 Element Plus;已有同类封装时 直接复用,例如 `MkDialog`、`MkDrawer`、`MkDropdown`、`MkIcon`、`MkTable`。先用现有 Props、 事件、插槽和样式适配,无法满足必要行为时再新增组件;无明确需求不引入新 UI 库。 @@ -71,7 +80,6 @@ Admin、Chat 入口调用 `configureMarkdownEditor()` 配置本地高亮、KaTeX ### MkCollapse `v-model:expanded` 可控制展开状态;未绑定时沿用 `defaultExpanded` 的内部状态。 -`destroyOnCollapse` 默认 `true`,设为 `false` 时折叠只隐藏内容,适用于需要保留参数表单及校验的场景。 标题折叠区,`title` 或 `label` 插槽提供标题,默认插槽提供内容。 `defaultExpanded` 默认 `true`,仅设置初始状态;点击标题内部切换,当前不提供展开状态事件。 diff --git a/ui/src/components/global/mk-collapse/index.vue b/ui/src/components/global/mk-collapse/index.vue index fe5f92d7df0..01438c59945 100644 --- a/ui/src/components/global/mk-collapse/index.vue +++ b/ui/src/components/global/mk-collapse/index.vue @@ -7,13 +7,12 @@ defineOptions({ name: 'MkCollapse' }) const props = withDefaults( defineProps<{ defaultExpanded?: boolean - destroyOnCollapse?: boolean indicatorPosition?: 'after' | 'before' title?: string triggerClass?: HTMLAttributes['class'] triggerStyle?: HTMLAttributes['style'] }>(), - { defaultExpanded: true, destroyOnCollapse: true, indicatorPosition: 'before' }, + { defaultExpanded: true, indicatorPosition: 'before' }, ) defineSlots<{ default?: () => unknown; label?: () => unknown }>() @@ -54,7 +53,7 @@ const expanded = computed({ -
+
diff --git a/ui/src/views/VIEW_README.md b/ui/src/views/VIEW_README.md index cdf21796997..17bb80802a9 100644 --- a/ui/src/views/VIEW_README.md +++ b/ui/src/views/VIEW_README.md @@ -405,13 +405,16 @@ Workspace 与 System 授权均使用该工作空间 ID,不读取路由工作 任务选择复用 `SelectApplicationDialog` 与 `SelectToolDialog`,工具限定自定义和工作流类型。 `trigger/trigger-form/request-parameters/RequestParameters.vue` 用 `MkFormList` 展示和删除事件请求参数, 同目录 `RequestParameterDialog.vue` 负责新增、编辑及参数名必填与重名校验;确认后回写,取消保留原值。 -`trigger/trigger-form/task-execution/TaskParameters.vue` 展示任务输入及事件参数引用, -`trigger/trigger-form/task-execution/task-parameters.ts` 从资源输入定义生成字段,只补全缺失值,不覆盖已有配置。 +`trigger/trigger-form/task-execution/parameters/` 内 `ApplicationParameter.vue` 与 `ToolParameter.vue` +分别生成智能体和工具字段,共用 `ParameterForm.vue` 的输入、事件引用、初始化和校验; +`types.ts` 仅维护跨组件使用的字段描述类型,不再单独拆分每个组件专用的参数工具文件。 +初始化只补全缺失值,不覆盖已有自定义配置;切回定时或移除全部事件参数时,引用参数恢复自定义默认值。 +智能体包含 Question、启用的文件类型、用户输入和接口参数;工具包含普通输入和工作流用户输入。 抽屉采用类型卡片选择,选中卡片内显示配置,触发周期与 Cron 通过切换按钮切换;新建时需选择周期。 -`trigger/trigger-form/task-execution/TriggerTaskGroups.vue` 维护任务分组、展开收起、移除及参数表单, +`trigger/trigger-form/task-execution/TaskExecution.vue` 维护任务分组、展开收起、移除及参数表单, 组件内管理智能体与工具选择弹窗、资源详情加载和任务参数保留,通过 `v-model` 回写任务、 `v-model:loading` 同步加载状态、`change` 通知清理校验,并提供 `validate`、`expandAll`、`reset`。 -任务 UI 沿用 AI Chat 技能区的 `MkCollapse` 分组和紧凑资源卡片,参数区折叠后保留挂载以支持完整校验。 +任务 UI 沿用 AI Chat 技能区的 `MkCollapse` 分组和紧凑资源卡片,保存前先展开全部任务,待参数表单挂载后统一校验。 抽屉负责触发器详情查询与保存,将详情资源快照通过 `initialResources` 传入任务组件; 任务组件新增资源后展开任务,抽屉保存时调用分组组件校验全部参数。 保存时校验所有任务,包括折叠的任务;接口失败保持抽屉打开。 diff --git a/ui/src/views/system/chat/users/UserFromDrawer.vue b/ui/src/views/system/chat/users/UserFromDrawer.vue index d8974230f1c..8ddf01bf6a6 100644 --- a/ui/src/views/system/chat/users/UserFromDrawer.vue +++ b/ui/src/views/system/chat/users/UserFromDrawer.vue @@ -148,7 +148,7 @@ defineExpose({ open }) diff --git a/ui/src/views/system/chat/users/UserListView.vue b/ui/src/views/system/chat/users/UserListView.vue index 952610f1ba6..5fff2e7f573 100644 --- a/ui/src/views/system/chat/users/UserListView.vue +++ b/ui/src/views/system/chat/users/UserListView.vue @@ -215,7 +215,7 @@ onMounted(() => loadChatUsers()) - + diff --git a/ui/src/views/system/identity/users/UserFromDrawer.vue b/ui/src/views/system/identity/users/UserFromDrawer.vue index 6b230672b04..b349cffba61 100644 --- a/ui/src/views/system/identity/users/UserFromDrawer.vue +++ b/ui/src/views/system/identity/users/UserFromDrawer.vue @@ -211,7 +211,7 @@ defineExpose({ open }) diff --git a/ui/src/views/system/identity/users/UserListView.vue b/ui/src/views/system/identity/users/UserListView.vue index a1d634a7ca8..a4571287652 100644 --- a/ui/src/views/system/identity/users/UserListView.vue +++ b/ui/src/views/system/identity/users/UserListView.vue @@ -216,7 +216,7 @@ onMounted(() => loadSystemUsers()) - + @@ -224,7 +224,7 @@ onMounted(() => loadSystemUsers()) - +
diff --git a/ui/src/views/tool/tool-form/component/init-field/InitFieldTable.vue b/ui/src/views/tool/tool-form/component/init-field/InitFieldTable.vue index 5ccbc074134..7198a52892f 100644 --- a/ui/src/views/tool/tool-form/component/init-field/InitFieldTable.vue +++ b/ui/src/views/tool/tool-form/component/init-field/InitFieldTable.vue @@ -40,9 +40,8 @@ function getTypeLabel(inputType: string) {

启动参数

- + - 添加
diff --git a/ui/src/views/tool/tool-form/component/input-field/InputFieldTable.vue b/ui/src/views/tool/tool-form/component/input-field/InputFieldTable.vue index 97df8ab2543..3b644c251d7 100644 --- a/ui/src/views/tool/tool-form/component/input-field/InputFieldTable.vue +++ b/ui/src/views/tool/tool-form/component/input-field/InputFieldTable.vue @@ -35,9 +35,8 @@ function handleDeleteInputField(index: number) {

输入参数

使用工具时显示 - + - 添加 diff --git a/ui/src/views/trigger/TriggerView.vue b/ui/src/views/trigger/TriggerView.vue index 571c628bb1d..28882d72c48 100644 --- a/ui/src/views/trigger/TriggerView.vue +++ b/ui/src/views/trigger/TriggerView.vue @@ -204,14 +204,14 @@ onMounted(() => loadTriggers()) - + - + diff --git a/ui/src/views/trigger/trigger-form/TriggerFormDrawer.vue b/ui/src/views/trigger/trigger-form/TriggerFormDrawer.vue index f88da2b6ece..49783d13a1e 100644 --- a/ui/src/views/trigger/trigger-form/TriggerFormDrawer.vue +++ b/ui/src/views/trigger/trigger-form/TriggerFormDrawer.vue @@ -7,7 +7,7 @@ import TriggerApi from '@/api/admin/workspace/trigger/trigger' import { ADMIN_API_BASE_PATH } from '@/api/constants' import { RESOURCE_TYPE, TRIGGER_TYPE, TRIGGER_SCHEDULE_TYPE as SCHEDULE, TRIGGER_INTERVAL_UNIT as INTERVAL } from '@/api/enums' import type { ApplicationDetail, ToolItem, TriggerPayload, TriggerSetting } from '@/api/types' -import TriggerTaskGroups from './task-execution/TriggerTaskGroups.vue' +import TaskExecution from './task-execution/TaskExecution.vue' import RequestParameters from './request-parameters/RequestParameters.vue' import { copyText } from '@/utils/clipboard' import { MsgSuccess } from '@/utils/message' @@ -21,7 +21,7 @@ const detailFailed = ref(false) const editingId = ref() const formRef = ref() const presetScheduleType = ref() -const taskGroupsRef = ref>() +const taskExecutionRef = ref>() const resources = ref>>({}) // HTTP 部署中 randomUUID 可能不可用,使用浏览器安全随机数生成 UUID。 @@ -184,10 +184,9 @@ function handleSave() { form.value.name = form.value.name.trim() saving.value = true return nextTick() - .then(() => Promise.all([formRef.value?.validate().catch(() => false), taskGroupsRef.value?.validate()])) + .then(() => Promise.all([formRef.value?.validate().catch(() => false), taskExecutionRef.value?.validate()])) .then((validations) => { if (validations.some((valid) => !valid)) { - taskGroupsRef.value?.expandAll() return } const payload = cloneDeep(form.value) @@ -226,7 +225,7 @@ function resetData() { saving.value = false detailFailed.value = false resources.value = {} - taskGroupsRef.value?.reset() + taskExecutionRef.value?.reset() presetScheduleType.value = undefined formRef.value?.clearValidate() } @@ -293,7 +292,7 @@ defineExpose({ open }) @@ -303,16 +302,16 @@ defineExpose({ open }) - + @@ -323,12 +322,11 @@ defineExpose({ open })
-
请求参数
- 添加参数 + + +