@webtypen/webframez-core 0.3.44 → 0.3.46

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,75 +54,71 @@ export declare function apiFunctionParamToJsonSchema(definition: ApiFunctionPara
54
54
  type: string;
55
55
  pattern?: undefined;
56
56
  items?: undefined;
57
- anyOf?: undefined;
57
+ additionalProperties?: undefined;
58
+ properties?: undefined;
58
59
  "x-webframez-type"?: undefined;
59
- "x-openai-file-parameter"?: undefined;
60
60
  enum?: undefined;
61
61
  } | {
62
62
  type: string;
63
63
  pattern: string;
64
64
  items?: undefined;
65
- anyOf?: undefined;
65
+ additionalProperties?: undefined;
66
+ properties?: undefined;
66
67
  "x-webframez-type"?: undefined;
67
- "x-openai-file-parameter"?: undefined;
68
68
  enum?: undefined;
69
69
  } | {
70
70
  type: string;
71
71
  items: {};
72
72
  pattern?: undefined;
73
- anyOf?: undefined;
73
+ additionalProperties?: undefined;
74
+ properties?: undefined;
74
75
  "x-webframez-type"?: undefined;
75
- "x-openai-file-parameter"?: undefined;
76
76
  enum?: undefined;
77
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
- };
78
+ type: string;
79
+ additionalProperties: boolean;
80
+ properties: {
81
+ download_url: {
82
+ type: string;
83
+ };
84
+ file_id: {
85
+ type: string;
86
+ };
87
+ mime_type: {
88
+ type: string;
89
+ };
90
+ file_name: {
91
+ type: string;
92
+ };
93
+ url: {
94
+ type: string;
95
+ };
96
+ download_link: {
97
+ type: string;
98
+ };
99
+ file_url: {
100
+ type: string;
120
101
  };
121
- description?: undefined;
122
- })[];
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
+ };
123
121
  "x-webframez-type": string;
124
- "x-openai-file-parameter": boolean;
125
- type?: undefined;
126
122
  pattern?: undefined;
127
123
  items?: undefined;
128
124
  enum?: undefined;
@@ -131,9 +127,9 @@ export declare function apiFunctionParamToJsonSchema(definition: ApiFunctionPara
131
127
  type?: undefined;
132
128
  pattern?: undefined;
133
129
  items?: undefined;
134
- anyOf?: undefined;
130
+ additionalProperties?: undefined;
131
+ properties?: undefined;
135
132
  "x-webframez-type"?: undefined;
136
- "x-openai-file-parameter"?: undefined;
137
133
  };
138
134
  export declare function toApiFunctionHttpResult(res: Response, result: any): Response;
139
135
  export declare function toApiFunctionPayload(result: any): any;
@@ -251,10 +251,19 @@ function coerceApiFunctionParam(key, value, definition) {
251
251
  throw new ApiFunctionRuntimeError(`Parameter "${key}" must be an object`, 400);
252
252
  }
253
253
  if (type === "file") {
254
- if (typeof value === "string" || isPlainApiObject(value)) {
254
+ if (isPlainApiObject(value)) {
255
255
  return value;
256
256
  }
257
- throw new ApiFunctionRuntimeError(`Parameter "${key}" must be a file path/string or a file reference object`, 400);
257
+ if (typeof value === "string") {
258
+ try {
259
+ const parsed = JSON.parse(value);
260
+ if (isPlainApiObject(parsed)) {
261
+ return parsed;
262
+ }
263
+ }
264
+ catch (_error) { }
265
+ }
266
+ throw new ApiFunctionRuntimeError(`Parameter "${key}" must be a file reference object`, 400);
258
267
  }
259
268
  return value;
260
269
  }
@@ -300,31 +309,24 @@ function apiFunctionParamToJsonSchema(definition) {
300
309
  return { type: "object" };
301
310
  if (type === "file") {
302
311
  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
- ],
312
+ type: "object",
313
+ additionalProperties: true,
314
+ properties: {
315
+ download_url: { type: "string" },
316
+ file_id: { type: "string" },
317
+ mime_type: { type: "string" },
318
+ file_name: { type: "string" },
319
+ url: { type: "string" },
320
+ download_link: { type: "string" },
321
+ file_url: { type: "string" },
322
+ content_base64: { type: "string" },
323
+ data_url: { type: "string" },
324
+ id: { type: "string" },
325
+ filename: { type: "string" },
326
+ name: { type: "string" },
327
+ mime: { type: "string" },
328
+ },
326
329
  "x-webframez-type": "file",
327
- "x-openai-file-parameter": true,
328
330
  };
329
331
  }
330
332
  if (type === "option" && Array.isArray(definition.options) && definition.options.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.3.44",
3
+ "version": "0.3.46",
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",