增加大模型推理级别配置
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { logDebug } from '../logger.js';
|
||||
import { getSystemPrompt } from '../config.js';
|
||||
import { getSystemPrompt, getModelReasoning } from '../config.js';
|
||||
|
||||
export function transformToOpenAI(openaiRequest) {
|
||||
logDebug('Transforming OpenAI request to target OpenAI format');
|
||||
@@ -88,6 +88,26 @@ export function transformToOpenAI(openaiRequest) {
|
||||
targetRequest.instructions = systemPrompt;
|
||||
}
|
||||
|
||||
// Handle reasoning field based on model configuration
|
||||
const reasoningLevel = getModelReasoning(openaiRequest.model);
|
||||
if (reasoningLevel) {
|
||||
targetRequest.reasoning = {
|
||||
effort: reasoningLevel,
|
||||
summary: 'auto'
|
||||
};
|
||||
}
|
||||
// If request already has reasoning field, respect the configuration rule
|
||||
// Remove it if model config is off/invalid, otherwise override with config
|
||||
if (openaiRequest.reasoning) {
|
||||
if (reasoningLevel) {
|
||||
targetRequest.reasoning = {
|
||||
effort: reasoningLevel,
|
||||
summary: 'auto'
|
||||
};
|
||||
}
|
||||
// If reasoningLevel is null (off/invalid), don't add reasoning field
|
||||
}
|
||||
|
||||
// Pass through other parameters
|
||||
if (openaiRequest.temperature !== undefined) {
|
||||
targetRequest.temperature = openaiRequest.temperature;
|
||||
|
||||
Reference in New Issue
Block a user