Fix chat window behavior - remove auto-open on session start

- Remove automatic window opening when agent starts a chat session
- Remove automatic window focus when new messages arrive
- Only show Windows notification, user opens chat manually via tray icon
- Update notification message to instruct user to click Raven icon

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-07 04:07:38 -03:00
parent cd4b702198
commit e4f8f465de

View file

@ -345,12 +345,14 @@ impl ChatRuntime {
); );
// Enviar notificacao nativa do Windows // Enviar notificacao nativa do Windows
// A janela de chat NAO abre automaticamente -
// o usuario deve clicar na notificacao ou no tray
let notification_title = format!( let notification_title = format!(
"Chat iniciado - Chamado #{}", "Chat iniciado - Chamado #{}",
session.ticket_ref session.ticket_ref
); );
let notification_body = format!( let notification_body = format!(
"{} iniciou um chat de suporte", "{} iniciou um chat de suporte.\nClique no icone do Raven para abrir.",
session.agent_name session.agent_name
); );
if let Err(e) = app if let Err(e) = app
@ -364,16 +366,6 @@ impl ChatRuntime {
"Falha ao enviar notificacao: {e}" "Falha ao enviar notificacao: {e}"
); );
} }
// Abrir janela de chat automaticamente
if let Err(e) = open_chat_window_internal(
&app,
&session.ticket_id,
) {
crate::log_error!(
"Falha ao abrir janela de chat: {e}"
);
}
} }
} }
@ -420,15 +412,7 @@ impl ChatRuntime {
"Falha ao enviar notificacao de nova mensagem: {e}" "Falha ao enviar notificacao de nova mensagem: {e}"
); );
} }
// NAO foca a janela automaticamente - usuario abre manualmente
// Focar janela de chat se existir
if let Some(session) = result.sessions.first() {
let label = format!("chat-{}", session.ticket_id);
if let Some(window) = app.get_webview_window(&label) {
let _ = window.show();
let _ = window.set_focus();
}
}
} }
} }
} else { } else {