Add debug logs for chat and red border to end chat button
- Add detailed debug logs in Rust (chat.rs) to trace polling flow - Add console.log in frontend (main.tsx) to trace event reception - Add red border to "Encerrar" button in chat panels for better visibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4f81f62429
commit
b10548157e
4 changed files with 45 additions and 4 deletions
|
|
@ -322,9 +322,30 @@ impl ChatRuntime {
|
|||
Ok(result) => {
|
||||
last_checked_at = Some(chrono::Utc::now().timestamp_millis());
|
||||
|
||||
// DEBUG: Log do resultado do polling
|
||||
crate::log_info!(
|
||||
"[CHAT DEBUG] poll_chat_updates: has_active={}, total_unread={}, sessions_count={}",
|
||||
result.has_active_sessions,
|
||||
result.total_unread,
|
||||
result.sessions.len()
|
||||
);
|
||||
|
||||
// Buscar sessoes completas para ter dados corretos
|
||||
let current_sessions = if result.has_active_sessions {
|
||||
fetch_sessions(&base_clone, &token_clone).await.unwrap_or_default()
|
||||
let sessions = fetch_sessions(&base_clone, &token_clone).await.unwrap_or_default();
|
||||
crate::log_info!(
|
||||
"[CHAT DEBUG] fetch_sessions: {} sessoes encontradas",
|
||||
sessions.len()
|
||||
);
|
||||
for s in &sessions {
|
||||
crate::log_info!(
|
||||
"[CHAT DEBUG] Sessao: id={}, ticket={}, unread={}",
|
||||
s.session_id,
|
||||
s.ticket_id,
|
||||
s.unread_count
|
||||
);
|
||||
}
|
||||
sessions
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
|
@ -400,7 +421,20 @@ impl ChatRuntime {
|
|||
let new_messages = result.total_unread > prev_unread;
|
||||
*last_unread_count.lock() = result.total_unread;
|
||||
|
||||
// DEBUG: Log de unread count
|
||||
crate::log_info!(
|
||||
"[CHAT DEBUG] Unread check: prev={}, current={}, new_messages={}",
|
||||
prev_unread,
|
||||
result.total_unread,
|
||||
new_messages
|
||||
);
|
||||
|
||||
// Sempre emitir unread-update com sessoes completas
|
||||
crate::log_info!(
|
||||
"[CHAT DEBUG] Emitindo unread-update: totalUnread={}, sessions={}",
|
||||
result.total_unread,
|
||||
current_sessions.len()
|
||||
);
|
||||
let _ = app.emit(
|
||||
"raven://chat/unread-update",
|
||||
serde_json::json!({
|
||||
|
|
@ -411,6 +445,7 @@ impl ChatRuntime {
|
|||
|
||||
// Notificar novas mensagens (quando aumentou)
|
||||
if new_messages && result.total_unread > 0 {
|
||||
crate::log_info!("[CHAT DEBUG] NOVA MENSAGEM DETECTADA! Emitindo evento new-message");
|
||||
let new_count = result.total_unread - prev_unread;
|
||||
|
||||
crate::log_info!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue