@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.
@@ -2370,33 +2370,41 @@
2370
2370
  else if ((_k = res === null || res === void 0 ? void 0 : res.m) === null || _k === void 0 ? void 0 : _k.OtherFields) {
2371
2371
  var otherFields = res.m.OtherFields;
2372
2372
  var serializable = otherFields.serializable_to_return;
2373
- // Session cards: tool get_event_sessions (same as React Native)
2374
- if ((serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions') {
2373
+ // 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)
2374
+ var isSessionTool = (serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions' ||
2375
+ (serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions_v2';
2376
+ if (isSessionTool) {
2375
2377
  var 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;
2376
2378
  var answerText = otherFields.answer != null ? String(otherFields.answer).trim() : '';
2377
- if (contentStr) {
2379
+ var pushed = false;
2380
+ if (contentStr && typeof contentStr === 'string') {
2378
2381
  try {
2379
2382
  var parsed = JSON.parse(contentStr);
2380
2383
  var sessions = (_p = parsed === null || parsed === void 0 ? void 0 : parsed.sessions) !== null && _p !== void 0 ? _p : [];
2381
2384
  var mapped = _this.mapSessionsToCardData(sessions);
2382
- _this.chatLog.push({
2383
- _id: serializable.message_id || "session_cards_" + Date.now(),
2384
- type: 'session_cards',
2385
- message: answerText ? _this.processMessageForDisplay(answerText) : '',
2386
- time: formatNow(_this.timezone),
2387
- sessionCards: mapped,
2388
- });
2389
- _this.showFeedBackIconsIndex = _this.chatLog.length - 1;
2390
- _this.isChatingWithAi = false;
2391
- _this.scrollToBottom();
2392
- _this.cdr.markForCheck();
2385
+ if (mapped.length > 0) {
2386
+ _this.chatLog.push({
2387
+ _id: serializable.message_id || "session_cards_" + Date.now(),
2388
+ type: 'session_cards',
2389
+ message: answerText ? _this.processMessageForDisplay(answerText) : '',
2390
+ time: formatNow(_this.timezone),
2391
+ sessionCards: mapped,
2392
+ });
2393
+ _this.showFeedBackIconsIndex = _this.chatLog.length - 1;
2394
+ _this.isChatingWithAi = false;
2395
+ _this.scrollToBottom();
2396
+ pushed = true;
2397
+ }
2393
2398
  }
2394
2399
  catch (e) {
2395
- console.error('[Socket Chat] Error parsing get_event_sessions content:', e);
2400
+ // v2 often sends plain text (e.g. "Found 2 sessions:..."); not JSON - fall through so answer is shown as normal AI message
2396
2401
  }
2397
2402
  }
2398
- _this.cdr.markForCheck();
2399
- return;
2403
+ if (pushed) {
2404
+ _this.cdr.markForCheck();
2405
+ return;
2406
+ }
2407
+ // No session cards pushed (v2 text content or empty): fall through to normal OtherFields handling so answer is displayed
2400
2408
  }
2401
2409
  // Attendee cards: tool get_event_attendees (same as React Native)
2402
2410
  if ((serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_attendees') {