@hivegpt/hiveai-angular 0.0.433 → 0.0.434

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.
@@ -1729,33 +1729,41 @@ class ChatDrawerComponent {
1729
1729
  else if ((_k = res === null || res === void 0 ? void 0 : res.m) === null || _k === void 0 ? void 0 : _k.OtherFields) {
1730
1730
  const otherFields = res.m.OtherFields;
1731
1731
  const serializable = otherFields.serializable_to_return;
1732
- // Session cards: tool get_event_sessions (same as React Native)
1733
- if ((serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions') {
1732
+ // Session cards: get_event_sessions or get_event_sessions_v2 (v2 may send text content; we only show cards when content is JSON with sessions)
1733
+ const isSessionTool = (serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions' ||
1734
+ (serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions_v2';
1735
+ if (isSessionTool) {
1734
1736
  const contentStr = (_o = (_m = (_l = serializable === null || serializable === void 0 ? void 0 : serializable.tool_result) === null || _l === void 0 ? void 0 : _l.messages) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.content;
1735
1737
  const answerText = otherFields.answer != null ? String(otherFields.answer).trim() : '';
1736
- if (contentStr) {
1738
+ let pushed = false;
1739
+ if (contentStr && typeof contentStr === 'string') {
1737
1740
  try {
1738
1741
  const parsed = JSON.parse(contentStr);
1739
1742
  const sessions = (_p = parsed === null || parsed === void 0 ? void 0 : parsed.sessions) !== null && _p !== void 0 ? _p : [];
1740
1743
  const mapped = this.mapSessionsToCardData(sessions);
1741
- this.chatLog.push({
1742
- _id: serializable.message_id || `session_cards_${Date.now()}`,
1743
- type: 'session_cards',
1744
- message: answerText ? this.processMessageForDisplay(answerText) : '',
1745
- time: formatNow(this.timezone),
1746
- sessionCards: mapped,
1747
- });
1748
- this.showFeedBackIconsIndex = this.chatLog.length - 1;
1749
- this.isChatingWithAi = false;
1750
- this.scrollToBottom();
1751
- this.cdr.markForCheck();
1744
+ if (mapped.length > 0) {
1745
+ this.chatLog.push({
1746
+ _id: serializable.message_id || `session_cards_${Date.now()}`,
1747
+ type: 'session_cards',
1748
+ message: answerText ? this.processMessageForDisplay(answerText) : '',
1749
+ time: formatNow(this.timezone),
1750
+ sessionCards: mapped,
1751
+ });
1752
+ this.showFeedBackIconsIndex = this.chatLog.length - 1;
1753
+ this.isChatingWithAi = false;
1754
+ this.scrollToBottom();
1755
+ pushed = true;
1756
+ }
1752
1757
  }
1753
1758
  catch (e) {
1754
- console.error('[Socket Chat] Error parsing get_event_sessions content:', e);
1759
+ // v2 often sends plain text (e.g. "Found 2 sessions:..."); not JSON - fall through so answer is shown as normal AI message
1755
1760
  }
1756
1761
  }
1757
- this.cdr.markForCheck();
1758
- return;
1762
+ if (pushed) {
1763
+ this.cdr.markForCheck();
1764
+ return;
1765
+ }
1766
+ // No session cards pushed (v2 text content or empty): fall through to normal OtherFields handling so answer is displayed
1759
1767
  }
1760
1768
  // Attendee cards: tool get_event_attendees (same as React Native)
1761
1769
  if ((serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_attendees') {