dbg(email): add email error printrack
This commit is contained in:
parent
7831d08848
commit
2a2600859f
@ -1,8 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use ::agent::chat::ChatService;
|
||||
use ::agent::tool::ToolRegistry;
|
||||
use ::agent::task::service::TaskService;
|
||||
use ::agent::tool::ToolRegistry;
|
||||
use async_openai::config::OpenAIConfig;
|
||||
use avatar::AppAvatar;
|
||||
use config::AppConfig;
|
||||
@ -136,10 +136,8 @@ impl AppService {
|
||||
.unwrap_or_else(|| "redis://127.0.0.1:6379".to_string());
|
||||
|
||||
// Build ChatService if AI is configured; otherwise AI chat is disabled (graceful degradation)
|
||||
let chat_service: Option<Arc<ChatService>> = match (
|
||||
config.ai_api_key(),
|
||||
config.ai_basic_url(),
|
||||
) {
|
||||
let chat_service: Option<Arc<ChatService>> =
|
||||
match (config.ai_api_key(), config.ai_basic_url()) {
|
||||
(Ok(api_key), Ok(base_url)) => {
|
||||
slog::info!(logs, "AI chat enabled — connecting to {}", base_url);
|
||||
let cfg = OpenAIConfig::new()
|
||||
@ -149,7 +147,9 @@ impl AppService {
|
||||
let mut registry = ToolRegistry::new();
|
||||
git_tools::register_all(&mut registry);
|
||||
file_tools::register_all(&mut registry);
|
||||
Some(Arc::new(ChatService::new(client).with_tool_registry(registry)))
|
||||
Some(Arc::new(
|
||||
ChatService::new(client).with_tool_registry(registry),
|
||||
))
|
||||
}
|
||||
(Err(e), _) => {
|
||||
slog::warn!(logs, "AI chat disabled — {}", e);
|
||||
@ -213,7 +213,8 @@ impl AppService {
|
||||
body: envelope.body,
|
||||
};
|
||||
if let Err(e) = email.send(msg).await {
|
||||
slog::error!(logs, "email send failed"; "to" => to, "error" => %e);
|
||||
let err = format!("email send failed to:{} error: {}", to, e);
|
||||
slog::error!(logs, "{}", err);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@ -228,9 +229,9 @@ impl AppService {
|
||||
pub mod agent;
|
||||
pub mod auth;
|
||||
pub mod error;
|
||||
pub mod file_tools;
|
||||
pub mod git;
|
||||
pub mod git_tools;
|
||||
pub mod file_tools;
|
||||
pub mod issue;
|
||||
pub mod project;
|
||||
pub mod pull_request;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user