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