@roj-ai/sdk 0.1.19 → 0.1.20
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.
- package/dist/lib/mime.d.ts +1 -1
- package/dist/lib/mime.d.ts.map +1 -1
- package/dist/lib/mime.js +7 -4
- package/dist/lib/mime.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/mime.ts +7 -4
package/dist/lib/mime.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Get MIME type for an image file based on extension.
|
|
6
|
-
* Returns undefined if not
|
|
6
|
+
* Returns undefined if not an LLM-supported image format.
|
|
7
7
|
*/
|
|
8
8
|
export declare function getImageMimeType(filename: string): string | undefined;
|
|
9
9
|
//# sourceMappingURL=mime.d.ts.map
|
package/dist/lib/mime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGrE"}
|
package/dist/lib/mime.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MIME type detection utilities.
|
|
3
3
|
*/
|
|
4
|
+
// Only formats accepted as image content by the LLM providers (Anthropic
|
|
5
|
+
// allows jpeg/png/gif/webp). Notably excludes svg/bmp/ico: feeding those as
|
|
6
|
+
// image blocks makes the provider reject the whole request with a 400
|
|
7
|
+
// ("media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or
|
|
8
|
+
// 'image/webp'"). Such files fall through to being read as text instead —
|
|
9
|
+
// which for SVG (XML) is more useful to the model anyway.
|
|
4
10
|
const IMAGE_MIME_TYPES = {
|
|
5
11
|
png: 'image/png',
|
|
6
12
|
jpg: 'image/jpeg',
|
|
7
13
|
jpeg: 'image/jpeg',
|
|
8
14
|
gif: 'image/gif',
|
|
9
15
|
webp: 'image/webp',
|
|
10
|
-
svg: 'image/svg+xml',
|
|
11
|
-
bmp: 'image/bmp',
|
|
12
|
-
ico: 'image/x-icon',
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
18
|
* Get MIME type for an image file based on extension.
|
|
16
|
-
* Returns undefined if not
|
|
19
|
+
* Returns undefined if not an LLM-supported image format.
|
|
17
20
|
*/
|
|
18
21
|
export function getImageMimeType(filename) {
|
|
19
22
|
const ext = filename.split('.').pop()?.toLowerCase();
|
package/dist/lib/mime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,gBAAgB,GAA2B;IAChD,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,0EAA0E;AAC1E,0EAA0E;AAC1E,0DAA0D;AAC1D,MAAM,gBAAgB,GAA2B;IAChD,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAA;IACpD,OAAO,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roj-ai/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"type-check": "tsc --noEmit"
|
|
136
136
|
},
|
|
137
137
|
"dependencies": {
|
|
138
|
-
"@roj-ai/transport": "^0.1.
|
|
138
|
+
"@roj-ai/transport": "^0.1.20",
|
|
139
139
|
"@hono/zod-validator": "0.7.6",
|
|
140
140
|
"hono": "4.12.5",
|
|
141
141
|
"ignore": "7.0.5",
|
package/src/lib/mime.ts
CHANGED
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
* MIME type detection utilities.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
// Only formats accepted as image content by the LLM providers (Anthropic
|
|
6
|
+
// allows jpeg/png/gif/webp). Notably excludes svg/bmp/ico: feeding those as
|
|
7
|
+
// image blocks makes the provider reject the whole request with a 400
|
|
8
|
+
// ("media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or
|
|
9
|
+
// 'image/webp'"). Such files fall through to being read as text instead —
|
|
10
|
+
// which for SVG (XML) is more useful to the model anyway.
|
|
5
11
|
const IMAGE_MIME_TYPES: Record<string, string> = {
|
|
6
12
|
png: 'image/png',
|
|
7
13
|
jpg: 'image/jpeg',
|
|
8
14
|
jpeg: 'image/jpeg',
|
|
9
15
|
gif: 'image/gif',
|
|
10
16
|
webp: 'image/webp',
|
|
11
|
-
svg: 'image/svg+xml',
|
|
12
|
-
bmp: 'image/bmp',
|
|
13
|
-
ico: 'image/x-icon',
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Get MIME type for an image file based on extension.
|
|
18
|
-
* Returns undefined if not
|
|
21
|
+
* Returns undefined if not an LLM-supported image format.
|
|
19
22
|
*/
|
|
20
23
|
export function getImageMimeType(filename: string): string | undefined {
|
|
21
24
|
const ext = filename.split('.').pop()?.toLowerCase()
|