@hivegpt/hiveai-angular 0.0.433 → 0.0.435
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.
- package/bundles/hivegpt-hiveai-angular.umd.js +122 -29
- package/bundles/hivegpt-hiveai-angular.umd.js.map +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js.map +1 -1
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +123 -30
- package/fesm2015/hivegpt-hiveai-angular.js +122 -29
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +7 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2292,6 +2292,54 @@
|
|
|
2292
2292
|
});
|
|
2293
2293
|
});
|
|
2294
2294
|
};
|
|
2295
|
+
/**
|
|
2296
|
+
* Parse get_event_sessions_v2 plain-text content into session objects for cards.
|
|
2297
|
+
* Format: "Found N sessions:\n1. <title>\n - Time: Start: ..., End: ..., TimeZone: ...\n - Room: ...\n - Type: ...\n2. ..."
|
|
2298
|
+
*/
|
|
2299
|
+
ChatDrawerComponent.prototype.parseSessionContentV2 = function (content) {
|
|
2300
|
+
if (!content || typeof content !== 'string')
|
|
2301
|
+
return [];
|
|
2302
|
+
var sessions = [];
|
|
2303
|
+
// Split into blocks by "1. ", "2. ", etc. (number + dot + space at line start)
|
|
2304
|
+
var blockRegex = /\n\d+\.\s+/;
|
|
2305
|
+
var parts = content.split(blockRegex);
|
|
2306
|
+
// First part may be "Found N sessions:" or similar; skip if it doesn't look like a session title
|
|
2307
|
+
for (var i = 0; i < parts.length; i++) {
|
|
2308
|
+
var block = parts[i].trim();
|
|
2309
|
+
if (!block)
|
|
2310
|
+
continue;
|
|
2311
|
+
var lines = block.split(/\n/).map(function (l) { return l.trim(); }).filter(Boolean);
|
|
2312
|
+
var title = lines[0] || '';
|
|
2313
|
+
if (!title || /^Found\s+\d+\s+sessions/i.test(title))
|
|
2314
|
+
continue;
|
|
2315
|
+
var dateTimeRange = '';
|
|
2316
|
+
var roomName = '';
|
|
2317
|
+
var sessionType = '';
|
|
2318
|
+
for (var j = 1; j < lines.length; j++) {
|
|
2319
|
+
var line = lines[j];
|
|
2320
|
+
var timeMatch = line.match(/Time:\s*(.+)/i);
|
|
2321
|
+
if (timeMatch) {
|
|
2322
|
+
dateTimeRange = timeMatch[1].trim();
|
|
2323
|
+
}
|
|
2324
|
+
var roomMatch = line.match(/Room:\s*(.+)/i);
|
|
2325
|
+
if (roomMatch) {
|
|
2326
|
+
roomName = roomMatch[1].trim();
|
|
2327
|
+
}
|
|
2328
|
+
var typeMatch = line.match(/Type:\s*(.+)/i);
|
|
2329
|
+
if (typeMatch) {
|
|
2330
|
+
sessionType = typeMatch[1].trim();
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
sessions.push({
|
|
2334
|
+
title: title,
|
|
2335
|
+
roomName: roomName || undefined,
|
|
2336
|
+
dateTimeRange: dateTimeRange || undefined,
|
|
2337
|
+
sessionType: sessionType || undefined,
|
|
2338
|
+
sessionRoles: [],
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
return sessions;
|
|
2342
|
+
};
|
|
2295
2343
|
ChatDrawerComponent.prototype.getVisibleSessionCards = function (chat) {
|
|
2296
2344
|
var _a;
|
|
2297
2345
|
var list = (_a = chat === null || chat === void 0 ? void 0 : chat.sessionCards) !== null && _a !== void 0 ? _a : [];
|
|
@@ -2370,15 +2418,25 @@
|
|
|
2370
2418
|
else if ((_k = res === null || res === void 0 ? void 0 : res.m) === null || _k === void 0 ? void 0 : _k.OtherFields) {
|
|
2371
2419
|
var otherFields = res.m.OtherFields;
|
|
2372
2420
|
var serializable = otherFields.serializable_to_return;
|
|
2373
|
-
// Session cards:
|
|
2374
|
-
|
|
2421
|
+
// Session cards: get_event_sessions (JSON) or get_event_sessions_v2 (JSON or plain text)
|
|
2422
|
+
var isSessionTool = (serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions' ||
|
|
2423
|
+
(serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions_v2';
|
|
2424
|
+
if (isSessionTool) {
|
|
2375
2425
|
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
2426
|
var answerText = otherFields.answer != null ? String(otherFields.answer).trim() : '';
|
|
2377
|
-
|
|
2427
|
+
var pushed = false;
|
|
2428
|
+
if (contentStr && typeof contentStr === 'string') {
|
|
2429
|
+
var sessions = [];
|
|
2378
2430
|
try {
|
|
2379
2431
|
var parsed = JSON.parse(contentStr);
|
|
2380
|
-
|
|
2381
|
-
|
|
2432
|
+
sessions = (_p = parsed === null || parsed === void 0 ? void 0 : parsed.sessions) !== null && _p !== void 0 ? _p : [];
|
|
2433
|
+
}
|
|
2434
|
+
catch (e) {
|
|
2435
|
+
// v2 plain text: "Found 2 sessions:\n1. Title\n - Time: Start: ... End: ...\n - Room: ...\n - Type: ..."
|
|
2436
|
+
sessions = _this.parseSessionContentV2(contentStr);
|
|
2437
|
+
}
|
|
2438
|
+
var mapped = _this.mapSessionsToCardData(sessions);
|
|
2439
|
+
if (mapped.length > 0) {
|
|
2382
2440
|
_this.chatLog.push({
|
|
2383
2441
|
_id: serializable.message_id || "session_cards_" + Date.now(),
|
|
2384
2442
|
type: 'session_cards',
|
|
@@ -2389,14 +2447,14 @@
|
|
|
2389
2447
|
_this.showFeedBackIconsIndex = _this.chatLog.length - 1;
|
|
2390
2448
|
_this.isChatingWithAi = false;
|
|
2391
2449
|
_this.scrollToBottom();
|
|
2392
|
-
|
|
2393
|
-
}
|
|
2394
|
-
catch (e) {
|
|
2395
|
-
console.error('[Socket Chat] Error parsing get_event_sessions content:', e);
|
|
2450
|
+
pushed = true;
|
|
2396
2451
|
}
|
|
2397
2452
|
}
|
|
2398
|
-
|
|
2399
|
-
|
|
2453
|
+
if (pushed) {
|
|
2454
|
+
_this.cdr.markForCheck();
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
// No session cards pushed: fall through to normal OtherFields handling so answer is displayed
|
|
2400
2458
|
}
|
|
2401
2459
|
// Attendee cards: tool get_event_attendees (same as React Native)
|
|
2402
2460
|
if ((serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_attendees') {
|
|
@@ -2656,6 +2714,27 @@
|
|
|
2656
2714
|
// })
|
|
2657
2715
|
// );
|
|
2658
2716
|
// }
|
|
2717
|
+
/** Push a standard AI message from history (sources, graphs, etc.). Used when not converting to session_cards. */
|
|
2718
|
+
ChatDrawerComponent.prototype.pushAiMessageFromHistory = function (chat) {
|
|
2719
|
+
var sourcesList = chat.WebLinks || [];
|
|
2720
|
+
var displayedSources = (chat.WebLinks || []).slice(0, 3);
|
|
2721
|
+
var remainingSources = (chat.WebLinks || []).slice(3);
|
|
2722
|
+
this.chatLog.push({
|
|
2723
|
+
type: 'ai',
|
|
2724
|
+
message: this.processMessageForDisplay(chat.Text),
|
|
2725
|
+
executionGraphs: chat.ExecutionGraphs,
|
|
2726
|
+
graphs: chat.Graphs,
|
|
2727
|
+
searchTerms: chat.SearchTerms,
|
|
2728
|
+
sourcesList: sourcesList,
|
|
2729
|
+
displayedSources: displayedSources,
|
|
2730
|
+
remainingSources: remainingSources,
|
|
2731
|
+
time: formatTimeStamps(this.timezone, chat.InsertTimestamp),
|
|
2732
|
+
copied: false,
|
|
2733
|
+
isCollapsedTrue: false,
|
|
2734
|
+
_id: chat._id,
|
|
2735
|
+
});
|
|
2736
|
+
this.showFeedBackIconsIndex = this.chatLog.length - 1;
|
|
2737
|
+
};
|
|
2659
2738
|
ChatDrawerComponent.prototype.mapChatHistory = function (chats) {
|
|
2660
2739
|
var _this = this;
|
|
2661
2740
|
var _a;
|
|
@@ -2666,6 +2745,7 @@
|
|
|
2666
2745
|
});
|
|
2667
2746
|
if (chats && ((_a = chats === null || chats === void 0 ? void 0 : chats.Messages) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2668
2747
|
chats === null || chats === void 0 ? void 0 : chats.Messages.forEach(function (chat) {
|
|
2748
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2669
2749
|
if (chat.Type == 'user') {
|
|
2670
2750
|
_this.chatLog.push({
|
|
2671
2751
|
type: 'user',
|
|
@@ -2678,24 +2758,37 @@
|
|
|
2678
2758
|
});
|
|
2679
2759
|
}
|
|
2680
2760
|
if (chat.Type == 'ai') {
|
|
2681
|
-
|
|
2682
|
-
var
|
|
2683
|
-
var
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2761
|
+
// If this AI message came from get_event_sessions / get_event_sessions_v2, show session cards instead of plain text
|
|
2762
|
+
var toolName = (_a = chat.toolresults) === null || _a === void 0 ? void 0 : _a.tool_name;
|
|
2763
|
+
var isSessionTool = toolName === 'get_event_sessions' || toolName === 'get_event_sessions_v2';
|
|
2764
|
+
if (isSessionTool && ((_e = (_d = (_c = (_b = chat.toolresults) === null || _b === void 0 ? void 0 : _b.tool_result) === null || _c === void 0 ? void 0 : _c.messages) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.content)) {
|
|
2765
|
+
var contentStr = chat.toolresults.tool_result.messages[0].content;
|
|
2766
|
+
var sessions = [];
|
|
2767
|
+
try {
|
|
2768
|
+
var parsed = JSON.parse(contentStr);
|
|
2769
|
+
sessions = (_f = parsed === null || parsed === void 0 ? void 0 : parsed.sessions) !== null && _f !== void 0 ? _f : [];
|
|
2770
|
+
}
|
|
2771
|
+
catch (e) {
|
|
2772
|
+
sessions = _this.parseSessionContentV2(contentStr);
|
|
2773
|
+
}
|
|
2774
|
+
var mapped = _this.mapSessionsToCardData(sessions);
|
|
2775
|
+
if (mapped.length > 0) {
|
|
2776
|
+
_this.chatLog.push({
|
|
2777
|
+
_id: chat._id,
|
|
2778
|
+
type: 'session_cards',
|
|
2779
|
+
message: chat.Text ? _this.processMessageForDisplay(chat.Text) : '',
|
|
2780
|
+
time: formatTimeStamps(_this.timezone, chat.InsertTimestamp),
|
|
2781
|
+
sessionCards: mapped,
|
|
2782
|
+
});
|
|
2783
|
+
_this.showFeedBackIconsIndex = _this.chatLog.length - 1;
|
|
2784
|
+
}
|
|
2785
|
+
else {
|
|
2786
|
+
_this.pushAiMessageFromHistory(chat);
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
else {
|
|
2790
|
+
_this.pushAiMessageFromHistory(chat);
|
|
2791
|
+
}
|
|
2699
2792
|
}
|
|
2700
2793
|
});
|
|
2701
2794
|
this.showStartAgain = true;
|