@tstdl/base 0.92.78 → 0.92.79
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/ai/ai.service.js +22 -20
- package/package.json +1 -1
package/ai/ai.service.js
CHANGED
|
@@ -339,27 +339,29 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
|
|
|
339
339
|
convertGoogleContent(content) {
|
|
340
340
|
return {
|
|
341
341
|
role: content.role,
|
|
342
|
-
parts: content.parts
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
342
|
+
parts: isUndefined(content.parts)
|
|
343
|
+
? []
|
|
344
|
+
: content.parts
|
|
345
|
+
.map((part) => {
|
|
346
|
+
if (isDefined(part.text)) {
|
|
347
|
+
if (part.text.length == 0) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
return { text: part.text };
|
|
347
351
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
})
|
|
362
|
-
.filter(isNotNull)
|
|
352
|
+
if (isDefined(part.fileData)) {
|
|
353
|
+
const file = assertDefinedPass(this.#fileService.getFileByUri(part.fileData.fileUri), 'File not found.');
|
|
354
|
+
return { file: file.id };
|
|
355
|
+
}
|
|
356
|
+
if (isDefined(part.functionResponse)) {
|
|
357
|
+
return { functionResult: { name: part.functionResponse.name, value: part.functionResponse.response } };
|
|
358
|
+
}
|
|
359
|
+
if (isDefined(part.functionCall)) {
|
|
360
|
+
return { functionCall: { name: part.functionCall.name, parameters: part.functionCall.args } };
|
|
361
|
+
}
|
|
362
|
+
throw new NotSupportedError('Unsupported content part.');
|
|
363
|
+
})
|
|
364
|
+
.filter(isNotNull)
|
|
363
365
|
};
|
|
364
366
|
}
|
|
365
367
|
getModel(model) {
|