utilitas 2000.3.39 → 2000.3.41

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/lib/alan.mjs CHANGED
@@ -1072,16 +1072,15 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1072
1072
  x => x.raiFilteredReason
1073
1073
  )?.raiFilteredReason || ERROR_GENERATING);
1074
1074
  if (!options?.raw) {
1075
- const model = packModelLabel([provider, M.source, M.name]);
1076
1075
  resp = {
1077
- text: `🎨 by ${model}`,
1076
+ text: '',
1078
1077
  images: await Promise.all((
1079
1078
  resp?.generatedImages || []
1080
1079
  ).map(async x => ({
1081
1080
  data: await convert(x.image.imageBytes, {
1082
1081
  input: BASE64, suffix: 'png', ...options || {}
1083
1082
  }), mimeType: x.image.mimeType,
1084
- }))), model,
1083
+ }))), model: packModelLabel([provider, M.source, M.name]),
1085
1084
  }
1086
1085
  }
1087
1086
  } else if (M?.video) {
@@ -1112,9 +1111,8 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1112
1111
  if (options?.videoRaw) {
1113
1112
  resp = resp?.response?.generatedVideos;
1114
1113
  } else if (!options?.videoRaw) {
1115
- const model = packModelLabel([provider, M.source, M.name]);
1116
1114
  resp = {
1117
- text: `🎬 by ${model}`,
1115
+ text: '',
1118
1116
  videos: await Promise.all(resp?.response?.generatedVideos?.filter(
1119
1117
  x => x?.video?.uri
1120
1118
  ).map(async x => {
@@ -1130,7 +1128,7 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1130
1128
  input: FILE, suffix: 'mp4', ...options || {}
1131
1129
  }), mimeType: MIME_MP4, jobId: resp.name,
1132
1130
  };
1133
- })), model,
1131
+ })), model: packModelLabel([provider, M.source, M.name]),
1134
1132
  };
1135
1133
  }
1136
1134
  } else if (M?.audio) { // https://ai.google.dev/gemini-api/docs/speech-generation#voices
@@ -1150,21 +1148,20 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1150
1148
  const rawAudio = resp?.candidates?.[0]?.content?.parts?.[0]?.inlineData;
1151
1149
  assert(rawAudio, ERROR_GENERATING, 500);
1152
1150
  if (!options?.raw) {
1153
- const model = packModelLabel([provider, M.source, M.name]);
1154
1151
  resp = {
1155
- text: `🗣️ by ${model}`, audio: {
1152
+ text: '', audio: {
1156
1153
  data: await packPcmToWav(rawAudio?.data, {
1157
1154
  input: BASE64, suffix: wav, ...options || {},
1158
1155
  }), mimeType: MIME_WAV,
1159
- }, model,
1156
+ }, model: packModelLabel([provider, M.source, M.name]),
1160
1157
  };
1161
1158
  }
1162
1159
  } else {
1163
1160
  throwError('Unsupported model.');
1164
1161
  }
1165
- // await streamResp(
1166
- // { ...resp, processing: true }, { ...options, noPack: true }
1167
- // );
1162
+ await streamResp(
1163
+ { ...resp, processing: true }, { ...options, noPack: true }
1164
+ );
1168
1165
  return { ...resp, processing: false };
1169
1166
  };
1170
1167
 
@@ -1188,14 +1185,13 @@ const promptOpenAI = async (aiId, prompt, options = {}) => {
1188
1185
  input: prompt, ...options?.params || {},
1189
1186
  });
1190
1187
  if (!options?.raw) {
1191
- const model = packModelLabel([provider, M.source, M.name]);
1192
1188
  resp = {
1193
- text: `🗣️ by ${model}`, audio: {
1189
+ text: '', audio: {
1194
1190
  data: await convert(Buffer.from(
1195
1191
  await resp.arrayBuffer()
1196
1192
  ), { suffix: OGG_EXT, ...options || {} }),
1197
1193
  mimeType: MIME_OGG,
1198
- }, model,
1194
+ }, model: packModelLabel([provider, M.source, M.name]),
1199
1195
  };
1200
1196
  }
1201
1197
  } else if (M?.hearing) {
@@ -1221,9 +1217,9 @@ const promptOpenAI = async (aiId, prompt, options = {}) => {
1221
1217
  } else {
1222
1218
  throwError('Unsupported model.');
1223
1219
  }
1224
- // await streamResp(
1225
- // { ...resp, processing: true }, { ...options, noPack: true }
1226
- // );
1220
+ await streamResp(
1221
+ { ...resp, processing: true }, { ...options, noPack: true }
1222
+ );
1227
1223
  return { ...resp, processing: false };
1228
1224
  };
1229
1225
 
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2000.3.39",
4
+ "version": "2000.3.41",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2000.3.39",
4
+ "version": "2000.3.41",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",