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
7 changes: 6 additions & 1 deletion src/main/presenter/configPresenter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,15 @@ export class ConfigPresenter implements IConfigPresenter {
model.functionCall !== undefined ? model.functionCall : config.functionCall || false
model.reasoning =
model.reasoning !== undefined ? model.reasoning : config.reasoning || false
model.enableSearch =
model.enableSearch !== undefined ? model.enableSearch : config.enableSearch || false
model.type = model.type !== undefined ? model.type : config.type || ModelType.Chat
} else {
// 确保模型具有这些属性,如果没有配置,默认为false
model.vision = model.vision || false
model.functionCall = model.functionCall || false
model.reasoning = model.reasoning || false
model.enableSearch = model.enableSearch || false
model.type = model.type || ModelType.Chat
}
return model
Expand Down Expand Up @@ -619,7 +622,8 @@ export class ConfigPresenter implements IConfigPresenter {
// 确保能力属性被复制
vision: model.vision || false,
functionCall: model.functionCall || false,
reasoning: model.reasoning || false
reasoning: model.reasoning || false,
enableSearch: model.enableSearch || false
}))

return {
Expand All @@ -640,6 +644,7 @@ export class ConfigPresenter implements IConfigPresenter {
model.vision = model.vision !== undefined ? model.vision : false
model.functionCall = model.functionCall !== undefined ? model.functionCall : false
model.reasoning = model.reasoning !== undefined ? model.reasoning : false
model.enableSearch = model.enableSearch !== undefined ? model.enableSearch : false
return model
})

Expand Down
3 changes: 3 additions & 0 deletions src/main/presenter/threadPresenter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,9 @@ export class ThreadPresenter implements IThreadPresenter {
defaultSettings = { ...latestConversation.settings }
defaultSettings.systemPrompt = ''
defaultSettings.reasoningEffort = undefined
defaultSettings.enableSearch = undefined
defaultSettings.forcedSearch = undefined
defaultSettings.searchStrategy = undefined
}
Object.keys(settings).forEach((key) => {
if (settings[key] === undefined || settings[key] === null || settings[key] === '') {
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/src/components/settings/ModelConfigItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
title="函数调用能力"
/>
<Icon v-if="reasoning" icon="lucide:brain" class="w-4 h-4 text-purple-500" title="推理能力" />
<Icon
v-if="enableSearch"
icon="lucide:globe"
class="w-4 h-4 text-green-500"
title="联网搜索能力"
/>
Comment on lines +15 to +20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use i18n for the new tooltip (no hardcoded UI strings).

Renderer must avoid hardcoded user-facing text. Switch to an i18n key.

-      <Icon
-        v-if="enableSearch"
-        icon="lucide:globe"
-        class="w-4 h-4 text-green-500"
-        title="联网搜索能力"
-      />
+      <Icon
+        v-if="enableSearch"
+        icon="lucide:globe"
+        class="w-4 h-4 text-green-500"
+        :title="$t('model.capability.search')"
+      />

Add translations (example):

// locales/en.json
{
  "model": { "capability": { "search": "Search capability" } }
}
// locales/zh-CN.json
{
  "model": { "capability": { "search": "联网搜索能力" } }
}
🤖 Prompt for AI Agents
In src/renderer/src/components/settings/ModelConfigItem.vue around lines 15-20,
the Icon's title is hardcoded as "联网搜索能力"; replace the hardcoded string with the
i18n key (e.g. $t('model.capability.search')) so UI strings are localized, and
add the corresponding translation entries to your locale files (e.g.
locales/en.json and locales/zh-CN.json) with
"model":{"capability":{"search":"Search capability"}} and
"model":{"capability":{"search":"联网搜索能力"}} respectively; ensure the component
imports/uses the existing i18n instance or composition API helper (t/$t)
consistent with the project pattern.

</div>
<div class="flex-grow"></div>
<div class="flex flex-row items-center gap-2">
Expand Down Expand Up @@ -89,6 +95,7 @@ withDefaults(
vision?: boolean
functionCall?: boolean
reasoning?: boolean
enableSearch?: boolean
type?: ModelType
changeable?: boolean
}>(),
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/components/settings/ProviderModelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:vision="model.vision"
:function-call="model.functionCall"
:reasoning="model.reasoning"
:enable-search="model.enableSearch"
:type="model.type ?? ModelType.Chat"
@enabled-change="(enabled) => handleModelEnabledChange(model, enabled)"
@delete-model="() => handleDeleteCustomModel(model)"
Expand Down Expand Up @@ -113,6 +114,7 @@
:vision="model.vision"
:function-call="model.functionCall"
:reasoning="model.reasoning"
:enable-search="model.enableSearch"
:type="model.type ?? ModelType.Chat"
@enabled-change="(enabled) => handleModelEnabledChange(model, enabled)"
@config-changed="$emit('config-changed')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
:vision="model.vision ?? false"
:function-call="model.functionCall ?? false"
:reasoning="model.reasoning ?? false"
:enable-search="model.enableSearch ?? false"
:type="model.type ?? ModelType.Chat"
@enabled-change="$emit('model-enabled-change', model, $event)"
@config-changed="$emit('config-changed')"
Expand Down
2 changes: 2 additions & 0 deletions src/shared/types/presenters/legacy.presenters.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ export type RENDERER_MODEL_META = {
vision?: boolean
functionCall?: boolean
reasoning?: boolean
enableSearch?: boolean
type?: ModelType
}
export type MODEL_META = {
Expand All @@ -523,6 +524,7 @@ export type MODEL_META = {
vision?: boolean
functionCall?: boolean
reasoning?: boolean
enableSearch?: boolean
type?: ModelType
}
export type LLM_PROVIDER = {
Expand Down
2 changes: 2 additions & 0 deletions src/shared/types/presenters/llmprovider.presenter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type RENDERER_MODEL_META = {
vision?: boolean
functionCall?: boolean
reasoning?: boolean
enableSearch?: boolean
type?: ModelType
contextLength?: number
maxTokens?: number
Expand All @@ -33,6 +34,7 @@ export type MODEL_META = {
vision?: boolean
functionCall?: boolean
reasoning?: boolean
enableSearch?: boolean
type?: ModelType
contextLength?: number
maxTokens?: number
Expand Down