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() {
|
||||
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:', {
|
||||
|
||||
Reference in New Issue
Block a user