Skip to content

Commit

Permalink
Error converted to string
Browse files Browse the repository at this point in the history
  • Loading branch information
bhujoshi committed Nov 20, 2024
1 parent 043830b commit 2be093f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions hooks/useChatSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ const useChatSession = (initialMessages) => {
const interval = setInterval(async () => {
try {
const messageResponse = await getChatSession(chatSession.data.id, latestMessage.id);
console.log('Test it ', latestMessage.id);
if (messageResponse.data.length > 0) {
console.log(messageResponse.data);
clearInterval(interval);
setMessages((prevMessages) => [...prevMessages, ...messageResponse.data]);
setIsLoading(false);
}
} catch (error) {
console.error('Error fetching chat session updates', error);
setError(error);
setError(error.toString());
sendClientError('fetch_new_message', error.message);
clearInterval(interval);
}
Expand All @@ -38,7 +40,7 @@ const useChatSession = (initialMessages) => {
return chatSession;
} catch (error) {
console.error('Error creating chat session', error);
setError(error);
setError(error.toString());
sendClientError('create_session', error.message);
throw error;
} finally {
Expand Down
2 changes: 1 addition & 1 deletion screens/ChatSessionScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const ChatSessionScreen = (props) => {
<ChatCard
sender={message.sender_type}
message={message.message}
key={message.id}
index={index}
navigation={navigation}
/>
Expand All @@ -95,6 +94,7 @@ const ChatSessionScreen = (props) => {
</View>
)}

{/* {!showUnlockPro() && messages.length > 0 && ( */}
{true && (
<View style={styles.inputContainer}>
<TextInput
Expand Down

0 comments on commit 2be093f

Please sign in to comment.