代码优化调整
This commit is contained in:
@@ -170,7 +170,7 @@ impl AgentParser for ClineParser {
|
||||
id: entry.id,
|
||||
agent_type: AgentType::Cline,
|
||||
folder_path,
|
||||
folder_name: folder_name.map(String::from),
|
||||
folder_name,
|
||||
title,
|
||||
started_at,
|
||||
ended_at,
|
||||
@@ -321,7 +321,7 @@ impl AgentParser for ClineParser {
|
||||
id: conversation_id.to_string(),
|
||||
agent_type: AgentType::Cline,
|
||||
folder_path,
|
||||
folder_name: folder_name.map(String::from),
|
||||
folder_name,
|
||||
title,
|
||||
started_at,
|
||||
ended_at,
|
||||
@@ -451,7 +451,7 @@ fn parse_tool_result_text(text: &str) -> (String, String, bool) {
|
||||
let tool_name = trimmed
|
||||
.strip_prefix('[')
|
||||
.and_then(|s| {
|
||||
s.find(|c: char| c == ']' || c == ' ')
|
||||
s.find([']', ' '])
|
||||
.map(|i| s[..i].to_string())
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
@@ -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