diff --git a/src/renderer/src/aiCore/clients/anthropic/AnthropicAPIClient.ts b/src/renderer/src/aiCore/clients/anthropic/AnthropicAPIClient.ts index 864f2fff30..eb7d930c5d 100644 --- a/src/renderer/src/aiCore/clients/anthropic/AnthropicAPIClient.ts +++ b/src/renderer/src/aiCore/clients/anthropic/AnthropicAPIClient.ts @@ -90,7 +90,7 @@ export class AnthropicAPIClient extends BaseApiClient< return this.sdkInstance } this.sdkInstance = new Anthropic({ - apiKey: this.getApiKey(), + apiKey: this.apiKey, baseURL: this.getBaseURL(), dangerouslyAllowBrowser: true, defaultHeaders: { diff --git a/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts b/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts index 7f08def6cc..dd4fb1d516 100644 --- a/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts +++ b/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts @@ -85,7 +85,7 @@ export class GeminiAPIClient extends BaseApiClient< ...rest, config: { ...rest.config, - abortSignal: options?.abortSignal, + abortSignal: options?.signal, httpOptions: { ...rest.config?.httpOptions, timeout: options?.timeout @@ -479,6 +479,7 @@ export class GeminiAPIClient extends BaseApiClient< for (const message of messages) { history.push(await this.convertMessageToSdkParam(message)) } + messages.push(userLastMessage) } } diff --git a/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts b/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts index cd03607c29..7730f228af 100644 --- a/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts +++ b/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts @@ -135,7 +135,7 @@ export abstract class OpenAIBaseClient< return this.sdkInstance } - let apiKeyForSdkInstance = this.provider.apiKey + let apiKeyForSdkInstance = this.apiKey if (this.provider.id === 'copilot') { const defaultHeaders = store.getState().copilot.defaultHeaders diff --git a/src/renderer/src/aiCore/clients/openai/OpenAIResponseAPIClient.ts b/src/renderer/src/aiCore/clients/openai/OpenAIResponseAPIClient.ts index 71b809c338..5871a04cab 100644 --- a/src/renderer/src/aiCore/clients/openai/OpenAIResponseAPIClient.ts +++ b/src/renderer/src/aiCore/clients/openai/OpenAIResponseAPIClient.ts @@ -78,7 +78,7 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient< return new OpenAI({ dangerouslyAllowBrowser: true, - apiKey: this.provider.apiKey, + apiKey: this.apiKey, baseURL: this.getBaseURL(), defaultHeaders: { ...this.defaultHeaders() diff --git a/src/renderer/src/config/models.ts b/src/renderer/src/config/models.ts index 4a842c59ca..23ba31557a 100644 --- a/src/renderer/src/config/models.ts +++ b/src/renderer/src/config/models.ts @@ -2688,7 +2688,7 @@ export function isOpenRouterBuiltInWebSearchModel(model: Model): boolean { return false } - return isOpenAIWebSearchModel(model) || model.id.includes('sonar') + return isOpenAIWebSearchChatCompletionOnlyModel(model) || model.id.includes('sonar') } export function isGenerateImageModel(model: Model): boolean { diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index a9ff753b39..b62c708825 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -1163,7 +1163,7 @@ "markdown_export.select": "Select", "markdown_export.title": "Markdown Export", "markdown_export.show_model_name.title": "Use Model Name on Export", - "markdown_export.show_model_name.help": "When enabled, the topic-naming model will be used to create titles for exported messages. Note: This option also affects all export methods through Markdown, such as Notion, Yuque, etc.", + "markdown_export.show_model_name.help": "When enabled, the model name will be displayed when exporting to Markdown. Note: This option also affects all export methods through Markdown, such as Notion, Yuque, etc.", "markdown_export.show_model_provider.title": "Show Model Provider", "markdown_export.show_model_provider.help": "Display the model provider (e.g., OpenAI, Gemini) when exporting to Markdown", "minute_interval_one": "{{count}} minute", diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index 903fa6d635..bc363a0e91 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -1161,7 +1161,7 @@ "markdown_export.select": "選択", "markdown_export.title": "Markdown エクスポート", "markdown_export.show_model_name.title": "エクスポート時にモデル名を使用", - "markdown_export.show_model_name.help": "有効にすると、トピック命名モデルがエクスポートされたメッセージのタイトル作成に使用されます。注意:この設定はNotion、Yuqueなど、Markdownを通じたすべてのエクスポート方法にも影響します。", + "markdown_export.show_model_name.help": "有効にすると、Markdownエクスポート時にモデル名を表示します。注意:この設定はNotion、Yuqueなど、Markdownを通じたすべてのエクスポート方法にも影響します。", "markdown_export.show_model_provider.title": "モデルプロバイダーを表示", "markdown_export.show_model_provider.help": "Markdownエクスポート時にモデルプロバイダー(例:OpenAI、Geminiなど)を表示します。", "minute_interval_one": "{{count}} 分", diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index 46424b5fe2..8b325b4b31 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -1161,7 +1161,7 @@ "markdown_export.select": "Выбрать", "markdown_export.title": "Экспорт в Markdown", "markdown_export.show_model_name.title": "Использовать имя модели при экспорте", - "markdown_export.show_model_name.help": "Если включено, для создания заголовков экспортируемых сообщений будет использоваться модель именования темы. Примечание: Эта опция также влияет на все методы экспорта через Markdown, такие как Notion, Yuque и т.д.", + "markdown_export.show_model_name.help": "Если включено, при экспорте в Markdown будет отображаться имя модели. Примечание: Эта опция также влияет на все методы экспорта через Markdown, такие как Notion, Yuque и т.д.", "markdown_export.show_model_provider.title": "Показать поставщика модели", "markdown_export.show_model_provider.help": "Показывать поставщика модели (например, OpenAI, Gemini) при экспорте в Markdown", "minute_interval_one": "{{count}} минута", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 83b8f144fb..a60589c71a 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -1163,7 +1163,7 @@ "markdown_export.select": "选择", "markdown_export.title": "Markdown 导出", "markdown_export.show_model_name.title": "导出时使用模型名称", - "markdown_export.show_model_name.help": "开启后,使用话题命名模型为导出的消息创建标题。注意:该项也会影响所有通过Markdown导出的方式,如Notion、语雀等。", + "markdown_export.show_model_name.help": "开启后,导出Markdown时会显示模型名称。注意:该项也会影响所有通过Markdown导出的方式,如Notion、语雀等。", "markdown_export.show_model_provider.title": "显示模型供应商", "markdown_export.show_model_provider.help": "在导出Markdown时显示模型供应商,如OpenAI、Gemini等", "message_title.use_topic_naming.title": "使用话题命名模型为导出的消息创建标题", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index b92718e4fb..4742cff3a3 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -1163,7 +1163,7 @@ "markdown_export.select": "選擇", "markdown_export.title": "Markdown 匯出", "markdown_export.show_model_name.title": "匯出時使用模型名稱", - "markdown_export.show_model_name.help": "啟用後,將以主題命名模型為匯出的訊息建立標題。注意:該項也會影響所有透過Markdown匯出的方式,如Notion、語雀等。", + "markdown_export.show_model_name.help": "啟用後,匯出Markdown時會顯示模型名稱。注意:該項也會影響所有透過Markdown匯出的方式,如Notion、語雀等。", "markdown_export.show_model_provider.title": "顯示模型供應商", "markdown_export.show_model_provider.help": "在匯出Markdown時顯示模型供應商,如OpenAI、Gemini等", "minute_interval_one": "{{count}} 分鐘", diff --git a/src/renderer/src/services/AssistantService.ts b/src/renderer/src/services/AssistantService.ts index 7619e0e3b4..e8ec416b1e 100644 --- a/src/renderer/src/services/AssistantService.ts +++ b/src/renderer/src/services/AssistantService.ts @@ -14,7 +14,17 @@ export function getDefaultAssistant(): Assistant { topics: [getDefaultTopic('default')], messages: [], type: 'assistant', - regularPhrases: [] // Added regularPhrases + regularPhrases: [], // Added regularPhrases + settings: { + temperature: DEFAULT_TEMPERATURE, + contextCount: DEFAULT_CONTEXTCOUNT, + enableMaxTokens: false, + maxTokens: 0, + streamOutput: true, + topP: 1, + toolUseMode: 'prompt', + customParameters: [] + } } } @@ -127,7 +137,17 @@ export async function createAssistantFromAgent(agent: Agent) { topics: [topic], model: agent.defaultModel, type: 'assistant', - regularPhrases: agent.regularPhrases || [] // Ensured regularPhrases + regularPhrases: agent.regularPhrases || [], // Ensured regularPhrases + settings: agent.settings || { + temperature: DEFAULT_TEMPERATURE, + contextCount: DEFAULT_CONTEXTCOUNT, + enableMaxTokens: false, + maxTokens: 0, + streamOutput: true, + topP: 1, + toolUseMode: 'prompt', + customParameters: [] + } } store.dispatch(addAssistant(assistant)) diff --git a/src/renderer/src/types/sdk.ts b/src/renderer/src/types/sdk.ts index c066952ec1..559e02ecae 100644 --- a/src/renderer/src/types/sdk.ts +++ b/src/renderer/src/types/sdk.ts @@ -102,6 +102,6 @@ export type GeminiSdkToolCall = FunctionCall export type GeminiOptions = { streamOutput: boolean - abortSignal?: AbortSignal + signal?: AbortSignal timeout?: number }