Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/main/presenter/configPresenter/modelDefaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,24 +671,26 @@ export const defaultModelsSettings: DefaultModelSetting[] = [
{
id: 'gpt-oss-120b',
name: 'GPT OSS 120B',
temperature: 0.7,
maxTokens: 131000,
contextLength: 131000,
temperature: 0.6,
maxTokens: 32000,
contextLength: 128000,
match: ['gpt-oss-120b'],
vision: false,
functionCall: true,
reasoning: false
reasoning: true,
reasoningEffort: 'medium'
},
{
id: 'gpt-oss-20b',
name: 'GPT OSS 20B',
temperature: 0.7,
maxTokens: 33000,
contextLength: 131000,
temperature: 0.6,
maxTokens: 16000,
contextLength: 128000,
match: ['gpt-oss-20b'],
vision: false,
functionCall: true,
reasoning: false
reasoning: true,
reasoningEffort: 'medium'
},
{
id: 'o4-mini-high',
Expand Down
18 changes: 10 additions & 8 deletions src/main/presenter/configPresenter/providerModelSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,24 +377,26 @@ export const providerModelSettings: Record<string, { models: ProviderModelSettin
{
id: 'gpt-oss:20b',
name: 'GPT-OSS 20B',
temperature: 0.7,
maxTokens: 16384,
contextLength: 32768,
temperature: 0.6,
maxTokens: 16000,
contextLength: 128000,
match: ['gpt-oss:20b'],
vision: false,
functionCall: true,
reasoning: true
reasoning: true,
reasoningEffort: 'medium'
},
{
id: 'gpt-oss:120b',
name: 'GPT-OSS 120B',
temperature: 0.7,
maxTokens: 32768,
contextLength: 65536,
temperature: 0.6,
maxTokens: 32000,
contextLength: 128000,
match: ['gpt-oss:120b'],
vision: false,
functionCall: true,
reasoning: true
reasoning: true,
reasoningEffort: 'medium'
},
// DeepSeek推理模型系列
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ export class OllamaProvider extends BaseLLMProvider {
messages: processedMessages,
options: {
temperature: temperature || 0.7,
num_predict: maxTokens
num_predict: maxTokens,
...(modelConfig?.reasoningEffort && { reasoning_effort: modelConfig.reasoningEffort })
},
stream: true as const,
...(supportsFunctionCall && ollamaTools && ollamaTools.length > 0
Expand Down
104 changes: 104 additions & 0 deletions src/renderer/src/components/ChatConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/comp
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<{
Expand All @@ -21,6 +28,8 @@ const props = defineProps<{
thinkingBudget?: number
modelId?: string
providerId?: string
reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high'
verbosity?: 'low' | 'medium' | 'high'
}>()

const systemPrompt = defineModel<string>('systemPrompt')
Expand All @@ -30,6 +39,8 @@ const emit = defineEmits<{
'update:contextLength': [value: number]
'update:maxTokens': [value: number]
'update:thinkingBudget': [value: number | undefined]
'update:reasoningEffort': [value: 'minimal' | 'low' | 'medium' | 'high']
'update:verbosity': [value: 'low' | 'medium' | 'high']
// 'update:artifacts': [value: 0 | 1]
}>()

Expand Down Expand Up @@ -78,6 +89,11 @@ const isGPT5Model = computed(() => {
return modelId.startsWith('gpt-5')
})

// 判断模型是否支持 reasoningEffort 参数
const supportsReasoningEffort = computed(() => {
return props.reasoningEffort !== undefined
})

// 当前显示的思考预算值
const displayThinkingBudget = computed({
get: () => {
Expand Down Expand Up @@ -276,6 +292,94 @@ const handleDynamicThinkingToggle = (enabled: boolean) => {
</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>
<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>
</SelectContent>
</Select>
</div>

<!-- Verbosity (详细程度 - 仅 GPT-5 系列) -->
<div v-if="isGPT5Model && 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">
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/src/components/NewThread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
v-model:max-tokens="maxTokens"
v-model:system-prompt="systemPrompt"
v-model:artifacts="artifacts"
v-model:reasoning-effort="reasoningEffort"
v-model:verbosity="verbosity"
:context-length-limit="contextLengthLimit"
:max-tokens-limit="maxTokensLimit"
:model-id="activeModel?.id"
Expand Down Expand Up @@ -157,6 +159,8 @@ const maxTokens = ref(4096)
const maxTokensLimit = ref(4096)
const systemPrompt = ref('')
const artifacts = ref(settingsStore.artifactsEffectEnabled ? 1 : 0)
const reasoningEffort = ref<'minimal' | 'low' | 'medium' | 'high' | undefined>(undefined)
const verbosity = ref<'low' | 'medium' | 'high' | undefined>(undefined)

const name = computed(() => {
return activeModel.value?.name ? activeModel.value.name.split('/').pop() : ''
Expand All @@ -175,6 +179,8 @@ watch(
maxTokens.value = config.maxTokens
contextLengthLimit.value = config.contextLength
maxTokensLimit.value = config.maxTokens
reasoningEffort.value = config.reasoningEffort
verbosity.value = config.verbosity
// console.log('temperature', temperature.value)
// console.log('contextLength', contextLength.value)
// console.log('maxTokens', maxTokens.value)
Expand Down Expand Up @@ -404,8 +410,10 @@ const handleSend = async (content: UserMessageContent) => {
contextLength: contextLength.value,
maxTokens: maxTokens.value,
artifacts: artifacts.value as 0 | 1,
reasoningEffort: reasoningEffort.value,
verbosity: verbosity.value,
enabledMcpTools: chatStore.chatConfig.enabledMcpTools
})
} as any)
console.log('threadId', threadId, activeModel.value)
Comment on lines +413 to 417
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid any-casting the createThread payload; extend thread settings instead

Casting to any masks type drift and risks lost persistence/validation downstream. Prefer updating the shared Thread settings/type to include reasoningEffort and verbosity so they’re first-class citizens across the app.

Example follow-ups:

  • Extend the thread creation DTO and settings model in @shared to include:
    • reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high'
    • verbosity?: 'low' | 'medium' | 'high'
  • Plumb these through chatStore persistence and presentation.

Short-term (if types aren’t ready), constrain the cast to a narrower subset to avoid polluting unrelated properties:

-  } as any)
+  } as unknown as {
+    providerId: string
+    modelId: string
+    systemPrompt: string
+    temperature: number
+    contextLength: number
+    maxTokens: number
+    artifacts: 0 | 1
+    enabledMcpTools: string[]
+    reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high'
+    verbosity?: 'low' | 'medium' | 'high'
+  })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
reasoningEffort: reasoningEffort.value,
verbosity: verbosity.value,
enabledMcpTools: chatStore.chatConfig.enabledMcpTools
})
} as any)
console.log('threadId', threadId, activeModel.value)
reasoningEffort: reasoningEffort.value,
verbosity: verbosity.value,
enabledMcpTools: chatStore.chatConfig.enabledMcpTools
} as unknown as {
providerId: string
modelId: string
systemPrompt: string
temperature: number
contextLength: number
maxTokens: number
artifacts: 0 | 1
enabledMcpTools: string[]
reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high'
verbosity?: 'low' | 'medium' | 'high'
})
console.log('threadId', threadId, activeModel.value)

chatStore.sendMessage(content)
}
Expand Down
Loading
Loading