Edit openai-image.ts
This commit is contained in:
@@ -150,8 +150,21 @@ function filterModelParameters(manager: ProxyReqManager) {
|
||||
|
||||
req.log.info({ model: 'dall-e-3', params: Object.keys(filteredBody) }, "Filtered parameters for DALL-E 3");
|
||||
} else if (modelName.includes('gpt-image')) {
|
||||
// For gpt-image-1, we can use all parameters
|
||||
req.log.info({ model: 'gpt-image-1', params: Object.keys(filteredBody) }, "Using all parameters for GPT Image");
|
||||
// Define allowed parameters for gpt-image-1
|
||||
const allowedParams = [
|
||||
'model', 'prompt', 'background', 'moderation', 'n', 'output_compression',
|
||||
'output_format', 'quality', 'size', 'user', 'image', 'mask'
|
||||
];
|
||||
|
||||
// Remove any parameter not in the allowed list, especially 'style' which is only for DALL-E 3
|
||||
Object.keys(filteredBody).forEach(key => {
|
||||
if (!allowedParams.includes(key)) {
|
||||
req.log.info({ model: 'gpt-image-1', removedParam: key }, "Removing unsupported parameter for GPT Image");
|
||||
delete filteredBody[key];
|
||||
}
|
||||
});
|
||||
|
||||
req.log.info({ model: 'gpt-image-1', params: Object.keys(filteredBody) }, "Filtered parameters for GPT Image");
|
||||
}
|
||||
|
||||
// Use the proper method to update the body
|
||||
|
||||
Reference in New Issue
Block a user