pangea-server 3.3.5 → 3.3.6

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.
@@ -1,6 +1,8 @@
1
- type Part = string | {
2
- fileUri: string;
3
- mimeType: string;
1
+ /// <reference types="node" />
2
+ type File = {
3
+ buffer: Buffer;
4
+ mimetype: string;
4
5
  };
6
+ type Part = string | File;
5
7
  export declare function generateIaText(content: string | Part[]): Promise<string | undefined>;
6
8
  export {};
@@ -8,11 +8,13 @@ async function generateIaText(content) {
8
8
  const ai = new GoogleGenAI({ apiKey: (0, helpers_1.getEnvStr)('GEMINI_API_KEY') });
9
9
  const contents = typeof content === 'string'
10
10
  ? content
11
- : content.map((part) => {
12
- return typeof part === 'string'
13
- ? { text: part }
14
- : { fileData: { fileUri: part.fileUri, mimeType: part.mimeType } };
15
- });
11
+ : await Promise.all(content.map(async (part) => {
12
+ if (typeof part === 'string')
13
+ return { text: part };
14
+ const blob = new Blob([new Uint8Array(part.buffer)], { type: part.mimetype });
15
+ const uploadedFile = await ai.files.upload({ file: blob });
16
+ return { fileData: { fileUri: uploadedFile.uri, mimeType: part.mimetype } };
17
+ }));
16
18
  const response = await ai.models.generateContent({ model: 'gemini-2.5-flash-lite', contents });
17
19
  return response.text;
18
20
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.5",
4
+ "version": "3.3.6",
5
5
  "files": [
6
6
  "dist"
7
7
  ],