feat: use uuid to create id for chat #153
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the chatbot functionality, focusing on improving the uniqueness of chat identifiers and enhancing the chatbot's message handling. The most important changes include replacing numeric chat IDs with UUIDs, adding a
chatId
parameter to thesendMessage
function, and updating related interfaces and contexts.Chat ID improvements:
src/domain/contexts/ChatbotContext.tsx
: Replaced numeric chat IDs with UUIDs in theChatbotProvider
function. [1] [2]src/domain/entities/chatbot/Chatbot.ts
: Updated theIChat
interface to use a string type for theid
field.Message handling enhancements:
src/components/Chatbot/Chatbot.tsx
: Added thechatId
parameter to thesendMessage
function calls to ensure messages are associated with the correct chat.src/domain/entities/chatbot/BackendCommunication.ts
: Added thechatId
field to theQueryRequest
interface.src/infrastructure/repositories/ChatbotRepositoryImpl.ts
: Modified thesendMessage
method to include thechatId
in the payload, generating a new UUID if not provided.UUID integration:
src/domain/contexts/ChatbotContext.tsx
: Imported theuuid
function from theuuid
library.src/infrastructure/repositories/ChatbotRepositoryImpl.ts
: Imported theuuid
function from theuuid
library.src/operations/chatbot/Chatbot.ts
: Imported theuuid
function and updated the default chat ID to use UUID. [1] [2]