@webtypen/webframez-core 0.3.43 → 0.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -54,22 +54,91 @@ export declare function apiFunctionParamToJsonSchema(definition: ApiFunctionPara
|
|
|
54
54
|
type: string;
|
|
55
55
|
pattern?: undefined;
|
|
56
56
|
items?: undefined;
|
|
57
|
+
anyOf?: undefined;
|
|
58
|
+
"x-webframez-type"?: undefined;
|
|
59
|
+
"x-openai-file-parameter"?: undefined;
|
|
60
|
+
"x-openai-file-arg-rewrite"?: undefined;
|
|
57
61
|
enum?: undefined;
|
|
58
62
|
} | {
|
|
59
63
|
type: string;
|
|
60
64
|
pattern: string;
|
|
61
65
|
items?: undefined;
|
|
66
|
+
anyOf?: undefined;
|
|
67
|
+
"x-webframez-type"?: undefined;
|
|
68
|
+
"x-openai-file-parameter"?: undefined;
|
|
69
|
+
"x-openai-file-arg-rewrite"?: undefined;
|
|
62
70
|
enum?: undefined;
|
|
63
71
|
} | {
|
|
64
72
|
type: string;
|
|
65
73
|
items: {};
|
|
66
74
|
pattern?: undefined;
|
|
75
|
+
anyOf?: undefined;
|
|
76
|
+
"x-webframez-type"?: undefined;
|
|
77
|
+
"x-openai-file-parameter"?: undefined;
|
|
78
|
+
"x-openai-file-arg-rewrite"?: undefined;
|
|
79
|
+
enum?: undefined;
|
|
80
|
+
} | {
|
|
81
|
+
anyOf: ({
|
|
82
|
+
type: string;
|
|
83
|
+
description: string;
|
|
84
|
+
additionalProperties?: undefined;
|
|
85
|
+
properties?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
type: string;
|
|
88
|
+
additionalProperties: boolean;
|
|
89
|
+
properties: {
|
|
90
|
+
url: {
|
|
91
|
+
type: string;
|
|
92
|
+
};
|
|
93
|
+
download_url: {
|
|
94
|
+
type: string;
|
|
95
|
+
};
|
|
96
|
+
download_link: {
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
file_url: {
|
|
100
|
+
type: string;
|
|
101
|
+
};
|
|
102
|
+
content_base64: {
|
|
103
|
+
type: string;
|
|
104
|
+
};
|
|
105
|
+
data_url: {
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
id: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
filename: {
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
114
|
+
name: {
|
|
115
|
+
type: string;
|
|
116
|
+
};
|
|
117
|
+
mime: {
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
mime_type: {
|
|
121
|
+
type: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
description?: undefined;
|
|
125
|
+
})[];
|
|
126
|
+
"x-webframez-type": string;
|
|
127
|
+
"x-openai-file-parameter": boolean;
|
|
128
|
+
"x-openai-file-arg-rewrite": boolean;
|
|
129
|
+
type?: undefined;
|
|
130
|
+
pattern?: undefined;
|
|
131
|
+
items?: undefined;
|
|
67
132
|
enum?: undefined;
|
|
68
133
|
} | {
|
|
69
134
|
enum: any[];
|
|
70
135
|
type?: undefined;
|
|
71
136
|
pattern?: undefined;
|
|
72
137
|
items?: undefined;
|
|
138
|
+
anyOf?: undefined;
|
|
139
|
+
"x-webframez-type"?: undefined;
|
|
140
|
+
"x-openai-file-parameter"?: undefined;
|
|
141
|
+
"x-openai-file-arg-rewrite"?: undefined;
|
|
73
142
|
};
|
|
74
143
|
export declare function toApiFunctionHttpResult(res: Response, result: any): Response;
|
|
75
144
|
export declare function toApiFunctionPayload(result: any): any;
|
|
@@ -250,6 +250,12 @@ function coerceApiFunctionParam(key, value, definition) {
|
|
|
250
250
|
}
|
|
251
251
|
throw new ApiFunctionRuntimeError(`Parameter "${key}" must be an object`, 400);
|
|
252
252
|
}
|
|
253
|
+
if (type === "file") {
|
|
254
|
+
if (typeof value === "string" || isPlainApiObject(value)) {
|
|
255
|
+
return value;
|
|
256
|
+
}
|
|
257
|
+
throw new ApiFunctionRuntimeError(`Parameter "${key}" must be a file path/string or a file reference object`, 400);
|
|
258
|
+
}
|
|
253
259
|
return value;
|
|
254
260
|
}
|
|
255
261
|
exports.coerceApiFunctionParam = coerceApiFunctionParam;
|
|
@@ -292,6 +298,36 @@ function apiFunctionParamToJsonSchema(definition) {
|
|
|
292
298
|
return { type: "array", items: {} };
|
|
293
299
|
if (type === "object")
|
|
294
300
|
return { type: "object" };
|
|
301
|
+
if (type === "file") {
|
|
302
|
+
return {
|
|
303
|
+
anyOf: [
|
|
304
|
+
{
|
|
305
|
+
type: "string",
|
|
306
|
+
description: "Local ChatGPT runtime file path, downloadable URL, Data-URL, or Base64 content.",
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
type: "object",
|
|
310
|
+
additionalProperties: true,
|
|
311
|
+
properties: {
|
|
312
|
+
url: { type: "string" },
|
|
313
|
+
download_url: { type: "string" },
|
|
314
|
+
download_link: { type: "string" },
|
|
315
|
+
file_url: { type: "string" },
|
|
316
|
+
content_base64: { type: "string" },
|
|
317
|
+
data_url: { type: "string" },
|
|
318
|
+
id: { type: "string" },
|
|
319
|
+
filename: { type: "string" },
|
|
320
|
+
name: { type: "string" },
|
|
321
|
+
mime: { type: "string" },
|
|
322
|
+
mime_type: { type: "string" },
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
"x-webframez-type": "file",
|
|
327
|
+
"x-openai-file-parameter": true,
|
|
328
|
+
"x-openai-file-arg-rewrite": true,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
295
331
|
if (type === "option" && Array.isArray(definition.options) && definition.options.length > 0) {
|
|
296
332
|
return { enum: definition.options.map((option) => option.value) };
|
|
297
333
|
}
|
package/package.json
CHANGED