@tstdl/base 0.92.31 → 0.92.32
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 +7 -3
- package/package.json +1 -1
package/ai/ai.service.js
CHANGED
|
@@ -16,7 +16,7 @@ import { toArray } from '../utils/array/array.js';
|
|
|
16
16
|
import { mapAsync } from '../utils/async-iterable-helpers/map.js';
|
|
17
17
|
import { toArrayAsync } from '../utils/async-iterable-helpers/to-array.js';
|
|
18
18
|
import { hasOwnProperty, objectEntries } from '../utils/object/object.js';
|
|
19
|
-
import { assertDefinedPass, assertNotNullPass, isDefined, isUndefined } from '../utils/type-guards.js';
|
|
19
|
+
import { assertDefinedPass, assertNotNullPass, isDefined, isNotNull, isUndefined } from '../utils/type-guards.js';
|
|
20
20
|
import { resolveValueOrAsyncProvider } from '../utils/value-or-provider.js';
|
|
21
21
|
import { AiFileService } from './ai-file.service.js';
|
|
22
22
|
import { AiSession } from './ai-session.js';
|
|
@@ -333,15 +333,18 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
|
|
|
333
333
|
convertGoogleContent(content) {
|
|
334
334
|
return {
|
|
335
335
|
role: content.role,
|
|
336
|
-
parts: content.parts
|
|
336
|
+
parts: content.parts
|
|
337
|
+
.map((part) => {
|
|
337
338
|
if (isDefined(part.text)) {
|
|
339
|
+
if (part.text.length == 0) {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
338
342
|
return { text: part.text };
|
|
339
343
|
}
|
|
340
344
|
if (isDefined(part.fileData)) {
|
|
341
345
|
const file = assertDefinedPass(this.#fileService.getFileByUri(part.fileData.fileUri), 'File not found.');
|
|
342
346
|
return { file: file.id };
|
|
343
347
|
}
|
|
344
|
-
;
|
|
345
348
|
if (isDefined(part.functionResponse)) {
|
|
346
349
|
return { functionResult: { name: part.functionResponse.name, value: part.functionResponse.response } };
|
|
347
350
|
}
|
|
@@ -350,6 +353,7 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
|
|
|
350
353
|
}
|
|
351
354
|
throw new NotSupportedError('Unsupported content part.');
|
|
352
355
|
})
|
|
356
|
+
.filter(isNotNull)
|
|
353
357
|
};
|
|
354
358
|
}
|
|
355
359
|
getModel(model) {
|