mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: strip enumDescriptions from tool schema in antigravity-to-openai (closes #566)
Co-authored-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -89,15 +89,21 @@ export function antigravityToOpenAIRequest(model, body, stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recursively convert Antigravity schema types (OBJECT, STRING, etc.) to lowercase
|
// Recursively convert Antigravity schema types (OBJECT, STRING, etc.) to lowercase
|
||||||
|
// and strip unsupported fields like enumDescriptions
|
||||||
function normalizeSchemaTypes(schema) {
|
function normalizeSchemaTypes(schema) {
|
||||||
if (!schema || typeof schema !== "object") return schema;
|
if (!schema || typeof schema !== "object") return schema;
|
||||||
|
|
||||||
const result = Array.isArray(schema) ? [...schema] : { ...schema };
|
const result = Array.isArray(schema) ? [...schema] : { ...schema };
|
||||||
|
|
||||||
|
|
||||||
if (typeof result.type === "string") {
|
if (typeof result.type === "string") {
|
||||||
result.type = result.type.toLowerCase();
|
result.type = result.type.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip enumDescriptions — not supported by upstream APIs
|
||||||
|
delete result.enumDescriptions;
|
||||||
|
|
||||||
|
|
||||||
if (result.properties) {
|
if (result.properties) {
|
||||||
const normalized = {};
|
const normalized = {};
|
||||||
for (const [key, val] of Object.entries(result.properties)) {
|
for (const [key, val] of Object.entries(result.properties)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user