diff --git a/src/libs/agent-runtime/baichuan/index.ts b/src/libs/agent-runtime/baichuan/index.ts index 3d5f01d3e6c5..68c472646bf0 100644 --- a/src/libs/agent-runtime/baichuan/index.ts +++ b/src/libs/agent-runtime/baichuan/index.ts @@ -7,22 +7,15 @@ export const LobeBaichuanAI = LobeOpenAICompatibleFactory({ baseURL: 'https://api.baichuan-ai.com/v1', chatCompletion: { handlePayload: (payload: ChatStreamPayload) => { - const { frequency_penalty, ...rest } = payload; + const { temperature, ...rest } = payload; - let adjustedFrequencyPenalty = frequency_penalty ?? 1; - - if (frequency_penalty !== undefined) { - if (frequency_penalty < 1) { - // If less than 1 (including negative values), add 1 to bring it into the 1-2 range - adjustedFrequencyPenalty = Math.min(Math.max(frequency_penalty + 1, 1), 2); - } else if (frequency_penalty > 2) { - // If greater than 2, cap it at 2 - adjustedFrequencyPenalty = 2; - } - // If between 1 and 2, keep the original value - } - - return { ...rest, frequency_penalty: adjustedFrequencyPenalty } as OpenAI.ChatCompletionCreateParamsStreaming; + return { + ...rest, + temperature: + temperature !== undefined + ? temperature / 2 + : undefined, + } as OpenAI.ChatCompletionCreateParamsStreaming; }, }, debug: {