@hef2024/llmasaservice-ui 0.23.0 → 0.23.1
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/package.json +1 -1
- package/src/AIAgentPanel.tsx +96 -98
package/package.json
CHANGED
package/src/AIAgentPanel.tsx
CHANGED
|
@@ -1956,7 +1956,6 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
1956
1956
|
toggleCollapse();
|
|
1957
1957
|
}
|
|
1958
1958
|
}}
|
|
1959
|
-
title="Click to expand"
|
|
1960
1959
|
>
|
|
1961
1960
|
{/* Expand button at top for discoverability */}
|
|
1962
1961
|
<Tooltip content="Expand Panel" side="left">
|
|
@@ -2013,58 +2012,58 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
2013
2012
|
const hasActiveConversation = !!activeConvForAgent;
|
|
2014
2013
|
|
|
2015
2014
|
return (
|
|
2016
|
-
<
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2015
|
+
<Button
|
|
2016
|
+
key={agent.id}
|
|
2017
|
+
variant={agent.id === currentAgentId ? 'secondary' : 'ghost'}
|
|
2018
|
+
size="icon"
|
|
2019
|
+
title={agent.name}
|
|
2020
|
+
onClick={() => {
|
|
2021
|
+
// Expand panel in controlled or uncontrolled mode
|
|
2022
|
+
if (!isControlled) {
|
|
2023
|
+
setUncontrolledIsCollapsed(false);
|
|
2024
|
+
}
|
|
2025
|
+
onCollapsedChange?.(false);
|
|
2026
|
+
if (hasActiveConversation && activeConvForAgent) {
|
|
2027
|
+
// Switch to the existing conversation
|
|
2028
|
+
setCurrentConversationId(activeConvForAgent.conversationId);
|
|
2029
|
+
setCurrentAgentId(agent.id);
|
|
2030
|
+
if (onConversationChange) {
|
|
2031
|
+
onConversationChange(activeConvForAgent.conversationId);
|
|
2024
2032
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
const next = new Map(prev);
|
|
2038
|
-
next.set(tempId, {
|
|
2039
|
-
conversationId: tempId,
|
|
2040
|
-
stableKey: tempId, // Stable key never changes
|
|
2041
|
-
agentId: agent.id,
|
|
2042
|
-
history: {},
|
|
2043
|
-
isLoading: false,
|
|
2044
|
-
title: 'New conversation',
|
|
2045
|
-
});
|
|
2046
|
-
return next;
|
|
2033
|
+
} else {
|
|
2034
|
+
// Start a new conversation with this agent
|
|
2035
|
+
const tempId = `new-${Date.now()}`;
|
|
2036
|
+
setActiveConversations(prev => {
|
|
2037
|
+
const next = new Map(prev);
|
|
2038
|
+
next.set(tempId, {
|
|
2039
|
+
conversationId: tempId,
|
|
2040
|
+
stableKey: tempId, // Stable key never changes
|
|
2041
|
+
agentId: agent.id,
|
|
2042
|
+
history: {},
|
|
2043
|
+
isLoading: false,
|
|
2044
|
+
title: 'New conversation',
|
|
2047
2045
|
});
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2046
|
+
return next;
|
|
2047
|
+
});
|
|
2048
|
+
setCurrentConversationId(tempId);
|
|
2049
|
+
setCurrentAgentId(agent.id);
|
|
2050
|
+
}
|
|
2051
|
+
}}
|
|
2052
|
+
className={`ai-agent-panel__agent-icon ${hasActiveConversation ? 'ai-agent-panel__agent-icon--active' : ''}`}
|
|
2053
|
+
>
|
|
2054
|
+
{agent.avatarUrl ? (
|
|
2055
|
+
<img
|
|
2056
|
+
src={agent.avatarUrl}
|
|
2057
|
+
alt={agent.name}
|
|
2058
|
+
className="ai-agent-panel__agent-avatar"
|
|
2059
|
+
/>
|
|
2060
|
+
) : (
|
|
2061
|
+
agent.name.charAt(0).toUpperCase()
|
|
2062
|
+
)}
|
|
2063
|
+
{hasActiveConversation && (
|
|
2064
|
+
<span className="ai-agent-panel__agent-active-indicator" />
|
|
2065
|
+
)}
|
|
2066
|
+
</Button>
|
|
2068
2067
|
);
|
|
2069
2068
|
})}
|
|
2070
2069
|
|
|
@@ -2105,7 +2104,6 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
2105
2104
|
toggleHistoryCollapse();
|
|
2106
2105
|
}
|
|
2107
2106
|
}}
|
|
2108
|
-
title="Click to expand history"
|
|
2109
2107
|
>
|
|
2110
2108
|
{/* Expand button at top for discoverability */}
|
|
2111
2109
|
<Tooltip content="Expand History" side={sidebarPosition === 'left' ? 'right' : 'left'}>
|
|
@@ -2140,53 +2138,53 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
2140
2138
|
const hasActiveConversation = !!activeConvForAgent;
|
|
2141
2139
|
|
|
2142
2140
|
return (
|
|
2143
|
-
<
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
} else {
|
|
2156
|
-
// Start a new conversation with this agent
|
|
2157
|
-
const tempId = `new-${Date.now()}`;
|
|
2158
|
-
setActiveConversations(prev => {
|
|
2159
|
-
const next = new Map(prev);
|
|
2160
|
-
next.set(tempId, {
|
|
2161
|
-
conversationId: tempId,
|
|
2162
|
-
stableKey: tempId, // Stable key never changes
|
|
2163
|
-
agentId: agent.id,
|
|
2164
|
-
history: {},
|
|
2165
|
-
isLoading: false,
|
|
2166
|
-
title: 'New conversation',
|
|
2167
|
-
});
|
|
2168
|
-
return next;
|
|
2169
|
-
});
|
|
2170
|
-
setCurrentConversationId(tempId);
|
|
2171
|
-
setCurrentAgentId(agent.id);
|
|
2141
|
+
<Button
|
|
2142
|
+
key={agent.id}
|
|
2143
|
+
variant={agent.id === currentAgentId ? 'secondary' : 'ghost'}
|
|
2144
|
+
size="icon"
|
|
2145
|
+
title={agent.name}
|
|
2146
|
+
onClick={() => {
|
|
2147
|
+
if (hasActiveConversation && activeConvForAgent) {
|
|
2148
|
+
// Switch to the existing conversation
|
|
2149
|
+
setCurrentConversationId(activeConvForAgent.conversationId);
|
|
2150
|
+
setCurrentAgentId(agent.id);
|
|
2151
|
+
if (onConversationChange) {
|
|
2152
|
+
onConversationChange(activeConvForAgent.conversationId);
|
|
2172
2153
|
}
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2154
|
+
} else {
|
|
2155
|
+
// Start a new conversation with this agent
|
|
2156
|
+
const tempId = `new-${Date.now()}`;
|
|
2157
|
+
setActiveConversations(prev => {
|
|
2158
|
+
const next = new Map(prev);
|
|
2159
|
+
next.set(tempId, {
|
|
2160
|
+
conversationId: tempId,
|
|
2161
|
+
stableKey: tempId, // Stable key never changes
|
|
2162
|
+
agentId: agent.id,
|
|
2163
|
+
history: {},
|
|
2164
|
+
isLoading: false,
|
|
2165
|
+
title: 'New conversation',
|
|
2166
|
+
});
|
|
2167
|
+
return next;
|
|
2168
|
+
});
|
|
2169
|
+
setCurrentConversationId(tempId);
|
|
2170
|
+
setCurrentAgentId(agent.id);
|
|
2171
|
+
}
|
|
2172
|
+
}}
|
|
2173
|
+
className={`ai-agent-panel__agent-icon ${hasActiveConversation ? 'ai-agent-panel__agent-icon--active' : ''}`}
|
|
2174
|
+
>
|
|
2175
|
+
{agent.avatarUrl ? (
|
|
2176
|
+
<img
|
|
2177
|
+
src={agent.avatarUrl}
|
|
2178
|
+
alt={agent.name}
|
|
2179
|
+
className="ai-agent-panel__agent-avatar"
|
|
2180
|
+
/>
|
|
2181
|
+
) : (
|
|
2182
|
+
agent.name.charAt(0).toUpperCase()
|
|
2183
|
+
)}
|
|
2184
|
+
{hasActiveConversation && (
|
|
2185
|
+
<span className="ai-agent-panel__agent-active-indicator" />
|
|
2186
|
+
)}
|
|
2187
|
+
</Button>
|
|
2190
2188
|
);
|
|
2191
2189
|
})}
|
|
2192
2190
|
|