@kodaris/krubble-app-components 1.0.90 → 1.0.91

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.
@@ -685,6 +685,19 @@
685
685
  *
686
686
  * @param itemId - The unique identifier of the nav group to toggle
687
687
  */
688
+ /**
689
+ * Expand a nav group by id. Public so consumers can keep a group open after
690
+ * adding it dynamically — the scaffold only auto-expands groups once at startup,
691
+ * so a group added later (e.g. an async "Recent" list) would otherwise stay
692
+ * collapsed. Idempotent; a no-op if the group is already expanded.
693
+ */
694
+ expandNavGroup(groupId) {
695
+ if (this.navItemsExpanded.has(groupId)) {
696
+ return;
697
+ }
698
+ this.navItemsExpanded.add(groupId);
699
+ this.requestUpdate();
700
+ }
688
701
  toggleNavItem(itemId) {
689
702
  const navItem = this.shadowRoot?.querySelector(`.nav-item[data-id="${itemId}"]`);
690
703
  const groupEl = navItem?.nextElementSibling;
@@ -6815,16 +6828,31 @@
6815
6828
  body: form,
6816
6829
  })
6817
6830
  .then((r) => r.json())
6818
- .then((res) => res?.data?.conversationFileID);
6819
- })).then((ids) => ids.filter((id) => typeof id === 'number'));
6831
+ // Keep the whole file DTO the upload returns (id + niceName +
6832
+ // mimeType + …), not just the id — it's attached to the sent message
6833
+ // below so the attachment shows immediately.
6834
+ .then((res) => res.data);
6835
+ }));
6820
6836
  }
6821
- return uploaded.then((fileIds) => {
6837
+ return uploaded.then((files) => {
6838
+ // Attach the uploaded files to the just-sent user message so its
6839
+ // thumbnails show right away (no reload). The last user message is the
6840
+ // one _send appended before the trailing empty assistant message.
6841
+ if (files.length) {
6842
+ for (let i = this.messages.length - 1; i >= 0; i--) {
6843
+ if (this.messages[i].type === 'user') {
6844
+ this.messages[i].conversationFiles = files;
6845
+ this.requestUpdate();
6846
+ break;
6847
+ }
6848
+ }
6849
+ }
6822
6850
  // Conversation targeting: continue `conversationId` when set, else
6823
6851
  // start a fresh conversation (createNew) for this turn. The pin below
6824
6852
  // means createNew only fires on the very first untargeted turn.
6825
6853
  const body = {
6826
6854
  userText: params.message,
6827
- fileIds,
6855
+ fileIds: files.map((f) => f.conversationFileID),
6828
6856
  };
6829
6857
  if (this.conversationId != null) {
6830
6858
  body.conversationID = this.conversationId;