Skip to content

Commit e34cf79

Browse files
author
linyuan.yang
committed
频道编辑
1 parent d4f6c53 commit e34cf79

3 files changed

Lines changed: 36 additions & 18 deletions

File tree

‎packages/admin/src/components/SessionDataConfigEditor.vue‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,24 @@ function updateBool(key: 'streamVerbose' | 'autoApproveAllTools' | 'disableWorks
141141
update(key, isProfileMode() && value === '' ? null : value === 'true')
142142
}
143143
144+
/**
145+
* 工作目录自动注入类字段:底层存的是 disable* (关闭)语义,UI 上以正向「自动注入 启用/禁用」呈现,
146+
* 因此这里对 select 的 true/false 做一次反转:启用注入 = disable false,禁用注入 = disable true。
147+
*/
148+
type WorkspaceInjectKey = 'disableWorkspaceContext' | 'disableWorkspaceSkills' | 'disableWorkspaceMcp'
149+
function injectSelectValue(key: WorkspaceInjectKey): string {
150+
const v = props.modelValue[key]
151+
if (isProfileMode() && v === null) return ''
152+
return v ? 'false' : 'true'
153+
}
154+
155+
function updateInject(key: WorkspaceInjectKey, value: string) {
156+
update(key, isProfileMode() && value === '' ? null : value !== 'true')
157+
}
158+
159+
/** 继承值显示:底层 disable=true 表示「禁用注入」,disable=false 表示「启用注入」 */
160+
const fmtInject = (v: any) => v ? t('common.disabled') : t('common.enabled')
161+
144162
/** memory/agenda 引用:profile 模式下空串 = 沿用 channel;channel 模式下空串 = 不启用 */
145163
function refSelectValue(key: 'memory' | 'agenda'): string {
146164
return props.modelValue[key] ?? ''
@@ -224,22 +242,22 @@ function setTimeoutMode(key: 'approvalTimeout' | 'askTimeout', mode: string) {
224242
</div>
225243
</SFormItem>
226244

227-
<SFormItem :label="t('agents.disable_workspace_context')" :hint="inheritLabel('disableWorkspaceContext', fmtBool) || t('agents.disable_workspace_context_hint')">
228-
<SSelect :model-value="booleanSelectValue('disableWorkspaceContext')" @update:model-value="v => updateBool('disableWorkspaceContext', String(v))">
245+
<SFormItem :label="t('agents.disable_workspace_context')" :hint="inheritLabel('disableWorkspaceContext', fmtInject) || t('agents.disable_workspace_context_hint')">
246+
<SSelect :model-value="injectSelectValue('disableWorkspaceContext')" @update:model-value="v => updateInject('disableWorkspaceContext', String(v))">
229247
<option v-if="isProfileMode()" value="">{{ t('channels.use_channel_default') }}</option>
230248
<option value="true">{{ t('common.enabled') }}</option>
231249
<option value="false">{{ t('common.disabled') }}</option>
232250
</SSelect>
233251
</SFormItem>
234-
<SFormItem :label="t('agents.disable_workspace_skills')" :hint="inheritLabel('disableWorkspaceSkills', fmtBool) || t('agents.disable_workspace_skills_hint')">
235-
<SSelect :model-value="booleanSelectValue('disableWorkspaceSkills')" @update:model-value="v => updateBool('disableWorkspaceSkills', String(v))">
252+
<SFormItem :label="t('agents.disable_workspace_skills')" :hint="inheritLabel('disableWorkspaceSkills', fmtInject) || t('agents.disable_workspace_skills_hint')">
253+
<SSelect :model-value="injectSelectValue('disableWorkspaceSkills')" @update:model-value="v => updateInject('disableWorkspaceSkills', String(v))">
236254
<option v-if="isProfileMode()" value="">{{ t('channels.use_channel_default') }}</option>
237255
<option value="true">{{ t('common.enabled') }}</option>
238256
<option value="false">{{ t('common.disabled') }}</option>
239257
</SSelect>
240258
</SFormItem>
241-
<SFormItem :label="t('agents.disable_workspace_mcp')" :hint="inheritLabel('disableWorkspaceMcp', fmtBool) || t('agents.disable_workspace_mcp_hint')">
242-
<SSelect :model-value="booleanSelectValue('disableWorkspaceMcp')" @update:model-value="v => updateBool('disableWorkspaceMcp', String(v))">
259+
<SFormItem :label="t('agents.disable_workspace_mcp')" :hint="inheritLabel('disableWorkspaceMcp', fmtInject) || t('agents.disable_workspace_mcp_hint')">
260+
<SSelect :model-value="injectSelectValue('disableWorkspaceMcp')" @update:model-value="v => updateInject('disableWorkspaceMcp', String(v))">
243261
<option v-if="isProfileMode()" value="">{{ t('channels.use_channel_default') }}</option>
244262
<option value="true">{{ t('common.enabled') }}</option>
245263
<option value="false">{{ t('common.disabled') }}</option>

‎packages/admin/src/i18n/en.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,12 @@ export default {
738738
basic_info: 'Basic Info',
739739
system_prompt: 'System Prompt',
740740
auto_approve_all_tools: 'Auto-approve all tools',
741-
disable_workspace_context: 'Disable workspace context auto-injection',
742-
disable_workspace_context_hint: 'When enabled, sessions using this config will not read SBOT.md / AGENTS.md or similar files from the workspace',
743-
disable_workspace_skills: 'Disable workspace skill auto-import',
744-
disable_workspace_skills_hint: 'When enabled, sessions using this config will not load skills from the workspace .skills/ directory',
745-
disable_workspace_mcp: 'Disable workspace MCP auto-import',
746-
disable_workspace_mcp_hint: 'When enabled, sessions using this config will not load MCP servers from the workspace .mcp.json',
741+
disable_workspace_context: 'Workspace context auto-injection',
742+
disable_workspace_context_hint: 'When enabled, sessions using this config read and inject SBOT.md / AGENTS.md and similar files from the workspace; disable to skip',
743+
disable_workspace_skills: 'Workspace skill auto-import',
744+
disable_workspace_skills_hint: 'When enabled, sessions using this config load skills from the workspace .skills/ directory; disable to skip',
745+
disable_workspace_mcp: 'Workspace MCP auto-import',
746+
disable_workspace_mcp_hint: 'When enabled, sessions using this config load MCP servers from the workspace .mcp.json; disable to skip',
747747
compact_model: 'Compact Model',
748748
compact_model_placeholder: 'Uses main model if not set',
749749
compact_model_hint: 'Automatically compresses conversation history when it gets too long. Uses the main model if not specified.',

‎packages/admin/src/i18n/zh.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,12 @@ export default {
738738
basic_info: '基本信息',
739739
system_prompt: '系统提示词',
740740
auto_approve_all_tools: '自动批准所有工具',
741-
disable_workspace_context: '关闭工作目录上下文自动注入',
742-
disable_workspace_context_hint: '开启后,此配置下的会话不会从工作目录读取 SBOT.md / AGENTS.md 等上下文文件',
743-
disable_workspace_skills: '关闭工作目录 Skill 自动导入',
744-
disable_workspace_skills_hint: '开启后,此配置下的会话不会加载工作目录下 .skills/ 子目录里的 skill',
745-
disable_workspace_mcp: '关闭工作目录 MCP 自动导入',
746-
disable_workspace_mcp_hint: '开启后,此配置下的会话不会加载工作目录下 .mcp.json 里的 MCP server',
741+
disable_workspace_context: '工作目录上下文自动注入',
742+
disable_workspace_context_hint: '启用后,此配置下的会话会从工作目录读取 SBOT.md / AGENTS.md 等上下文文件并注入;禁用则不读取',
743+
disable_workspace_skills: '工作目录 Skill 自动导入',
744+
disable_workspace_skills_hint: '启用后,此配置下的会话会加载工作目录下 .skills/ 子目录里的 skill;禁用则不加载',
745+
disable_workspace_mcp: '工作目录 MCP 自动导入',
746+
disable_workspace_mcp_hint: '启用后,此配置下的会话会加载工作目录下 .mcp.json 里的 MCP server;禁用则不加载',
747747
compact_model: '对话压缩模型',
748748
compact_model_placeholder: '不配置则使用主模型压缩',
749749
compact_model_hint: '对话过长时自动压缩历史消息,不配置则使用主模型进行压缩',

0 commit comments

Comments
 (0)