代码优化调整
This commit is contained in:
@@ -13,6 +13,12 @@ pub struct WebEventBroadcaster {
|
||||
sender: broadcast::Sender<WebEvent>,
|
||||
}
|
||||
|
||||
impl Default for WebEventBroadcaster {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl WebEventBroadcaster {
|
||||
pub fn new() -> Self {
|
||||
let (sender, _) = broadcast::channel(4096);
|
||||
|
||||
@@ -390,7 +390,7 @@ pub async fn acp_update_agent_preferences(
|
||||
params.opencode_auth_json,
|
||||
params.codex_auth_json,
|
||||
params.codex_config_toml,
|
||||
&db,
|
||||
db,
|
||||
&emitter,
|
||||
)
|
||||
.await
|
||||
@@ -437,7 +437,7 @@ pub async fn acp_prepare_npx_agent(
|
||||
let result = acp_commands::acp_prepare_npx_agent_core(
|
||||
params.agent_type,
|
||||
params.registry_version,
|
||||
&db,
|
||||
db,
|
||||
&emitter,
|
||||
)
|
||||
.await
|
||||
@@ -451,7 +451,7 @@ pub async fn acp_uninstall_agent(
|
||||
) -> Result<Json<()>, AppCommandError> {
|
||||
let db = &state.db;
|
||||
let emitter = state.emitter.clone();
|
||||
acp_commands::acp_uninstall_agent_core(params.agent_type, &db, &emitter)
|
||||
acp_commands::acp_uninstall_agent_core(params.agent_type, db, &emitter)
|
||||
.await
|
||||
.map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?;
|
||||
Ok(Json(()))
|
||||
@@ -469,7 +469,7 @@ pub async fn acp_reorder_agents(
|
||||
) -> Result<Json<()>, AppCommandError> {
|
||||
let db = &state.db;
|
||||
let emitter = state.emitter.clone();
|
||||
acp_commands::acp_reorder_agents_core(¶ms.agent_types, &db, &emitter)
|
||||
acp_commands::acp_reorder_agents_core(¶ms.agent_types, db, &emitter)
|
||||
.await
|
||||
.map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?;
|
||||
Ok(Json(()))
|
||||
|
||||
@@ -21,6 +21,12 @@ pub struct WebServerState {
|
||||
running: std::sync::atomic::AtomicBool,
|
||||
}
|
||||
|
||||
impl Default for WebServerState {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl WebServerState {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
||||
Reference in New Issue
Block a user