mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
📋 feat: Support Custom Content-Types in Action Descriptors (#9364)
This commit is contained in:
parent
49e8443ec5
commit
3a47deac07
3 changed files with 81 additions and 2 deletions
|
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue