@widgetic/chat 0.1.25 → 0.1.26

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.
@@ -551,7 +551,27 @@
551
551
  function versionLabelFromPrompt(turn: ChatTurn): string | null {
552
552
  const key = versionPromptKey(turn.user?.messageContent);
553
553
  if (!key) return null;
554
- return versionLabelByPrompt[key] ?? null;
554
+ const label = versionLabelByPrompt[key] ?? null;
555
+ if (!label) return null;
556
+ // The same sentence is sent again on Retry. The prompt map only has one
557
+ // number, so the new bubble was wearing the previous version until its
558
+ // own commit landed.
559
+ const index = chatTurns.indexOf(turn);
560
+ if (index > 0) {
561
+ const earlierSamePrompt = chatTurns.slice(0, index).some((candidate) =>
562
+ versionPromptKey(candidate.user?.messageContent) === key
563
+ );
564
+ if (earlierSamePrompt) return null;
565
+ }
566
+ return label;
567
+ }
568
+
569
+ function earlierTurnRepeatsThisPrompt(turn: ChatTurn, turnIndex: number): boolean {
570
+ const key = versionPromptKey(turn.user?.messageContent);
571
+ if (!key) return false;
572
+ return chatTurns.slice(0, turnIndex).some((candidate) =>
573
+ versionPromptKey(candidate.user?.messageContent) === key
574
+ );
555
575
  }
556
576
 
557
577
  /** The dropdown's version, else the commit sha, decides which turn is current. */
@@ -1371,7 +1391,7 @@
1371
1391
  <div class="message-attachments-container">
1372
1392
  <AttachmentDisplay attachments={shownAttachments} variant="message" showPreview={true} />
1373
1393
  </div>
1374
- {:else if userMsg.messageContent && messageImpliesAttachedFile(userMsg.messageContent)}
1394
+ {:else if userMsg.messageContent && messageImpliesAttachedFile(userMsg.messageContent) && !earlierTurnRepeatsThisPrompt(turn, turnIndex)}
1375
1395
  <div class="wc-missing-attachment-placeholder message-attachments-container flex flex-col items-center gap-1 px-3 pb-3">
1376
1396
  <div class="wc-missing-attachment-thumb flex h-20 w-28 flex-col items-center justify-center gap-1 rounded-md border border-dashed border-gray-300 bg-gray-100 text-gray-400" title={$t('chat.messages.attachmentMissingTitle')} aria-label={$t('chat.messages.attachmentMissingLabel')}>
1377
1397
  <svg class="h-8 w-8 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/chat",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",