mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-08 16:10:09 +00:00
release version update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import OpenAI from 'openai'
|
||||
|
||||
import { ALIBABA_QWEN_BASE_URL, MOONSHOT_BASE_URL } from '../../constants'
|
||||
import { ALIBABA_QWEN_BASE_URL, INFIO_BASE_URL, MOONSHOT_BASE_URL } from '../../constants'
|
||||
import { LLMModel } from '../../types/llm/model'
|
||||
import {
|
||||
LLMOptions,
|
||||
@@ -51,16 +51,23 @@ export class OpenAICompatibleProvider implements BaseLLMProvider {
|
||||
private isAlibabaQwen(): boolean {
|
||||
return this.baseURL === ALIBABA_QWEN_BASE_URL ||
|
||||
this.baseURL?.includes('dashscope.aliyuncs.com')
|
||||
}
|
||||
}
|
||||
|
||||
private isGemini(modelName: string): boolean {
|
||||
return this.baseURL === INFIO_BASE_URL && modelName.includes('gemini')
|
||||
}
|
||||
|
||||
// 获取提供商特定的额外参数
|
||||
private getExtraParams(isStreaming: boolean): Record<string, unknown> {
|
||||
private getExtraParams(isStreaming: boolean, modelName: string): Record<string, unknown> {
|
||||
const extraParams: Record<string, unknown> = {}
|
||||
|
||||
// 阿里云Qwen API需要在非流式调用中设置 enable_thinking: false
|
||||
if (this.isAlibabaQwen() && !isStreaming) {
|
||||
extraParams.enable_thinking = false
|
||||
}
|
||||
}
|
||||
if (this.isGemini(modelName)) {
|
||||
extraParams.reasoning_effort = 'low';
|
||||
}
|
||||
|
||||
return extraParams
|
||||
}
|
||||
@@ -91,7 +98,7 @@ export class OpenAICompatibleProvider implements BaseLLMProvider {
|
||||
)
|
||||
}
|
||||
|
||||
const extraParams = this.getExtraParams(true) // 流式调用
|
||||
const extraParams = this.getExtraParams(true, model.modelId) // 流式调用
|
||||
return this.adapter.streamResponse(this.client as OpenAI, request, options, extraParams)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user