fluxy-bot 0.3.25 → 0.3.27

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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
6
6
  <title>Fluxy Chat</title>
7
- <script type="module" crossorigin src="/fluxy/assets/fluxy-D_vy8fea.js"></script>
7
+ <script type="module" crossorigin src="/fluxy/assets/fluxy-BXld9bgF.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/fluxy/assets/globals-BmcQJ_1f.js">
9
9
  <link rel="stylesheet" crossorigin href="/fluxy/assets/globals-BdY9BJIP.css">
10
10
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "description": "Self-hosted AI bot — run your own AI assistant from anywhere",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -149,7 +149,9 @@ export default function InputBar({ onSend, onStop, streaming, whisperEnabled, on
149
149
  data = await res.json();
150
150
  }
151
151
  if (data.transcript?.trim()) {
152
- onSend(data.transcript.trim(), undefined, dataUrl);
152
+ const pendingAtts = attachments.length > 0 ? attachments : undefined;
153
+ onSend(data.transcript.trim(), pendingAtts, dataUrl);
154
+ if (pendingAtts) setAttachments([]);
153
155
  }
154
156
  } catch {
155
157
  // Transcription failed silently
@@ -164,7 +166,7 @@ export default function InputBar({ onSend, onStop, streaming, whisperEnabled, on
164
166
  setIsRecording(false);
165
167
  setRecordingTime(0);
166
168
  dragRef.current = 0;
167
- }, [onSend, onTranscribe]);
169
+ }, [onSend, onTranscribe, attachments]);
168
170
 
169
171
  // ── File handling ──
170
172
 
@@ -379,7 +381,7 @@ export default function InputBar({ onSend, onStop, streaming, whisperEnabled, on
379
381
  >
380
382
  <Square className="h-4 w-4" />
381
383
  </button>
382
- ) : hasContent ? (
384
+ ) : hasText ? (
383
385
  <button
384
386
  onClick={handleSend}
385
387
  className="flex items-center justify-center h-12 w-12 shrink-0 rounded-full bg-white text-gray-900 transition-colors hover:bg-gray-100"
@@ -34,9 +34,11 @@ export default function MessageBubble({ role, content, timestamp, hasAttachments
34
34
  const docAtts = attachments?.filter((a) => !a.mediaType?.startsWith('image/')) || [];
35
35
 
36
36
  // Resolve image URLs
37
- const imageUrls = imageAtts.map((a) =>
38
- a.filePath.startsWith('data:') ? a.filePath : `/api/files/${a.filePath}`
39
- );
37
+ const imageUrls = imageAtts
38
+ .filter((a) => a.filePath)
39
+ .map((a) =>
40
+ a.filePath.startsWith('data:') ? a.filePath : `/api/files/${a.filePath}`
41
+ );
40
42
 
41
43
  if (isUser) {
42
44
  // Voice message: audio-only, no transcript text
@@ -396,12 +396,12 @@ export async function startSupervisor() {
396
396
  }
397
397
  convId = dbConvId!;
398
398
 
399
- // Save user message to DB (include attachment metadata)
399
+ // Save user message to DB (include attachment metadata as JSON string)
400
400
  const meta: any = { model: freshConfig.ai.model };
401
401
  if (savedFiles.length) {
402
- meta.attachments = savedFiles.map((f) => ({
403
- type: f.type, name: f.name, mediaType: f.mediaType, path: f.relPath,
404
- }));
402
+ meta.attachments = JSON.stringify(savedFiles.map((f) => ({
403
+ type: f.type, name: f.name, mediaType: f.mediaType, filePath: f.relPath,
404
+ })));
405
405
  }
406
406
  await workerApi(`/api/conversations/${convId}/messages`, 'POST', {
407
407
  role: 'user', content, meta,
@@ -431,27 +431,21 @@ export async function startSupervisor() {
431
431
  return; // don't forward bot:done to client
432
432
  }
433
433
 
434
- // Save assistant response to DB and broadcast to other clients
434
+ // Save assistant response to DB
435
435
  if (type === 'bot:response') {
436
436
  (async () => {
437
437
  try {
438
438
  await workerApi(`/api/conversations/${convId}/messages`, 'POST', {
439
439
  role: 'assistant', content: eventData.content, meta: { model: freshConfig.ai.model },
440
440
  });
441
- broadcastFluxyExcept(ws, 'chat:sync', {
442
- conversationId: convId,
443
- message: { role: 'assistant', content: eventData.content, timestamp: new Date().toISOString() },
444
- });
445
441
  } catch (err: any) {
446
442
  log.warn(`[fluxy] DB persist bot response error: ${err.message}`);
447
443
  }
448
444
  })();
449
445
  }
450
446
 
451
- // Guard all ws.send with readyState check
452
- if (ws.readyState === WebSocket.OPEN) {
453
- ws.send(JSON.stringify({ type, data: eventData }));
454
- }
447
+ // Stream all events to every connected client
448
+ broadcastFluxy(type, eventData);
455
449
  }, data.attachments, savedFiles);
456
450
  })();
457
451
  return;