11<script setup lang="ts">
2- import { ref } from ' vue'
32import { useI18n } from ' vue-i18n'
4- import { SInput , STextarea , SSelect , SFormItem , SMultiSelect } from ' sbot-ui'
3+ import { SInput , STextarea , SSelect , SFormItem , SMultiSelect , SButton } from ' sbot-ui'
54import { ApprovalTimeoutValue } from ' sbot.commons'
65
76/**
@@ -45,10 +44,10 @@ const props = defineProps<{
4544
4645const emit = defineEmits <{
4746 (e : ' update:modelValue' , v : SessionOverrides ): void
47+ (e : ' browse-path' ): void
4848}>()
4949
5050const { t } = useI18n ()
51- const showAdvanced = ref (false )
5251
5352function update<K extends keyof SessionOverrides >(key : K , val : SessionOverrides [K ]) {
5453 emit (' update:modelValue' , { ... props .modelValue , [key ]: val })
@@ -121,59 +120,58 @@ const fmtApprovalValue = (v: any) => v === ApprovalTimeoutValue.Allow ? t('chann
121120 </SFormItem >
122121
123122 <SFormItem :label =" t (' directory.path_label' )" :hint =" inheritLabel (' workPath' )" >
124- <SInput :model-value =" modelValue .workPath ?? ' ' " type="text" @update :model-value =" v => update (' workPath' , String (v ).trim () ? String (v ) : null )" />
123+ <div class =" path-row" >
124+ <SInput :model-value =" modelValue .workPath ?? ' ' " type="text" class="path-input" @update :model-value =" v => update (' workPath' , String (v ).trim () ? String (v ) : null )" />
125+ <SButton type="outline" size="sm" @click =" emit (' browse-path' )" >{{ t('directory.browse') }}</SButton >
126+ </div >
125127 </SFormItem >
126128
127- <button class =" advanced-toggle" type =" button" @click =" showAdvanced = !showAdvanced" >
128- {{ showAdvanced ? t('channels.section_advanced_hide') : t('channels.section_advanced_show', { n: 7 }) }}
129- </button >
129+ <h4 class =" form-section-title" >{{ t('channels.section_advanced') }}</h4 >
130130
131- <template v-if =" showAdvanced " >
132- <SFormItem :label =" t (' channels.stream_verbose' )" :hint =" inheritLabel (' streamVerbose' , fmtBool ) || t (' channels.stream_verbose_hint' )" >
133- <SSelect :model-value =" modelValue .streamVerbose === null ? ' ' : String (modelValue .streamVerbose )" @update :model-value =" v => update (' streamVerbose' , v === ' ' ? null : v === ' true' )" >
134- <option value =" " >{{ t('channels.use_channel_default') }}</option >
135- <option value =" true" >{{ t('common.enabled') }}</option >
136- <option value =" false" >{{ t('common.disabled') }}</option >
137- </SSelect >
138- </SFormItem >
139- <SFormItem :label =" t (' settings.auto_approve_all' )" :hint =" inheritLabel (' autoApproveAllTools' , fmtBool ) || t (' settings.auto_approve_all_hint' )" >
140- <SSelect :model-value =" modelValue .autoApproveAllTools === null ? ' ' : String (modelValue .autoApproveAllTools )" @update :model-value =" v => update (' autoApproveAllTools' , v === ' ' ? null : v === ' true' )" >
141- <option value =" " >{{ t('channels.use_channel_default') }}</option >
142- <option value =" true" >{{ t('common.enabled') }}</option >
143- <option value =" false" >{{ t('common.disabled') }}</option >
144- </SSelect >
145- </SFormItem >
146- <SFormItem :label =" t (' channels.approval_timeout' )" :hint =" inheritLabel (' approvalTimeout' ) || t (' channels.approval_timeout_hint' )" >
147- <SInput :model-value =" modelValue .approvalTimeout ?? ' ' " type="number" placeholder="0" @update :model-value =" v => update (' approvalTimeout' , (v === ' ' || v === null || Number (v ) <= 0 ) ? null : Number (v ))" />
148- </SFormItem >
149- <SFormItem v-if =" modelValue .approvalTimeout != null && modelValue .approvalTimeout > 0 " :label =" t (' channels.approval_timeout_value' )" :hint =" inheritLabel (' approvalTimeoutValue' , fmtApprovalValue )" >
150- <SSelect :model-value =" modelValue .approvalTimeoutValue ?? ' ' " @update :model-value =" v => update (' approvalTimeoutValue' , v === ' ' ? null : v as ApprovalTimeoutValue )" >
151- <option value =" " >{{ t('channels.use_channel_default') }}</option >
152- <option :value =" ApprovalTimeoutValue.Deny" >{{ t('channels.approval_timeout_value_deny') }}</option >
153- <option :value =" ApprovalTimeoutValue.Allow" >{{ t('channels.approval_timeout_value_allow') }}</option >
154- </SSelect >
155- </SFormItem >
156- <SFormItem :label =" t (' channels.ask_timeout' )" :hint =" inheritLabel (' askTimeout' ) || t (' channels.ask_timeout_hint' )" >
157- <SInput :model-value =" modelValue .askTimeout ?? ' ' " type="number" placeholder="0" @update :model-value =" v => update (' askTimeout' , (v === ' ' || v === null || Number (v ) <= 0 ) ? null : Number (v ))" />
158- </SFormItem >
159- <SFormItem v-if =" modelValue .askTimeout != null && modelValue .askTimeout > 0 " :label =" t (' channels.ask_timeout_message' )" :hint =" inheritLabel (' askTimeoutMessage' ) || t (' channels.ask_timeout_message_hint' )" >
160- <SInput :model-value =" modelValue .askTimeoutMessage ?? ' ' " type="text" @update :model-value =" v => update (' askTimeoutMessage' , String (v ).trim () ? String (v ) : null )" />
131+ <SFormItem :label =" t (' channels.stream_verbose' )" :hint =" inheritLabel (' streamVerbose' , fmtBool ) || t (' channels.stream_verbose_hint' )" >
132+ <SSelect :model-value =" modelValue .streamVerbose === null ? ' ' : String (modelValue .streamVerbose )" @update :model-value =" v => update (' streamVerbose' , v === ' ' ? null : v === ' true' )" >
133+ <option value =" " >{{ t('channels.use_channel_default') }}</option >
134+ <option value =" true" >{{ t('common.enabled') }}</option >
135+ <option value =" false" >{{ t('common.disabled') }}</option >
136+ </SSelect >
137+ </SFormItem >
138+ <SFormItem :label =" t (' settings.auto_approve_all' )" :hint =" inheritLabel (' autoApproveAllTools' , fmtBool ) || t (' settings.auto_approve_all_hint' )" >
139+ <SSelect :model-value =" modelValue .autoApproveAllTools === null ? ' ' : String (modelValue .autoApproveAllTools )" @update :model-value =" v => update (' autoApproveAllTools' , v === ' ' ? null : v === ' true' )" >
140+ <option value =" " >{{ t('channels.use_channel_default') }}</option >
141+ <option value =" true" >{{ t('common.enabled') }}</option >
142+ <option value =" false" >{{ t('common.disabled') }}</option >
143+ </SSelect >
144+ </SFormItem >
145+ <SFormItem :label =" t (' channels.approval_timeout' )" :hint =" inheritLabel (' approvalTimeout' ) || t (' channels.approval_timeout_hint' )" >
146+ <SInput :model-value =" modelValue .approvalTimeout ?? ' ' " type="number" placeholder="0" @update :model-value =" v => update (' approvalTimeout' , (v === ' ' || v === null || Number (v ) <= 0 ) ? null : Number (v ))" />
147+ </SFormItem >
148+ <SFormItem v-if =" modelValue .approvalTimeout != null && modelValue .approvalTimeout > 0 " :label =" t (' channels.approval_timeout_value' )" :hint =" inheritLabel (' approvalTimeoutValue' , fmtApprovalValue )" >
149+ <SSelect :model-value =" modelValue .approvalTimeoutValue ?? ' ' " @update :model-value =" v => update (' approvalTimeoutValue' , v === ' ' ? null : v as ApprovalTimeoutValue )" >
150+ <option value =" " >{{ t('channels.use_channel_default') }}</option >
151+ <option :value =" ApprovalTimeoutValue.Deny" >{{ t('channels.approval_timeout_value_deny') }}</option >
152+ <option :value =" ApprovalTimeoutValue.Allow" >{{ t('channels.approval_timeout_value_allow') }}</option >
153+ </SSelect >
154+ </SFormItem >
155+ <SFormItem :label =" t (' channels.ask_timeout' )" :hint =" inheritLabel (' askTimeout' ) || t (' channels.ask_timeout_hint' )" >
156+ <SInput :model-value =" modelValue .askTimeout ?? ' ' " type="number" placeholder="0" @update :model-value =" v => update (' askTimeout' , (v === ' ' || v === null || Number (v ) <= 0 ) ? null : Number (v ))" />
157+ </SFormItem >
158+ <SFormItem v-if =" modelValue .askTimeout != null && modelValue .askTimeout > 0 " :label =" t (' channels.ask_timeout_message' )" :hint =" inheritLabel (' askTimeoutMessage' ) || t (' channels.ask_timeout_message_hint' )" >
159+ <SInput :model-value =" modelValue .askTimeoutMessage ?? ' ' " type="text" @update :model-value =" v => update (' askTimeoutMessage' , String (v ).trim () ? String (v ) : null )" />
160+ </SFormItem >
161+ <SFormItem :label =" t (' channels.intent_model' )" :hint =" inheritLabel (' intentModel' , fmtModel ) || t (' channels.intent_model_hint' )" >
162+ <SSelect :model-value =" modelValue .intentModel ?? ' __default__' " @update :model-value =" v => update (' intentModel' , v === ' __default__' ? null : String (v ))" >
163+ <option value =" __default__" >{{ t('channels.use_channel_default') }}</option >
164+ <option value =" " >{{ t('common.not_use') }}</option >
165+ <option v-for =" m in modelOptions" :key =" m.id" :value =" m.id" >{{ m.label }}</option >
166+ </SSelect >
167+ </SFormItem >
168+ <template v-if =" modelValue .intentModel " >
169+ <SFormItem :label =" t (' channels.intent_threshold' )" :hint =" inheritLabel (' intentThreshold' ) || t (' channels.intent_threshold_hint' )" >
170+ <SInput :model-value =" modelValue .intentThreshold ?? ' ' " type="number" placeholder="0.7 " @update :model-value =" v => update (' intentThreshold' , v === ' ' || v === null ? null : Number (v ))" />
161171 </SFormItem >
162- <SFormItem :label =" t (' channels.intent_model' )" :hint =" inheritLabel (' intentModel' , fmtModel ) || t (' channels.intent_model_hint' )" >
163- <SSelect :model-value =" modelValue .intentModel ?? ' __default__' " @update :model-value =" v => update (' intentModel' , v === ' __default__' ? null : String (v ))" >
164- <option value =" __default__" >{{ t('channels.use_channel_default') }}</option >
165- <option value =" " >{{ t('common.not_use') }}</option >
166- <option v-for =" m in modelOptions" :key =" m.id" :value =" m.id" >{{ m.label }}</option >
167- </SSelect >
172+ <SFormItem :label =" t (' channels.intent_prompt' )" :hint =" inheritLabel (' intentPrompt' )" >
173+ <STextarea :model-value =" modelValue .intentPrompt ?? ' ' " :rows =" 4 " :placeholder =" t (' channels.intent_prompt_placeholder' )" @update :model-value =" v => update (' intentPrompt' , String (v ).trim () ? String (v ) : null )" />
168174 </SFormItem >
169- <template v-if =" modelValue .intentModel " >
170- <SFormItem :label =" t (' channels.intent_threshold' )" :hint =" inheritLabel (' intentThreshold' ) || t (' channels.intent_threshold_hint' )" >
171- <SInput :model-value =" modelValue .intentThreshold ?? ' ' " type="number" placeholder="0.7 " @update :model-value =" v => update (' intentThreshold' , v === ' ' || v === null ? null : Number (v ))" />
172- </SFormItem >
173- <SFormItem :label =" t (' channels.intent_prompt' )" :hint =" inheritLabel (' intentPrompt' )" >
174- <STextarea :model-value =" modelValue .intentPrompt ?? ' ' " :rows =" 4 " :placeholder =" t (' channels.intent_prompt_placeholder' )" @update :model-value =" v => update (' intentPrompt' , String (v ).trim () ? String (v ) : null )" />
175- </SFormItem >
176- </template >
177175 </template >
178176 </div >
179177</template >
@@ -189,20 +187,11 @@ const fmtApprovalValue = (v: any) => v === ApprovalTimeoutValue.Allow ? t('chann
189187 text-transform : uppercase ;
190188 letter-spacing : 0.04em ;
191189}
192- .advanced-toggle {
193- display : block ;
194- width : 100% ;
195- margin : var (--sui-sp-5 ) 0 var (--sui-sp-3 );
196- padding : var (--sui-sp-3 ) var (--sui-sp-4 );
197- background : var (--sui-bg-subtle );
198- border : 1px dashed var (--sui-border );
199- border-radius : var (--sui-radius-md );
200- color : var (--sui-fg-secondary );
201- font-size : var (--sui-fs-sm );
202- cursor : pointer ;
203- text-align : center ;
204- transition : background var (--sui-transition-fast );
190+ .path-row {
191+ display : flex ;
192+ gap : var (--sui-sp-2 );
193+ align-items : stretch ;
205194}
206- .advanced-toggle :hover { background : var ( --sui-bg-hover ); color : var ( --sui-fg ) ; }
195+ .path-input { flex : 1 ; }
207196.nested-form-item { margin-top : var (--sui-sp-3 ); }
208197 </style >
0 commit comments