Skip to content

Commit 4e63e83

Browse files
Add extensive debugging for conversation display issue
- Add console logs to track conversation selection and data flow - Remove unused state variables (selectedConversationDetails, currentAgent) - Clean up references to removed state setters - Debug conversation finding logic in details section Co-authored-by: openhands <openhands@all-hands.dev>
1 parent ad9c65e commit 4e63e83

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

example/src/components/ConversationManager.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ export const ConversationManager: React.FC = () => {
2222
const [error, setError] = useState<string | null>(null);
2323
const [manager, setManager] = useState<SDKConversationManager | null>(null);
2424
const [selectedConversation, setSelectedConversation] = useState<string | null>(null);
25-
const [selectedConversationDetails, setSelectedConversationDetails] = useState<RemoteConversation | null>(null);
2625
const [conversationEvents, setConversationEvents] = useState<any[]>([]);
2726
const [messageInput, setMessageInput] = useState('');
2827
const [activeConversations, setActiveConversations] = useState<Map<string, RemoteConversation>>(new Map());
29-
const [currentAgent, setCurrentAgent] = useState<AgentBase | null>(null);
3028

3129
// Initialize conversation manager
3230
useEffect(() => {
@@ -108,7 +106,7 @@ export const ConversationManager: React.FC = () => {
108106
});
109107

110108
// Store the current agent configuration
111-
setCurrentAgent(agent);
109+
// Agent is now stored in the conversation object
112110

113111
const conversation = await manager.createConversation(agent, {
114112
initialMessage: 'Hello! I\'m ready to help you with your tasks.',
@@ -155,7 +153,7 @@ export const ConversationManager: React.FC = () => {
155153
// Clear selection if this conversation was selected
156154
if (selectedConversation === conversationId) {
157155
setSelectedConversation(null);
158-
setSelectedConversationDetails(null);
156+
// Clear selected conversation
159157
setConversationEvents([]);
160158
}
161159

@@ -184,14 +182,14 @@ export const ConversationManager: React.FC = () => {
184182
setActiveConversations(prev => new Map(prev.set(conversationId, conversation!)));
185183
}
186184

187-
setSelectedConversationDetails(conversation);
185+
// Store the conversation in activeConversations for later use
188186

189187
// Load events
190188
const events = await conversation.state.events.getEvents();
191189
setConversationEvents(events);
192190
} catch (err) {
193191
setError(err instanceof Error ? err.message : 'Failed to load conversation details');
194-
setSelectedConversationDetails(null);
192+
// Clear conversation events on error
195193
setConversationEvents([]);
196194
} finally {
197195
setLoading(false);
@@ -355,7 +353,11 @@ export const ConversationManager: React.FC = () => {
355353
<div className="conversation-info-detail">
356354
{(() => {
357355
const conv = conversations.find(c => c.id === selectedConversation);
358-
if (!conv) return null;
356+
console.log('Details section - selectedConversation:', selectedConversation);
357+
console.log('Details section - conversations array:', conversations);
358+
console.log('Details section - found conv:', conv);
359+
console.log('Details section - conv properties:', conv ? Object.keys(conv) : 'no conv');
360+
if (!conv) return <p>No conversation found with ID: {selectedConversation}</p>;
359361

360362
return (
361363
<div>

0 commit comments

Comments
 (0)