Add debug logging and Accept headers for MCP transport debugging
- Added extensive debug logging to transport creation and connection flows - Added proper Accept header (application/json, text/event-stream) to transport options - Fixed scroll jittering during streaming with instant scroll behavior - Investigating HTTP transport 'Not connected' errors and SSE connection hanging
This commit is contained in:
parent
ccad616e02
commit
ba9e6c9f3f
3 changed files with 99 additions and 20 deletions
|
|
@ -101,7 +101,7 @@ const ConversationThread: React.FC<ConversationThreadProps> = ({
|
|||
|
||||
//when new message chunks are streamed in, scroll to bottom
|
||||
useEffect(() => {
|
||||
scrollToBottom()
|
||||
scrollToBottom(isLoading && streamStarted)
|
||||
}, [aiResponseRef.current])
|
||||
|
||||
//when conversation changes, scroll to bottom
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ export const useAutoscroll = () => {
|
|||
};
|
||||
}, []);
|
||||
|
||||
const scrollToBottom = () => {
|
||||
if (shouldAutoScrollRef.current) {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
const scrollToBottom = (force?: boolean) => {
|
||||
if (shouldAutoScrollRef.current || force) {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: force ? "instant" : "smooth" });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const hasContent = (message: Message): message is UserMessage | AssistantMessage
|
|||
interface UseStreamResponseProps {
|
||||
conversationId?: number
|
||||
setConversations: React.Dispatch<React.SetStateAction<Conversation[]>>
|
||||
scrollToBottom: () => void
|
||||
scrollToBottom: (force?: boolean) => void
|
||||
selectedModel: Model
|
||||
onApiKeyRequired: (model: Model) => Promise<boolean>
|
||||
mcpTools: Tool[]
|
||||
|
|
@ -284,7 +284,7 @@ export const useStreamResponse = ({
|
|||
}
|
||||
return updated
|
||||
})
|
||||
scrollToBottom()
|
||||
scrollToBottom(true)
|
||||
} else {
|
||||
console.warn('[useStreamResponse] Tool call event missing toolName:', event)
|
||||
}
|
||||
|
|
@ -382,7 +382,7 @@ export const useStreamResponse = ({
|
|||
return updated
|
||||
})
|
||||
|
||||
scrollToBottom()
|
||||
scrollToBottom(true)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[useStreamResponse] Error in full stream processing:', e)
|
||||
|
|
|
|||
Loading…
Reference in a new issue