@hivegpt/hiveai-angular 0.0.434 → 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 +121 -36
- 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 +122 -37
- package/fesm2015/hivegpt-hiveai-angular.js +121 -36
- 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
|
@@ -1654,6 +1654,54 @@ class ChatDrawerComponent {
|
|
|
1654
1654
|
});
|
|
1655
1655
|
});
|
|
1656
1656
|
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Parse get_event_sessions_v2 plain-text content into session objects for cards.
|
|
1659
|
+
* Format: "Found N sessions:\n1. <title>\n - Time: Start: ..., End: ..., TimeZone: ...\n - Room: ...\n - Type: ...\n2. ..."
|
|
1660
|
+
*/
|
|
1661
|
+
parseSessionContentV2(content) {
|
|
1662
|
+
if (!content || typeof content !== 'string')
|
|
1663
|
+
return [];
|
|
1664
|
+
const sessions = [];
|
|
1665
|
+
// Split into blocks by "1. ", "2. ", etc. (number + dot + space at line start)
|
|
1666
|
+
const blockRegex = /\n\d+\.\s+/;
|
|
1667
|
+
const parts = content.split(blockRegex);
|
|
1668
|
+
// First part may be "Found N sessions:" or similar; skip if it doesn't look like a session title
|
|
1669
|
+
for (let i = 0; i < parts.length; i++) {
|
|
1670
|
+
const block = parts[i].trim();
|
|
1671
|
+
if (!block)
|
|
1672
|
+
continue;
|
|
1673
|
+
const lines = block.split(/\n/).map((l) => l.trim()).filter(Boolean);
|
|
1674
|
+
const title = lines[0] || '';
|
|
1675
|
+
if (!title || /^Found\s+\d+\s+sessions/i.test(title))
|
|
1676
|
+
continue;
|
|
1677
|
+
let dateTimeRange = '';
|
|
1678
|
+
let roomName = '';
|
|
1679
|
+
let sessionType = '';
|
|
1680
|
+
for (let j = 1; j < lines.length; j++) {
|
|
1681
|
+
const line = lines[j];
|
|
1682
|
+
const timeMatch = line.match(/Time:\s*(.+)/i);
|
|
1683
|
+
if (timeMatch) {
|
|
1684
|
+
dateTimeRange = timeMatch[1].trim();
|
|
1685
|
+
}
|
|
1686
|
+
const roomMatch = line.match(/Room:\s*(.+)/i);
|
|
1687
|
+
if (roomMatch) {
|
|
1688
|
+
roomName = roomMatch[1].trim();
|
|
1689
|
+
}
|
|
1690
|
+
const typeMatch = line.match(/Type:\s*(.+)/i);
|
|
1691
|
+
if (typeMatch) {
|
|
1692
|
+
sessionType = typeMatch[1].trim();
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
sessions.push({
|
|
1696
|
+
title,
|
|
1697
|
+
roomName: roomName || undefined,
|
|
1698
|
+
dateTimeRange: dateTimeRange || undefined,
|
|
1699
|
+
sessionType: sessionType || undefined,
|
|
1700
|
+
sessionRoles: [],
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
return sessions;
|
|
1704
|
+
}
|
|
1657
1705
|
getVisibleSessionCards(chat) {
|
|
1658
1706
|
var _a;
|
|
1659
1707
|
const list = (_a = chat === null || chat === void 0 ? void 0 : chat.sessionCards) !== null && _a !== void 0 ? _a : [];
|
|
@@ -1729,7 +1777,7 @@ class ChatDrawerComponent {
|
|
|
1729
1777
|
else if ((_k = res === null || res === void 0 ? void 0 : res.m) === null || _k === void 0 ? void 0 : _k.OtherFields) {
|
|
1730
1778
|
const otherFields = res.m.OtherFields;
|
|
1731
1779
|
const serializable = otherFields.serializable_to_return;
|
|
1732
|
-
// Session cards: get_event_sessions or get_event_sessions_v2 (
|
|
1780
|
+
// Session cards: get_event_sessions (JSON) or get_event_sessions_v2 (JSON or plain text)
|
|
1733
1781
|
const isSessionTool = (serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions' ||
|
|
1734
1782
|
(serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_sessions_v2';
|
|
1735
1783
|
if (isSessionTool) {
|
|
@@ -1737,33 +1785,35 @@ class ChatDrawerComponent {
|
|
|
1737
1785
|
const answerText = otherFields.answer != null ? String(otherFields.answer).trim() : '';
|
|
1738
1786
|
let pushed = false;
|
|
1739
1787
|
if (contentStr && typeof contentStr === 'string') {
|
|
1788
|
+
let sessions = [];
|
|
1740
1789
|
try {
|
|
1741
1790
|
const parsed = JSON.parse(contentStr);
|
|
1742
|
-
|
|
1743
|
-
const mapped = this.mapSessionsToCardData(sessions);
|
|
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
|
-
}
|
|
1791
|
+
sessions = (_p = parsed === null || parsed === void 0 ? void 0 : parsed.sessions) !== null && _p !== void 0 ? _p : [];
|
|
1757
1792
|
}
|
|
1758
1793
|
catch (e) {
|
|
1759
|
-
// v2
|
|
1794
|
+
// v2 plain text: "Found 2 sessions:\n1. Title\n - Time: Start: ... End: ...\n - Room: ...\n - Type: ..."
|
|
1795
|
+
sessions = this.parseSessionContentV2(contentStr);
|
|
1796
|
+
}
|
|
1797
|
+
const mapped = this.mapSessionsToCardData(sessions);
|
|
1798
|
+
if (mapped.length > 0) {
|
|
1799
|
+
this.chatLog.push({
|
|
1800
|
+
_id: serializable.message_id || `session_cards_${Date.now()}`,
|
|
1801
|
+
type: 'session_cards',
|
|
1802
|
+
message: answerText ? this.processMessageForDisplay(answerText) : '',
|
|
1803
|
+
time: formatNow(this.timezone),
|
|
1804
|
+
sessionCards: mapped,
|
|
1805
|
+
});
|
|
1806
|
+
this.showFeedBackIconsIndex = this.chatLog.length - 1;
|
|
1807
|
+
this.isChatingWithAi = false;
|
|
1808
|
+
this.scrollToBottom();
|
|
1809
|
+
pushed = true;
|
|
1760
1810
|
}
|
|
1761
1811
|
}
|
|
1762
1812
|
if (pushed) {
|
|
1763
1813
|
this.cdr.markForCheck();
|
|
1764
1814
|
return;
|
|
1765
1815
|
}
|
|
1766
|
-
// No session cards pushed
|
|
1816
|
+
// No session cards pushed: fall through to normal OtherFields handling so answer is displayed
|
|
1767
1817
|
}
|
|
1768
1818
|
// Attendee cards: tool get_event_attendees (same as React Native)
|
|
1769
1819
|
if ((serializable === null || serializable === void 0 ? void 0 : serializable.tool_name) === 'get_event_attendees') {
|
|
@@ -2021,6 +2071,27 @@ class ChatDrawerComponent {
|
|
|
2021
2071
|
// })
|
|
2022
2072
|
// );
|
|
2023
2073
|
// }
|
|
2074
|
+
/** Push a standard AI message from history (sources, graphs, etc.). Used when not converting to session_cards. */
|
|
2075
|
+
pushAiMessageFromHistory(chat) {
|
|
2076
|
+
const sourcesList = chat.WebLinks || [];
|
|
2077
|
+
const displayedSources = (chat.WebLinks || []).slice(0, 3);
|
|
2078
|
+
const remainingSources = (chat.WebLinks || []).slice(3);
|
|
2079
|
+
this.chatLog.push({
|
|
2080
|
+
type: 'ai',
|
|
2081
|
+
message: this.processMessageForDisplay(chat.Text),
|
|
2082
|
+
executionGraphs: chat.ExecutionGraphs,
|
|
2083
|
+
graphs: chat.Graphs,
|
|
2084
|
+
searchTerms: chat.SearchTerms,
|
|
2085
|
+
sourcesList: sourcesList,
|
|
2086
|
+
displayedSources: displayedSources,
|
|
2087
|
+
remainingSources: remainingSources,
|
|
2088
|
+
time: formatTimeStamps(this.timezone, chat.InsertTimestamp),
|
|
2089
|
+
copied: false,
|
|
2090
|
+
isCollapsedTrue: false,
|
|
2091
|
+
_id: chat._id,
|
|
2092
|
+
});
|
|
2093
|
+
this.showFeedBackIconsIndex = this.chatLog.length - 1;
|
|
2094
|
+
}
|
|
2024
2095
|
mapChatHistory(chats) {
|
|
2025
2096
|
var _a;
|
|
2026
2097
|
this.chatLog.push({
|
|
@@ -2030,6 +2101,7 @@ class ChatDrawerComponent {
|
|
|
2030
2101
|
});
|
|
2031
2102
|
if (chats && ((_a = chats === null || chats === void 0 ? void 0 : chats.Messages) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2032
2103
|
chats === null || chats === void 0 ? void 0 : chats.Messages.forEach((chat) => {
|
|
2104
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2033
2105
|
if (chat.Type == 'user') {
|
|
2034
2106
|
this.chatLog.push({
|
|
2035
2107
|
type: 'user',
|
|
@@ -2042,24 +2114,37 @@ class ChatDrawerComponent {
|
|
|
2042
2114
|
});
|
|
2043
2115
|
}
|
|
2044
2116
|
if (chat.Type == 'ai') {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2117
|
+
// If this AI message came from get_event_sessions / get_event_sessions_v2, show session cards instead of plain text
|
|
2118
|
+
const toolName = (_a = chat.toolresults) === null || _a === void 0 ? void 0 : _a.tool_name;
|
|
2119
|
+
const isSessionTool = toolName === 'get_event_sessions' || toolName === 'get_event_sessions_v2';
|
|
2120
|
+
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)) {
|
|
2121
|
+
const contentStr = chat.toolresults.tool_result.messages[0].content;
|
|
2122
|
+
let sessions = [];
|
|
2123
|
+
try {
|
|
2124
|
+
const parsed = JSON.parse(contentStr);
|
|
2125
|
+
sessions = (_f = parsed === null || parsed === void 0 ? void 0 : parsed.sessions) !== null && _f !== void 0 ? _f : [];
|
|
2126
|
+
}
|
|
2127
|
+
catch (e) {
|
|
2128
|
+
sessions = this.parseSessionContentV2(contentStr);
|
|
2129
|
+
}
|
|
2130
|
+
const mapped = this.mapSessionsToCardData(sessions);
|
|
2131
|
+
if (mapped.length > 0) {
|
|
2132
|
+
this.chatLog.push({
|
|
2133
|
+
_id: chat._id,
|
|
2134
|
+
type: 'session_cards',
|
|
2135
|
+
message: chat.Text ? this.processMessageForDisplay(chat.Text) : '',
|
|
2136
|
+
time: formatTimeStamps(this.timezone, chat.InsertTimestamp),
|
|
2137
|
+
sessionCards: mapped,
|
|
2138
|
+
});
|
|
2139
|
+
this.showFeedBackIconsIndex = this.chatLog.length - 1;
|
|
2140
|
+
}
|
|
2141
|
+
else {
|
|
2142
|
+
this.pushAiMessageFromHistory(chat);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
else {
|
|
2146
|
+
this.pushAiMessageFromHistory(chat);
|
|
2147
|
+
}
|
|
2063
2148
|
}
|
|
2064
2149
|
});
|
|
2065
2150
|
this.showStartAgain = true;
|