@@ -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 模式下空串 = 不启用 */
145163function 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 >
0 commit comments