Update conversation.html
This commit is contained in:
@@ -384,6 +384,9 @@ if (typeof window.ChatManager === 'undefined') {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Store conversation ID globally
|
||||||
|
const conversationId = "{{ conversation.id }}";
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if (instance) {
|
if (instance) {
|
||||||
return instance;
|
return instance;
|
||||||
@@ -662,15 +665,23 @@ $(document).ready(function() {
|
|||||||
response: response,
|
response: response,
|
||||||
socketId: socket.id
|
socketId: socket.id
|
||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success && response.message) {
|
||||||
messageInput.val('');
|
messageInput.val('');
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
$('#selectedFiles').text('');
|
$('#selectedFiles').text('');
|
||||||
|
|
||||||
// If socket is disconnected, append message directly
|
// If socket is disconnected, append message directly
|
||||||
if (!state.connectionState.isConnected) {
|
if (!state.connectionState.isConnected) {
|
||||||
appendMessage(response.message);
|
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) {
|
error: function(xhr, status, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user