pangea-server 3.3.4 → 3.3.5
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,10 +1,6 @@
|
|
|
1
|
-
type Part = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
fileData: {
|
|
5
|
-
fileUri: string;
|
|
6
|
-
mimeType: string;
|
|
7
|
-
};
|
|
1
|
+
type Part = string | {
|
|
2
|
+
fileUri: string;
|
|
3
|
+
mimeType: string;
|
|
8
4
|
};
|
|
9
|
-
export declare function generateIaText(
|
|
5
|
+
export declare function generateIaText(content: string | Part[]): Promise<string | undefined>;
|
|
10
6
|
export {};
|
|
@@ -3,9 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateIaText = void 0;
|
|
4
4
|
// helpers
|
|
5
5
|
const helpers_1 = require("../helpers");
|
|
6
|
-
async function generateIaText(
|
|
6
|
+
async function generateIaText(content) {
|
|
7
7
|
const { GoogleGenAI } = await import('@google/genai');
|
|
8
8
|
const ai = new GoogleGenAI({ apiKey: (0, helpers_1.getEnvStr)('GEMINI_API_KEY') });
|
|
9
|
+
const contents = typeof content === 'string'
|
|
10
|
+
? content
|
|
11
|
+
: content.map((part) => {
|
|
12
|
+
return typeof part === 'string'
|
|
13
|
+
? { text: part }
|
|
14
|
+
: { fileData: { fileUri: part.fileUri, mimeType: part.mimeType } };
|
|
15
|
+
});
|
|
9
16
|
const response = await ai.models.generateContent({ model: 'gemini-2.5-flash-lite', contents });
|
|
10
17
|
return response.text;
|
|
11
18
|
}
|