代码优化调整
This commit is contained in:
@@ -170,7 +170,7 @@ impl AgentParser for ClineParser {
|
|||||||
id: entry.id,
|
id: entry.id,
|
||||||
agent_type: AgentType::Cline,
|
agent_type: AgentType::Cline,
|
||||||
folder_path,
|
folder_path,
|
||||||
folder_name: folder_name.map(String::from),
|
folder_name,
|
||||||
title,
|
title,
|
||||||
started_at,
|
started_at,
|
||||||
ended_at,
|
ended_at,
|
||||||
@@ -321,7 +321,7 @@ impl AgentParser for ClineParser {
|
|||||||
id: conversation_id.to_string(),
|
id: conversation_id.to_string(),
|
||||||
agent_type: AgentType::Cline,
|
agent_type: AgentType::Cline,
|
||||||
folder_path,
|
folder_path,
|
||||||
folder_name: folder_name.map(String::from),
|
folder_name,
|
||||||
title,
|
title,
|
||||||
started_at,
|
started_at,
|
||||||
ended_at,
|
ended_at,
|
||||||
@@ -451,7 +451,7 @@ fn parse_tool_result_text(text: &str) -> (String, String, bool) {
|
|||||||
let tool_name = trimmed
|
let tool_name = trimmed
|
||||||
.strip_prefix('[')
|
.strip_prefix('[')
|
||||||
.and_then(|s| {
|
.and_then(|s| {
|
||||||
s.find(|c: char| c == ']' || c == ' ')
|
s.find([']', ' '])
|
||||||
.map(|i| s[..i].to_string())
|
.map(|i| s[..i].to_string())
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ pub struct WebEventBroadcaster {
|
|||||||
sender: broadcast::Sender<WebEvent>,
|
sender: broadcast::Sender<WebEvent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for WebEventBroadcaster {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl WebEventBroadcaster {
|
impl WebEventBroadcaster {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let (sender, _) = broadcast::channel(4096);
|
let (sender, _) = broadcast::channel(4096);
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ pub async fn acp_update_agent_preferences(
|
|||||||
params.opencode_auth_json,
|
params.opencode_auth_json,
|
||||||
params.codex_auth_json,
|
params.codex_auth_json,
|
||||||
params.codex_config_toml,
|
params.codex_config_toml,
|
||||||
&db,
|
db,
|
||||||
&emitter,
|
&emitter,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
@@ -437,7 +437,7 @@ pub async fn acp_prepare_npx_agent(
|
|||||||
let result = acp_commands::acp_prepare_npx_agent_core(
|
let result = acp_commands::acp_prepare_npx_agent_core(
|
||||||
params.agent_type,
|
params.agent_type,
|
||||||
params.registry_version,
|
params.registry_version,
|
||||||
&db,
|
db,
|
||||||
&emitter,
|
&emitter,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
@@ -451,7 +451,7 @@ pub async fn acp_uninstall_agent(
|
|||||||
) -> Result<Json<()>, AppCommandError> {
|
) -> Result<Json<()>, AppCommandError> {
|
||||||
let db = &state.db;
|
let db = &state.db;
|
||||||
let emitter = state.emitter.clone();
|
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
|
.await
|
||||||
.map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?;
|
.map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?;
|
||||||
Ok(Json(()))
|
Ok(Json(()))
|
||||||
@@ -469,7 +469,7 @@ pub async fn acp_reorder_agents(
|
|||||||
) -> Result<Json<()>, AppCommandError> {
|
) -> Result<Json<()>, AppCommandError> {
|
||||||
let db = &state.db;
|
let db = &state.db;
|
||||||
let emitter = state.emitter.clone();
|
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
|
.await
|
||||||
.map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?;
|
.map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?;
|
||||||
Ok(Json(()))
|
Ok(Json(()))
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ pub struct WebServerState {
|
|||||||
running: std::sync::atomic::AtomicBool,
|
running: std::sync::atomic::AtomicBool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for WebServerState {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl WebServerState {
|
impl WebServerState {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user