@webtypen/webframez-core 0.3.43 → 0.3.44

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,86 @@ 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;
57
60
  enum?: undefined;
58
61
  } | {
59
62
  type: string;
60
63
  pattern: string;
61
64
  items?: undefined;
65
+ anyOf?: undefined;
66
+ "x-webframez-type"?: undefined;
67
+ "x-openai-file-parameter"?: undefined;
62
68
  enum?: undefined;
63
69
  } | {
64
70
  type: string;
65
71
  items: {};
66
72
  pattern?: undefined;
73
+ anyOf?: undefined;
74
+ "x-webframez-type"?: undefined;
75
+ "x-openai-file-parameter"?: undefined;
76
+ enum?: undefined;
77
+ } | {
78
+ anyOf: ({
79
+ type: string;
80
+ description: string;
81
+ additionalProperties?: undefined;
82
+ properties?: undefined;
83
+ } | {
84
+ type: string;
85
+ additionalProperties: boolean;
86
+ properties: {
87
+ url: {
88
+ type: string;
89
+ };
90
+ download_url: {
91
+ type: string;
92
+ };
93
+ download_link: {
94
+ type: string;
95
+ };
96
+ file_url: {
97
+ type: string;
98
+ };
99
+ content_base64: {
100
+ type: string;
101
+ };
102
+ data_url: {
103
+ type: string;
104
+ };
105
+ id: {
106
+ type: string;
107
+ };
108
+ filename: {
109
+ type: string;
110
+ };
111
+ name: {
112
+ type: string;
113
+ };
114
+ mime: {
115
+ type: string;
116
+ };
117
+ mime_type: {
118
+ type: string;
119
+ };
120
+ };
121
+ description?: undefined;
122
+ })[];
123
+ "x-webframez-type": string;
124
+ "x-openai-file-parameter": boolean;
125
+ type?: undefined;
126
+ pattern?: undefined;
127
+ items?: undefined;
67
128
  enum?: undefined;
68
129
  } | {
69
130
  enum: any[];
70
131
  type?: undefined;
71
132
  pattern?: undefined;
72
133
  items?: undefined;
134
+ anyOf?: undefined;
135
+ "x-webframez-type"?: undefined;
136
+ "x-openai-file-parameter"?: undefined;
73
137
  };
74
138
  export declare function toApiFunctionHttpResult(res: Response, result: any): Response;
75
139
  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,35 @@ 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
+ };
329
+ }
295
330
  if (type === "option" && Array.isArray(definition.options) && definition.options.length > 0) {
296
331
  return { enum: definition.options.map((option) => option.value) };
297
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.3.43",
3
+ "version": "0.3.44",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",