📋 feat: Support Custom Content-Types in Action Descriptors (#9364)

This commit is contained in:
Sebastien Bruel 2025-08-30 12:02:40 +09:00 committed by GitHub
parent 49e8443ec5
commit 3a47deac07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 81 additions and 2 deletions

View file

@ -500,10 +500,11 @@ export function openapiToFunction(
}
}
let contentType = '';
if (operationObj.requestBody) {
const requestBody = operationObj.requestBody as RequestBodyObject;
const content = requestBody.content;
const contentType = Object.keys(content ?? {})[0];
contentType = Object.keys(content ?? {})[0];
const schema = content?.[contentType]?.schema;
const resolvedSchema = resolveRef(
schema as OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject,
@ -522,6 +523,8 @@ export function openapiToFunction(
paramLocations[key] = 'body';
}
}
contentType = contentType ?? 'application/json';
}
const functionSignature = new FunctionSignature(
@ -538,7 +541,7 @@ export function openapiToFunction(
method,
operationId,
!!(operationObj['x-openai-isConsequential'] ?? false),
operationObj.requestBody ? 'application/json' : '',
contentType,
paramLocations,
);