bunnyquery 1.2.2 → 1.2.3
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/bunnyquery.js +22 -2
- package/package.json +1 -1
package/bunnyquery.js
CHANGED
|
@@ -2417,6 +2417,14 @@
|
|
|
2417
2417
|
if (n < 1024 * 1024) return (n / 1024).toFixed(1) + " KB";
|
|
2418
2418
|
return (n / (1024 * 1024)).toFixed(1) + " MB";
|
|
2419
2419
|
}
|
|
2420
|
+
// Build the "Indexing: <file> · <mime> · <size>" label for background
|
|
2421
|
+
// indexing tasks (live bubble + history). mime/size are appended when known.
|
|
2422
|
+
function buildIndexingLabel(name, mime, size) {
|
|
2423
|
+
var extras = [];
|
|
2424
|
+
if (mime) extras.push(mime);
|
|
2425
|
+
if (size != null && size !== "" && !isNaN(Number(size))) extras.push(formatBytes(size));
|
|
2426
|
+
return "Indexing: " + name + (extras.length ? " · " + extras.join(" · ") : "");
|
|
2427
|
+
}
|
|
2420
2428
|
function sanitizeStorageSegment(name) {
|
|
2421
2429
|
// The db CDN serves files through a %-encoded path; object keys that
|
|
2422
2430
|
// contain spaces (or other chars that round-trip badly through
|
|
@@ -2538,6 +2546,8 @@
|
|
|
2538
2546
|
bgTaskQueue.push({
|
|
2539
2547
|
serviceId: S.serviceId, platform: S.aiPlatform, id: ack.id,
|
|
2540
2548
|
filename: member.file.name,
|
|
2549
|
+
mime: member.file.type || mimeGetType(member.file.name),
|
|
2550
|
+
size: member.file.size,
|
|
2541
2551
|
status: ack.status === "running" ? "running" : "pending",
|
|
2542
2552
|
poll: ack.poll,
|
|
2543
2553
|
});
|
|
@@ -3160,7 +3170,17 @@
|
|
|
3160
3170
|
var displayContent;
|
|
3161
3171
|
if (item._isBgTask) {
|
|
3162
3172
|
var nameMatch = userText.match(/^- name: (.+)$/m);
|
|
3163
|
-
|
|
3173
|
+
if (nameMatch) {
|
|
3174
|
+
var mimeMatch = userText.match(/^- mime type: (.+)$/m);
|
|
3175
|
+
var sizeMatch = userText.match(/^- size \(bytes\): (\d+)$/m);
|
|
3176
|
+
displayContent = buildIndexingLabel(
|
|
3177
|
+
nameMatch[1].trim(),
|
|
3178
|
+
mimeMatch ? mimeMatch[1].trim() : "",
|
|
3179
|
+
sizeMatch ? Number(sizeMatch[1]) : null
|
|
3180
|
+
);
|
|
3181
|
+
} else {
|
|
3182
|
+
displayContent = userText;
|
|
3183
|
+
}
|
|
3164
3184
|
} else {
|
|
3165
3185
|
displayContent = sanitizeAttachmentLinksForHistory(userText);
|
|
3166
3186
|
}
|
|
@@ -3223,7 +3243,7 @@
|
|
|
3223
3243
|
if (entry.serviceId !== svcId || entry.platform !== plat) return;
|
|
3224
3244
|
if (CS.messages.some(function (m) { return m._serverItemId === entry.id; })) return;
|
|
3225
3245
|
var isRunning = entry.status === "running";
|
|
3226
|
-
var userBubble = { role: "user", content:
|
|
3246
|
+
var userBubble = { role: "user", content: buildIndexingLabel(entry.filename, entry.mime, entry.size), isBackgroundTask: true, _serverItemId: entry.id };
|
|
3227
3247
|
if (isRunning) userBubble.isPendingInProcess = true; else userBubble.isPendingQueued = true;
|
|
3228
3248
|
CS.messages.push(userBubble);
|
|
3229
3249
|
if (isRunning) {
|