@@ -12,13 +12,14 @@ import { DatasourceConfig } from './DatasourceConfig';
1212import { MCPConfig } from './MCPConfig' ;
1313import { DeepThink } from './DeepThink' ;
1414import { formatESSearchResult } from '@/service/request/es' ;
15- import ModelSelect from './ModelSelect' ;
15+ import ModelSelect , { DefaultPromptTemplates } from './ModelSelect' ;
1616import { ToolsConfig } from './ToolsConfig' ;
1717import { getUUID } from '@/utils/common' ;
1818import { Tags } from '@/components/common/tags' ;
1919import { getAssistantCategory } from '@/service/api/assistant' ;
2020import { UploadConfig } from './UploadConfig' ;
2121import classNames from 'classnames' ;
22+ import AvailableVariable from './AvailableVariable' ;
2223
2324interface AssistantFormProps {
2425 initialValues : any ;
@@ -91,7 +92,7 @@ export const EditForm = memo((props: AssistantFormProps) => {
9192 } , [ ] ) ;
9293 const { defaultRequiredRule, formRules } = useFormRules ( ) ;
9394
94- const [ showAdvanced , setShowAdvanced ] = useState ( true ) ;
95+ const [ showAdvanced , setShowAdvanced ] = useState ( false ) ;
9596 const {
9697 data : result ,
9798 run,
@@ -184,6 +185,7 @@ export const EditForm = memo((props: AssistantFormProps) => {
184185 return (
185186 < Collapse
186187 className = 'mb-4 w-150'
188+ defaultActiveKey = 'intent-recognition'
187189 items = { [
188190 {
189191 key : 'intent-recognition' ,
@@ -208,33 +210,40 @@ export const EditForm = memo((props: AssistantFormProps) => {
208210 key : 'internet-search' ,
209211 label : t ( 'page.assistant.labels.internet_search' ) ,
210212 extra : (
211- < Form . Item
212- className = 'mb-0! [&_*]:min-h-[unset]!'
213- name = { [ 'datasource' , 'enabled' ] }
213+ < div
214+ onClick = { event => {
215+ event . stopPropagation ( ) ;
216+ } }
214217 >
215- < Switch size = 'small' />
216- </ Form . Item >
218+ < Form . Item
219+ className = 'mb-0! [&_*]:min-h-[unset]!'
220+ initialValue = { false }
221+ name = { [ 'datasource' , 'enabled' ] }
222+ >
223+ < Switch size = 'small' />
224+ </ Form . Item >
225+ </ div >
217226 ) ,
218227 children : (
219228 < >
220229 { assistantMode === 'deep_think' && (
221230 < >
222231 < Form . Item
223232 className = 'mb-4! [&_.ant-form-item-control]:flex-[unset]!'
224- extra = '由模型根据上下文、查询意图等判断是否执行该流程'
233+ extra = { t ( 'page.assistant.hints.searchExecutionStrategy' ) }
225234 initialValue = { false }
226- label = '执行策略'
235+ label = { t ( 'page.assistant.labels.executionStrategy' ) }
227236 layout = 'vertical'
228237 name = { [ 'config' , 'pick_datasource' ] }
229238 >
230239 < Select
231240 options = { [
232241 {
233- label : '总是执行' ,
242+ label : t ( 'page.assistant.options.alwaysExecute' ) ,
234243 value : true
235244 } ,
236245 {
237- label : '智能决策' ,
246+ label : t ( 'page.assistant.options.intelligentDecisionMaking' ) ,
238247 value : false
239248 }
240249 ] }
@@ -243,12 +252,13 @@ export const EditForm = memo((props: AssistantFormProps) => {
243252
244253 < Form . Item
245254 className = '[&_.ant-form-item-control]:flex-[unset]!'
246- label = '文档预选模型'
255+ label = { t ( 'page.settings.llm.picking_doc_model' ) }
247256 layout = 'vertical'
248257 name = { [ 'config' , 'picking_doc_model' ] }
249258 >
250259 < ModelSelect
251260 modelType = 'picking_doc_model'
261+ namePrefix = { [ 'config' , 'picking_doc_model' ] }
252262 providers = { modelProviders }
253263 />
254264 </ Form . Item >
@@ -287,12 +297,19 @@ export const EditForm = memo((props: AssistantFormProps) => {
287297 key : 'large-model-tools' ,
288298 label : t ( 'page.assistant.labels.large_model_tool' ) ,
289299 extra : (
290- < Form . Item
291- className = 'mb-0! [&_*]:(min-h-[unset]!)'
292- name = { [ 'mcp_servers' , 'enabled' ] }
300+ < div
301+ onClick = { event => {
302+ event . stopPropagation ( ) ;
303+ } }
293304 >
294- < Switch size = 'small' />
295- </ Form . Item >
305+ < Form . Item
306+ className = 'mb-0! [&_*]:(min-h-[unset]!)'
307+ initialValue = { false }
308+ name = { [ 'mcp_servers' , 'enabled' ] }
309+ >
310+ < Switch size = 'small' />
311+ </ Form . Item >
312+ </ div >
296313 ) ,
297314 children : (
298315 < Form . Item
@@ -303,20 +320,20 @@ export const EditForm = memo((props: AssistantFormProps) => {
303320 { assistantMode === 'deep_think' && (
304321 < Form . Item
305322 className = 'mb-4! [&_.ant-form-item-control]:flex-[unset]!'
306- extra = '无论模型是否认为必要,都执行该流程'
323+ extra = { t ( 'page.assistant.hints.llmExecutionStrategy' ) }
307324 initialValue = { false }
308- label = '执行策略'
325+ label = { t ( 'page.assistant.labels.executionStrategy' ) }
309326 layout = 'vertical'
310327 name = { [ 'config' , 'pick_tools' ] }
311328 >
312329 < Select
313330 options = { [
314331 {
315- label : '总是执行' ,
332+ label : t ( 'page.assistant.options.alwaysExecute' ) ,
316333 value : true
317334 } ,
318335 {
319- label : '智能决策' ,
336+ label : t ( 'page.assistant.options.intelligentDecisionMaking' ) ,
320337 value : false
321338 }
322339 ] }
@@ -363,6 +380,7 @@ export const EditForm = memo((props: AssistantFormProps) => {
363380 >
364381 < ModelSelect
365382 modelType = 'answering_model'
383+ namePrefix = { [ 'answering_model' ] }
366384 providers = { modelProviders }
367385 />
368386 </ Form . Item >
@@ -506,6 +524,7 @@ export const EditForm = memo((props: AssistantFormProps) => {
506524 >
507525 < ModelSelect
508526 modelType = 'answering_model'
527+ namePrefix = { [ 'answering_model' ] }
509528 providers = { modelProviders }
510529 showTemplate = { false }
511530 width = '600px'
@@ -515,8 +534,10 @@ export const EditForm = memo((props: AssistantFormProps) => {
515534
516535 { assistantMode === 'simple' && (
517536 < Form . Item
537+ extra = { < AvailableVariable type = 'answering_model' /> }
538+ initialValue = { DefaultPromptTemplates . answering_model }
518539 label = { t ( 'page.assistant.labels.role_prompt' ) }
519- name = { [ 'prompt' , 'template' ] }
540+ name = { [ 'answering_model' , ' prompt', 'template' ] }
520541 >
521542 < Input . TextArea
522543 className = 'w-600px'
0 commit comments