-
Notifications
You must be signed in to change notification settings - Fork 650
Expand file tree
/
Copy pathChatConfig.vue
More file actions
846 lines (782 loc) · 29.1 KB
/
ChatConfig.vue
File metadata and controls
846 lines (782 loc) · 29.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { computed, watch, ref } from 'vue'
import { useSettingsStore } from '@/stores/settings'
import { Label } from '@/components/ui/label'
import { Slider } from '@/components/ui/slider'
import { Icon } from '@iconify/vue'
import { Textarea } from '@/components/ui/textarea'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
import { useLanguageStore } from '@/stores/language'
import { Input } from '@/components/ui/input'
import { Switch } from '@/components/ui/switch'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue
} from '@/components/ui/select'
// Define props to receive config from parent
const props = defineProps<{
contextLengthLimit?: number
maxTokensLimit?: number
temperature: number
contextLength: number
maxTokens: number
artifacts: number
thinkingBudget?: number
enableSearch?: boolean
forcedSearch?: boolean
searchStrategy?: 'turbo' | 'max'
modelId?: string
providerId?: string
reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high'
verbosity?: 'low' | 'medium' | 'high'
modelType?: 'chat' | 'imageGeneration' | 'embedding' | 'rerank'
}>()
const systemPrompt = defineModel<string>('systemPrompt')
// 判断是否为图片生成模型
const isImageGenerationModel = computed(() => {
return props.modelType === 'imageGeneration'
})
// 当模型类型改变且为图片生成模型时,清空系统提示词
watch(
() => props.modelType,
(newType) => {
if (newType === 'imageGeneration' && systemPrompt.value) {
systemPrompt.value = ''
}
}
)
// Define emits to send updates to parent
const emit = defineEmits<{
'update:temperature': [value: number]
'update:contextLength': [value: number]
'update:maxTokens': [value: number]
'update:thinkingBudget': [value: number | undefined]
'update:enableSearch': [value: boolean | undefined]
'update:forcedSearch': [value: boolean | undefined]
'update:searchStrategy': [value: 'turbo' | 'max' | undefined]
'update:reasoningEffort': [value: 'minimal' | 'low' | 'medium' | 'high']
'update:verbosity': [value: 'low' | 'medium' | 'high']
// 'update:artifacts': [value: 0 | 1]
}>()
const { t } = useI18n()
const langStore = useLanguageStore()
const settingsStore = useSettingsStore()
const modelReasoning = ref(false)
const getModelReasoning = async () => {
if (!props.modelId || !props.providerId) return false
try {
const modelConfig = await settingsStore.getModelConfig(props.modelId, props.providerId)
return modelConfig.reasoning || false
} catch (error) {
return false
}
}
watch(
() => [props.modelId, props.providerId],
async () => {
modelReasoning.value = await getModelReasoning()
},
{ immediate: true }
)
// Create computed properties for slider values (which expect arrays)
const temperatureValue = computed({
get: () => [props.temperature],
set: (value) => emit('update:temperature', value[0])
})
const contextLengthValue = computed({
get: () => [props.contextLength],
set: (value) => emit('update:contextLength', value[0])
})
const maxTokensValue = computed({
get: () => [props.maxTokens],
set: (value) => emit('update:maxTokens', value[0])
})
// Computed property for artifacts toggle
// const artifactsEnabled = computed({
// get: () => props.artifacts === 1,
// set: (value) => emit('update:artifacts', value ? 1 : 0)
// })
const formatSize = (size: number): string => {
if (size >= 1024 * 1024) {
return `${(size / (1024 * 1024)).toFixed(1)}M`
} else if (size >= 1024) {
return `${(size / 1024).toFixed(1)}K`
}
return `${size}`
}
// 是否显示思考预算配置 - 支持 Gemini 2.5 系列和 Qwen3 系列
const showThinkingBudget = computed(() => {
// Gemini 2.5 系列
const isGemini = props.providerId === 'gemini'
const isGemini25 = props.modelId?.includes('gemini-2.5')
// DashScope
const isDashscope = props.providerId === 'dashscope'
const modelId = props.modelId?.toLowerCase() || ''
const supportedQwenThinkingModels = [
// Open source versions
'qwen3-next-80b-a3b-thinking',
'qwen3-235b-a22b',
'qwen3-32b',
'qwen3-30b-a3b',
'qwen3-14b',
'qwen3-8b',
'qwen3-4b',
'qwen3-1.7b',
'qwen3-0.6b',
// Commercial versions
'qwen-plus',
'qwen-flash',
'qwen-turbo'
]
const isQwenThinking = supportedQwenThinkingModels.some((supportedModel) =>
modelId.includes(supportedModel)
)
return (isGemini && isGemini25) || (isDashscope && isQwenThinking && modelReasoning.value)
})
// 是否显示搜索配置 - 支持 Dashscope 的特定模型
const showDashscopeSearchConfig = computed(() => {
const isDashscope = props.providerId === 'dashscope'
if (!isDashscope || !props.modelId) return false
// Dashscope - ENABLE_SEARCH_MODELS
const enableSearchModels = [
'qwen3-max-preview',
'qwen3-max',
'qwen-max',
'qwen-plus',
'qwen-plus-latest',
'qwen-plus-2025-07-14',
'qwen-flash',
'qwen-flash-2025-07-28',
'qwen-turbo',
'qwen-turbo-latest',
'qwen-turbo-2025-07-15',
'qwq-plus'
]
return enableSearchModels.some((modelName) =>
props.modelId?.toLowerCase().includes(modelName.toLowerCase())
)
})
// 是否显示搜索配置 - 支持 Gemini 的特定模型
const showGeminiSearchConfig = computed(() => {
const isSearchableModel = props.providerId === 'gemini'
if (!isSearchableModel || !props.modelId) return false
// ENABLE_SEARCH_MODELS
const enableSearchModels = [
'gemini-2.5-pro',
'gemini-2.5-flash',
'gemini-2.5-flash-lite',
'gemini-2.5-flash-lite-preview-06-17',
'gemini-2.0-flash',
'gemini-2.0-flash-lite',
'gemini-1.5-pro',
'gemini-1.5-flash'
]
return enableSearchModels.some((modelName) =>
props.modelId?.toLowerCase().includes(modelName.toLowerCase())
)
})
const isGPT5Model = computed(() => {
const modelId = props.modelId?.toLowerCase() || ''
return modelId.includes('gpt-5')
})
// 判断模型是否支持 reasoningEffort 参数
const supportsReasoningEffort = computed(() => {
return props.reasoningEffort !== undefined
})
// 当前显示的思考预算值
const displayThinkingBudget = computed({
get: () => {
// 如果对话有设置值,显示对话的值
if (props.thinkingBudget !== undefined) {
return props.thinkingBudget
}
// 如果对话没有设置,显示空值(让用户知道这是未设置状态)
return undefined
},
set: (value) => {
emit('update:thinkingBudget', value)
}
})
// 处理动态思维开关
const handleDynamicThinkingToggle = (enabled: boolean) => {
if (enabled) {
emit('update:thinkingBudget', -1) // 动态思维
} else {
// 设置为 1024
emit('update:thinkingBudget', 1024)
}
}
// 获取 Qwen3 模型的最大思考预算
const getQwen3MaxBudget = (): number => {
const modelId = props.modelId?.toLowerCase() || ''
// 根据不同的 Qwen3 模型返回不同的最大值
if (modelId.includes('qwen3-235b-a22b') || modelId.includes('qwen3-30b-a3b')) {
return 81920
} else if (
modelId.includes('qwen3-32b') ||
modelId.includes('qwen3-14b') ||
modelId.includes('qwen3-8b') ||
modelId.includes('qwen3-4b')
) {
return 38912
} else if (modelId.includes('qwen3-1.7b') || modelId.includes('qwen3-0.6b')) {
return 20000
}
// 默认值
return 81920
}
// 获取 Gemini 模型的思考预算配置范围
const getGeminiThinkingBudgetRange = () => {
const modelId = props.modelId?.toLowerCase() || ''
if (modelId.includes('gemini-2.5-pro')) {
return {
min: 128,
max: 32768,
defaultValue: -1,
canDisable: false
}
} else if (modelId.includes('gemini-2.5-flash-lite')) {
return {
min: 0,
max: 24576,
defaultValue: 0,
canDisable: true
}
} else if (modelId.includes('gemini-2.5-flash')) {
return {
min: 0,
max: 24576,
defaultValue: -1,
canDisable: true
}
}
// 默认配置
return {
min: 128,
max: 32768,
defaultValue: -1,
canDisable: false
}
}
// Gemini 思考预算验证错误
const geminiThinkingBudgetError = computed(() => {
if (props.providerId !== 'gemini' || !props.modelId?.includes('gemini-2.5')) return ''
const value = props.thinkingBudget
const range = getGeminiThinkingBudgetRange()
if (value === undefined || value === null) return ''
// -1 是有效值(动态思维)
if (value === -1) return ''
// 检查是否可以禁用(设置为 0)
if (value === 0 && !range.canDisable) {
if (props.modelId?.includes('pro')) {
return t('settings.model.modelConfig.thinkingBudget.gemini.warnings.proCannotDisable')
} else {
return t('settings.model.modelConfig.thinkingBudget.gemini.warnings.modelCannotDisable')
}
}
if (value < range.min && value !== 0) {
// 对于 Flash-Lite,0 是有效值(停用思考),但其他值不能小于 512
if (props.modelId?.includes('flash-lite') && value > 0 && value < 512) {
return t('settings.model.modelConfig.thinkingBudget.gemini.warnings.flashLiteMinValue')
}
let hint = ''
if (range.canDisable && range.min === 0) {
hint = t('settings.model.modelConfig.thinkingBudget.gemini.hints.withZeroAndDynamic')
} else if (range.canDisable) {
hint = t('settings.model.modelConfig.thinkingBudget.gemini.hints.withDynamic')
} else {
hint = t('settings.model.modelConfig.thinkingBudget.gemini.hints.withDynamic')
}
return t('settings.model.modelConfig.thinkingBudget.gemini.warnings.belowMin', {
min: range.min,
hint
})
}
if (value > range.max) {
return t('settings.model.modelConfig.thinkingBudget.gemini.warnings.aboveMax', {
max: range.max
})
}
return ''
})
// Qwen3 思考预算验证错误
const qwen3ThinkingBudgetError = computed(() => {
if (props.providerId !== 'dashscope' || !props.modelId?.includes('qwen3')) return ''
const value = props.thinkingBudget
const maxBudget = getQwen3MaxBudget()
if (value === undefined || value === null) {
return ''
}
if (value < 1) {
return t('settings.model.modelConfig.thinkingBudget.qwen3.validation.minValue')
}
if (value > maxBudget) {
return t('settings.model.modelConfig.thinkingBudget.qwen3.validation.maxValue', {
max: maxBudget
})
}
return ''
})
</script>
<template>
<div class="pt-2 pb-6 px-2" :dir="langStore.dir">
<div class="flex items-center gap-2 px-2 mb-2">
<h2 class="text-xs text-muted-foreground">{{ t('settings.model.title') }}</h2>
<Icon
v-if="props.modelType === 'chat'"
icon="lucide:message-circle"
class="w-3 h-3 text-muted-foreground"
/>
<Icon
v-else-if="props.modelType === 'imageGeneration'"
icon="lucide:image"
class="w-3 h-3 text-muted-foreground"
/>
<Icon
v-else-if="props.modelType === 'embedding'"
icon="lucide:layers"
class="w-3 h-3 text-muted-foreground"
/>
<Icon
v-else-if="props.modelType === 'rerank'"
icon="lucide:arrow-up-down"
class="w-3 h-3 text-muted-foreground"
/>
</div>
<div class="space-y-6">
<!-- System Prompt (隐藏图片生成模型的系统提示词) -->
<div v-if="!isImageGenerationModel" class="space-y-2 px-2">
<div class="flex items-center space-x-2 py-1.5">
<Icon icon="lucide:terminal" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{ t('settings.model.systemPrompt.label') }}</Label>
<TooltipProvider :ignoreNonKeyboardFocus="true" :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.systemPrompt.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<Textarea
v-model="systemPrompt"
:placeholder="t('settings.model.systemPrompt.placeholder')"
/>
</div>
<!-- Temperature (GPT-5 系列模型不显示) -->
<div v-if="!isGPT5Model" class="space-y-4 px-2">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<Icon icon="lucide:thermometer" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{ t('settings.model.temperature.label') }}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.temperature.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<span class="text-xs text-muted-foreground">{{ temperatureValue[0] }}</span>
</div>
<Slider v-model="temperatureValue" :min="0" :max="1.5" :step="0.1" />
</div>
<!-- Context Length -->
<div class="space-y-4 px-2">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<Icon icon="lucide:pencil-ruler" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{ t('settings.model.contextLength.label') }}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.contextLength.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<span class="text-xs text-muted-foreground">{{ formatSize(contextLengthValue[0]) }}</span>
</div>
<Slider
v-model="contextLengthValue"
:min="2048"
:max="contextLengthLimit ?? 16384"
:step="1024"
/>
</div>
<!-- Response Length -->
<div class="space-y-4 px-2">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<Icon icon="lucide:message-circle-reply" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{
t('settings.model.responseLength.label')
}}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.responseLength.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<span class="text-xs text-muted-foreground">{{ formatSize(maxTokensValue[0]) }}</span>
</div>
<Slider
v-model="maxTokensValue"
:min="1024"
:max="!maxTokensLimit || maxTokensLimit < 8192 ? 8192 : maxTokensLimit"
:step="128"
/>
</div>
<!-- Thinking Budget (支持 Gemini 2.5 系列和 Qwen3 系列) -->
<div v-if="showThinkingBudget" class="space-y-4 px-2">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<Icon icon="lucide:brain" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{
t('settings.model.modelConfig.thinkingBudget.label')
}}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p v-if="props.providerId === 'gemini'">
{{ t('settings.model.modelConfig.thinkingBudget.gemini.description') }}
</p>
<p v-else-if="props.providerId === 'dashscope'">
{{ t('settings.model.modelConfig.thinkingBudget.qwen3.description') }}
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</div>
<!-- Gemini 思考预算详细配置 -->
<div v-if="props.providerId === 'gemini'" class="space-y-3 pl-4 border-l-2 border-muted">
<div class="flex items-center justify-between">
<div class="space-y-0.5">
<Label class="text-sm">{{
t('settings.model.modelConfig.thinkingBudget.gemini.dynamic')
}}</Label>
</div>
<Switch
:checked="(props.thinkingBudget ?? -1) === -1"
@update:checked="handleDynamicThinkingToggle"
/>
</div>
<!-- 数值输入 -->
<div class="space-y-2">
<Label class="text-sm">{{
t('settings.model.modelConfig.thinkingBudget.gemini.valueLabel')
}}</Label>
<Input
v-model.number="displayThinkingBudget"
type="number"
:min="-1"
:max="32768"
:step="128"
:placeholder="t('settings.model.modelConfig.thinkingBudget.gemini.placeholder')"
:disabled="(props.thinkingBudget ?? -1) === -1"
:class="{ 'border-destructive': geminiThinkingBudgetError }"
/>
<p class="text-xs text-muted-foreground">
<span v-if="geminiThinkingBudgetError" class="text-red-600 font-medium">
{{ geminiThinkingBudgetError }}
</span>
<span v-else>
{{
displayThinkingBudget === undefined
? t('settings.model.modelConfig.currentUsingModelDefault')
: t('settings.model.modelConfig.thinkingBudget.gemini.dynamicPrefix') +
',' +
t('settings.model.modelConfig.thinkingBudget.range', { min: -1, max: 32768 })
}}
</span>
</p>
</div>
</div>
<!-- Qwen3 思考预算配置 -->
<div
v-else-if="props.providerId === 'dashscope'"
class="space-y-3 pl-4 border-l-2 border-muted"
>
<div class="space-y-2">
<Label class="text-sm">{{
t('settings.model.modelConfig.thinkingBudget.qwen3.valueLabel')
}}</Label>
<Input
v-model.number="displayThinkingBudget"
type="number"
:min="1"
:max="getQwen3MaxBudget()"
:step="128"
:placeholder="t('settings.model.modelConfig.thinkingBudget.qwen3.placeholder')"
:class="{ 'border-destructive': qwen3ThinkingBudgetError }"
/>
<p class="text-xs text-muted-foreground">
<span v-if="qwen3ThinkingBudgetError" class="text-red-600 font-medium">
{{ qwen3ThinkingBudgetError }}
</span>
<span v-else>
{{
displayThinkingBudget === undefined
? t('settings.model.modelConfig.currentUsingModelDefault')
: t('settings.model.modelConfig.thinkingBudget.range', {
min: 1,
max: getQwen3MaxBudget()
})
}}
</span>
</p>
</div>
</div>
</div>
<!-- Search Configuration (Gemini联网搜索配置) -->
<div v-if="showGeminiSearchConfig" class="space-y-4 px-2">
<div class="flex items-center space-x-2">
<Icon icon="lucide:search" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{
t('settings.model.modelConfig.enableSearch.label')
}}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.modelConfig.enableSearch.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<div class="space-y-3 pl-4 border-l-2 border-muted">
<!-- 启用搜索开关 -->
<div class="flex items-center justify-between">
<div class="space-y-0.5">
<Label class="text-sm">{{
t('settings.model.modelConfig.enableSearch.label')
}}</Label>
</div>
<Switch
:checked="props.enableSearch ?? false"
@update:checked="(value) => emit('update:enableSearch', value)"
/>
</div>
<!-- 搜索策略选择 -->
<div v-if="props.enableSearch" class="space-y-2">
<p class="text-xs text-muted-foreground">
{{ t('settings.model.modelConfig.searchLimit.description') }}
</p>
</div>
</div>
</div>
<!-- Search Configuration (联网搜索配置) -->
<div v-if="showDashscopeSearchConfig" class="space-y-4 px-2">
<div class="flex items-center space-x-2">
<Icon icon="lucide:search" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{
t('settings.model.modelConfig.enableSearch.label')
}}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.modelConfig.enableSearch.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<div class="space-y-3 pl-4 border-l-2 border-muted">
<!-- 启用搜索开关 -->
<div class="flex items-center justify-between">
<div class="space-y-0.5">
<Label class="text-sm">{{
t('settings.model.modelConfig.enableSearch.label')
}}</Label>
</div>
<Switch
:checked="props.enableSearch ?? false"
@update:checked="(value) => emit('update:enableSearch', value)"
/>
</div>
<!-- 强制搜索开关 -->
<div v-if="props.enableSearch" class="flex items-center justify-between">
<div class="space-y-0.5">
<Label class="text-sm">{{
t('settings.model.modelConfig.forcedSearch.label')
}}</Label>
</div>
<Switch
:checked="props.forcedSearch ?? false"
@update:checked="(value) => emit('update:forcedSearch', value)"
/>
</div>
<!-- 搜索策略选择 -->
<div v-if="props.enableSearch" class="space-y-2">
<Label class="text-sm">{{
t('settings.model.modelConfig.searchStrategy.label')
}}</Label>
<Select
:model-value="props.searchStrategy ?? 'turbo'"
@update:model-value="
(value) => emit('update:searchStrategy', value as 'turbo' | 'max')
"
>
<SelectTrigger class="text-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="turbo">{{
t('settings.model.modelConfig.searchStrategy.options.turbo')
}}</SelectItem>
<SelectItem value="max">{{
t('settings.model.modelConfig.searchStrategy.options.max')
}}</SelectItem>
</SelectContent>
</Select>
<p class="text-xs text-muted-foreground">
{{ t('settings.model.modelConfig.searchStrategy.description') }}
</p>
</div>
</div>
</div>
<!-- Reasoning Effort (推理努力程度) -->
<div v-if="supportsReasoningEffort" class="space-y-4 px-2">
<div class="flex items-center space-x-2">
<Icon icon="lucide:brain" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{
t('settings.model.modelConfig.reasoningEffort.label')
}}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.modelConfig.reasoningEffort.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<Select
:model-value="props.reasoningEffort"
@update:model-value="
(value) =>
emit('update:reasoningEffort', value as 'minimal' | 'low' | 'medium' | 'high')
"
>
<SelectTrigger class="text-xs">
<SelectValue
:placeholder="t('settings.model.modelConfig.reasoningEffort.placeholder')"
/>
</SelectTrigger>
<SelectContent>
<!-- Grok models only support low and high -->
<template v-if="props.providerId === 'grok'">
<SelectItem value="low">{{
t('settings.model.modelConfig.reasoningEffort.options.low')
}}</SelectItem>
<SelectItem value="high">{{
t('settings.model.modelConfig.reasoningEffort.options.high')
}}</SelectItem>
</template>
<!-- Other models support all four options -->
<template v-else>
<SelectItem value="minimal">{{
t('settings.model.modelConfig.reasoningEffort.options.minimal')
}}</SelectItem>
<SelectItem value="low">{{
t('settings.model.modelConfig.reasoningEffort.options.low')
}}</SelectItem>
<SelectItem value="medium">{{
t('settings.model.modelConfig.reasoningEffort.options.medium')
}}</SelectItem>
<SelectItem value="high">{{
t('settings.model.modelConfig.reasoningEffort.options.high')
}}</SelectItem>
</template>
</SelectContent>
</Select>
</div>
<!-- Verbosity (详细程度 - 仅 GPT-5 系列) -->
<div v-if="isGPT5Model && props.verbosity !== undefined" class="space-y-4 px-2">
<div class="flex items-center space-x-2">
<Icon icon="lucide:message-square-text" class="w-4 h-4 text-muted-foreground" />
<Label class="text-xs font-medium">{{
t('settings.model.modelConfig.verbosity.label')
}}</Label>
<TooltipProvider :delayDuration="200">
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.modelConfig.verbosity.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<Select
:model-value="props.verbosity"
@update:model-value="
(value) => emit('update:verbosity', value as 'low' | 'medium' | 'high')
"
>
<SelectTrigger class="text-xs">
<SelectValue :placeholder="t('settings.model.modelConfig.verbosity.placeholder')" />
</SelectTrigger>
<SelectContent>
<SelectItem value="low">{{
t('settings.model.modelConfig.verbosity.options.low')
}}</SelectItem>
<SelectItem value="medium">{{
t('settings.model.modelConfig.verbosity.options.medium')
}}</SelectItem>
<SelectItem value="high">{{
t('settings.model.modelConfig.verbosity.options.high')
}}</SelectItem>
</SelectContent>
</Select>
</div>
<!-- Artifacts Toggle -->
<!-- <div class="space-y-2 px-2">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<Label for="artifacts-mode">Artifacts</Label>
<Switch id="artifacts-mode" v-model:checked="artifactsEnabled" />
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Icon icon="lucide:help-circle" class="w-4 h-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{{ t('settings.model.artifacts.description') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</div>
</div> -->
</div>
</div>
</template>