utilitas 2000.3.37 → 2000.3.40

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
@@ -1073,7 +1073,8 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1073
1073
  )?.raiFilteredReason || ERROR_GENERATING);
1074
1074
  if (!options?.raw) {
1075
1075
  resp = {
1076
- text: '', images: await Promise.all((
1076
+ text: '',
1077
+ images: await Promise.all((
1077
1078
  resp?.generatedImages || []
1078
1079
  ).map(async x => ({
1079
1080
  data: await convert(x.image.imageBytes, {
@@ -1111,7 +1112,8 @@ const promptGoogle = async (aiId, prompt, options = {}) => {
1111
1112
  resp = resp?.response?.generatedVideos;
1112
1113
  } else if (!options?.videoRaw) {
1113
1114
  resp = {
1114
- text: '', videos: await Promise.all(resp?.response?.generatedVideos?.filter(
1115
+ text: '',
1116
+ videos: await Promise.all(resp?.response?.generatedVideos?.filter(
1115
1117
  x => x?.video?.uri
1116
1118
  ).map(async x => {
1117
1119
  const downloadPath = `${getTempPath({
@@ -1245,8 +1247,7 @@ const initChat = async (options = {}) => {
1245
1247
  };
1246
1248
 
1247
1249
  const defaultSession = session => ({
1248
- messages: [], systemPrompt: chatConfig.systemPrompt,
1249
- threadId: null, ...session || {},
1250
+ messages: [], systemPrompt: chatConfig.systemPrompt, ...session || {},
1250
1251
  });
1251
1252
 
1252
1253
  const assertSessionId = sessionId => {
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.37",
4
+ "version": "2000.3.40",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/utilitas.mjs CHANGED
@@ -218,6 +218,22 @@ const ensureDate = (dt, options) => {
218
218
  return dt;
219
219
  };
220
220
 
221
+ const uptime = () => {
222
+ let resp = `${getTimeIcon(new Date())} ${new Date().toTimeString(
223
+ ).split(' ')[0].split(':').slice(0, 2).join(':')} up`;
224
+ let seconds = process.uptime();
225
+ const days = Math.floor(seconds / (3600 * 24));
226
+ seconds -= days * 3600 * 24;
227
+ let hours = Math.floor(seconds / 3600);
228
+ seconds -= hours * 3600;
229
+ hours = hours.toString().padStart(2, '0');
230
+ let minutes = Math.floor(seconds / 60);
231
+ minutes = minutes.toString().padStart(2, '0');
232
+ seconds = Math.floor(seconds % 60).toString().padStart(2, '0');
233
+ days > 0 && (resp += ` ${days} day${days > 1 ? 's' : ''},`);
234
+ return `${resp} ${hours}:${minutes}:${seconds}`;
235
+ };
236
+
221
237
  const getRandomIndexInArray = (array, options) => {
222
238
  const count = ~~options?.count;
223
239
  const result = randomArray([...array.keys()]).slice(0, count || 1);
@@ -936,6 +952,7 @@ export {
936
952
  verifyPhone,
937
953
  verifyUrl,
938
954
  verifyUuid,
955
+ uptime,
939
956
  voidFunc,
940
957
  which
941
958
  };
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.37",
4
+ "version": "2000.3.40",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",