From 2e5ffb8324a3f8611e77f267cb357907add4e16b Mon Sep 17 00:00:00 2001 From: Phantom <59059173+EurFelux@users.noreply.github.com> Date: Sun, 31 Aug 2025 20:41:18 +0800 Subject: [PATCH] fix(poe): poe cannot process multiple text part (#9711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(poe): 修复poe provider不支持array content的问题 临时解决方案是强制poe使用string content,同时将reasoning_effort参数拼接逻辑优化为使用suffix变量 --- .../src/aiCore/clients/openai/OpenAIApiClient.ts | 12 +++++++++--- src/renderer/src/config/providers.ts | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/aiCore/clients/openai/OpenAIApiClient.ts b/src/renderer/src/aiCore/clients/openai/OpenAIApiClient.ts index 8b58e78899..92e49cec53 100644 --- a/src/renderer/src/aiCore/clients/openai/OpenAIApiClient.ts +++ b/src/renderer/src/aiCore/clients/openai/OpenAIApiClient.ts @@ -639,12 +639,18 @@ export class OpenAIAPIClient extends OpenAIBaseClient< } if (this.provider.id === SystemProviderIds.poe) { // 如果以后 poe 支持 reasoning_effort 参数了,可以删掉这部分 + let suffix = '' if (isGPT5SeriesModel(model) && reasoningEffort.reasoning_effort) { - lastUserMsg.content += ` --reasoning_effort ${reasoningEffort.reasoning_effort}` + suffix = ` --reasoning_effort ${reasoningEffort.reasoning_effort}` } else if (isClaudeReasoningModel(model) && reasoningEffort.thinking?.budget_tokens) { - lastUserMsg.content += ` --thinking_budget ${reasoningEffort.thinking.budget_tokens}` + suffix = ` --thinking_budget ${reasoningEffort.thinking.budget_tokens}` } else if (isGeminiReasoningModel(model) && reasoningEffort.extra_body?.google?.thinking_config) { - lastUserMsg.content += ` --thinking_budget ${reasoningEffort.extra_body.google.thinking_config.thinking_budget}` + suffix = ` --thinking_budget ${reasoningEffort.extra_body.google.thinking_config.thinking_budget}` + } + // FIXME: poe 不支持多个text part,上传文本文件的时候用的不是file part而是text part,因此会出问题 + // 临时解决方案是强制poe用string content,但是其实poe部分支持array + if (typeof lastUserMsg.content === 'string') { + lastUserMsg.content += suffix } } } diff --git a/src/renderer/src/config/providers.ts b/src/renderer/src/config/providers.ts index 2ad123f32f..194d4c20b7 100644 --- a/src/renderer/src/config/providers.ts +++ b/src/renderer/src/config/providers.ts @@ -1262,7 +1262,8 @@ const NOT_SUPPORT_ARRAY_CONTENT_PROVIDERS = [ 'deepseek', 'baichuan', 'minimax', - 'xirang' + 'xirang', + 'poe' ] as const satisfies SystemProviderId[] /**