mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 02:09:03 +08:00
fix(providers): update poe url (#9262)
* fix(providers): 修正poe api的url结尾缺少斜杠的问题 * feat(types): 扩展 ReasoningEffortOptionalParams 中的 extra_body 类型 为 extra_body 添加具体的 google 配置类型,包括 thinking_config 及其属性 * feat(openai): 为Poe提供商添加推理参数传递支持 在Poe提供商的消息处理中,根据模型类型将reasoning_effort和thinking_budget参数附加到用户消息内容。支持GPT5、Claude和Gemini模型的特定参数传递。 * docs(openai): 添加关于poe reasoning_effort参数的注释
This commit is contained in:
parent
afae33d588
commit
f9056b0680
@ -5,7 +5,9 @@ import {
|
||||
GEMINI_FLASH_MODEL_REGEX,
|
||||
getOpenAIWebSearchParams,
|
||||
getThinkModelType,
|
||||
isClaudeReasoningModel,
|
||||
isDoubaoThinkingAutoModel,
|
||||
isGeminiReasoningModel,
|
||||
isGPT5SeriesModel,
|
||||
isGrokReasoningModel,
|
||||
isNotSupportSystemMessageModel,
|
||||
@ -46,6 +48,7 @@ import {
|
||||
Model,
|
||||
OpenAIServiceTier,
|
||||
Provider,
|
||||
SystemProviderIds,
|
||||
ToolCallResponse,
|
||||
TranslateAssistant,
|
||||
WebSearchSource
|
||||
@ -557,17 +560,28 @@ export class OpenAIAPIClient extends OpenAIBaseClient<
|
||||
}
|
||||
}
|
||||
|
||||
const lastUserMsg = userMessages.findLast((m) => m.role === 'user')
|
||||
if (
|
||||
lastUserMsg &&
|
||||
isSupportedThinkingTokenQwenModel(model) &&
|
||||
!isSupportEnableThinkingProvider(this.provider)
|
||||
) {
|
||||
const postsuffix = '/no_think'
|
||||
const qwenThinkModeEnabled = assistant.settings?.qwenThinkMode === true
|
||||
const currentContent = lastUserMsg.content
|
||||
// poe 需要通过用户消息传递 reasoningEffort
|
||||
const reasoningEffort = this.getReasoningEffort(assistant, model)
|
||||
|
||||
lastUserMsg.content = processPostsuffixQwen3Model(currentContent, postsuffix, qwenThinkModeEnabled) as any
|
||||
const lastUserMsg = userMessages.findLast((m) => m.role === 'user')
|
||||
if (lastUserMsg) {
|
||||
if (isSupportedThinkingTokenQwenModel(model) && !isSupportEnableThinkingProvider(this.provider)) {
|
||||
const postsuffix = '/no_think'
|
||||
const qwenThinkModeEnabled = assistant.settings?.qwenThinkMode === true
|
||||
const currentContent = lastUserMsg.content
|
||||
|
||||
lastUserMsg.content = processPostsuffixQwen3Model(currentContent, postsuffix, qwenThinkModeEnabled) as any
|
||||
}
|
||||
if (this.provider.id === SystemProviderIds.poe) {
|
||||
// 如果以后 poe 支持 reasoning_effort 参数了,可以删掉这部分
|
||||
if (isGPT5SeriesModel(model) && reasoningEffort.reasoning_effort) {
|
||||
lastUserMsg.content += ` --reasoning_effort ${reasoningEffort.reasoning_effort}`
|
||||
} else if (isClaudeReasoningModel(model) && reasoningEffort.thinking?.budget_tokens) {
|
||||
lastUserMsg.content += ` --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}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 最终请求消息
|
||||
@ -585,8 +599,6 @@ export class OpenAIAPIClient extends OpenAIBaseClient<
|
||||
// Note: Some providers like Mistral don't support stream_options
|
||||
const shouldIncludeStreamOptions = streamOutput && isSupportStreamOptionsProvider(this.provider)
|
||||
|
||||
const reasoningEffort = this.getReasoningEffort(assistant, model)
|
||||
|
||||
// minimal cannot be used with web_search tool
|
||||
if (isGPT5SeriesModel(model) && reasoningEffort.reasoning_effort === 'minimal' && enableWebSearch) {
|
||||
reasoningEffort.reasoning_effort = 'low'
|
||||
|
||||
@ -1225,7 +1225,7 @@ export const PROVIDER_URLS: Record<SystemProviderId, ProviderUrls> = {
|
||||
},
|
||||
poe: {
|
||||
api: {
|
||||
url: 'https://api.poe.com/v1'
|
||||
url: 'https://api.poe.com/v1/'
|
||||
},
|
||||
websites: {
|
||||
official: 'https://poe.com/',
|
||||
|
||||
@ -81,7 +81,14 @@ export type ReasoningEffortOptionalParams = {
|
||||
thinking_budget?: number
|
||||
incremental_output?: boolean
|
||||
enable_reasoning?: boolean
|
||||
extra_body?: Record<string, any>
|
||||
extra_body?: {
|
||||
google?: {
|
||||
thinking_config: {
|
||||
thinking_budget: number
|
||||
include_thoughts?: boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add any other potential reasoning-related keys here if they exist
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user