Skip to content

Fix chat endpoint #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 19, 2025
Merged

Fix chat endpoint #23

merged 6 commits into from
Mar 19, 2025

Conversation

shahariaazam
Copy link
Member

This pull request includes several improvements and new features for the chat functionality in the ChatContainer component and related services. The most important changes include adding support for handling chatUuid in the payload and response headers, and updating the API endpoints.

Enhancements to ChatContainer component:

Updates to APIClient and ChatService:

Replaced '/ask' with '/api/v1/chats' to align with updated API specifications. This ensures compatibility with the latest backend changes and avoids potential request failures.
Added support for extracting and handling `X-Chat-Uuid` from API response headers. Updated `ChatService` to pass chat UUID to a callback, and `ChatContainer` to set it when not already defined. Enhanced `APIClient` to merge custom headers and enforce CORS mode.
This commit introduces unit tests for the ChatService API client, including both streaming and synchronous message handling. The tests verify proper callback handling, chat UUID extraction, and payload processing. Mocking is used to simulate service behavior effectively.
Added comprehensive tests to cover streaming, chat history, UUID handling, and error scenarios. Refactored mocks to simulate more realistic behaviors and ensure clarity. This improves the reliability and robustness of ChatService unit tests.
The file `api-client.test.ts` containing tests for the ChatService API client has been removed, likely as part of codebase cleanup or migration efforts. These tests are no longer necessary and have been entirely deleted to maintain a leaner codebase.
Replaced "X-Chat-Uuid" with "X-MKit-Chat-UUID" for consistency with updated API response headers. Removed redundant lowercase header check and related console logs to streamline the code.
@shahariaazam
Copy link
Member Author

Related backend changes are here #23

@shahariaazam shahariaazam merged commit 34b75d1 into main Mar 19, 2025
3 checks passed
@shahariaazam shahariaazam deleted the fix-chat-endpoint branch March 19, 2025 23:40
@shahariaazam
Copy link
Member Author

This was a fix for shaharia-lab/mcp-kit#19 this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant