Update conversation.html

This commit is contained in:
2025-05-27 16:02:21 +02:00
parent ca0c3ef4bd
commit 26572b740e

View File

@@ -384,6 +384,9 @@ if (typeof window.ChatManager === 'undefined') {
}
};
// Store conversation ID globally
const conversationId = "{{ conversation.id }}";
function init() {
if (instance) {
return instance;
@@ -662,16 +665,24 @@ $(document).ready(function() {
response: response,
socketId: socket.id
});
if (response.success) {
if (response.success && response.message) {
messageInput.val('');
fileInput.value = '';
$('#selectedFiles').text('');
// If socket is disconnected, append message directly
if (!state.connectionState.isConnected) {
try {
appendMessage(response.message);
} catch (error) {
console.error('Error appending message:', error);
// Refresh the page to show the new message
window.location.reload();
}
}
} else {
console.error('Invalid response format:', response);
}
},
error: function(xhr, status, error) {
console.error('Failed to send message:', {