优化: run_command 实时流式 + 审批浮窗修复 + 文档探索闭环(fetch_url+obscura引导+model_fetch兼容+prompt策略+厂商预设)
This commit is contained in:
@@ -45,9 +45,10 @@ use crate::commands::ai::tool_registry::{
|
||||
FILE_LOCKS, FileGrepHit,
|
||||
};
|
||||
|
||||
// run_command 依赖 df_execute::shell::{execute, ShellRequest} + std HashMap
|
||||
// new_id: delete_file 软删除备份命名(原 register_file_tools 闭包引用,经 df_types::types::new_id)
|
||||
use df_execute::shell::{execute, ShellRequest};
|
||||
// run_command 依赖 df_execute::shell::{execute_streaming, ShellRequest, StreamKind} + std HashMap
|
||||
// execute_streaming:run_command 专用流式(spawn 逐行读 stdout/stderr,回调 emit AiCommandOutput 治执行黑盒)。
|
||||
// new_id: delete_file 软删除备份命名(原 register_file_tools 闭包引用,经 df_types::types::new_id)。
|
||||
use df_execute::shell::{execute_streaming, ShellRequest, StreamKind};
|
||||
use df_types::types::new_id;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -1032,7 +1033,12 @@ pub fn register(
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let result = execute(request).await.map_err(|e| {
|
||||
let result = execute_streaming(request, |kind: StreamKind, line: &str| {
|
||||
// 实时流式 emit:每读一行 stdout/stderr 即 emit AiCommandOutput。
|
||||
// task-local 未注入(command_stream::scope 未调用)→ emit_output 静默 noop,
|
||||
// 不阻断命令(等价原 execute 一次性返回,无副作用)。
|
||||
crate::commands::ai::command_stream::emit_output(kind, line);
|
||||
}).await.map_err(|e| {
|
||||
let msg = e.to_string();
|
||||
if msg.contains("命令执行超时") {
|
||||
anyhow::anyhow!(
|
||||
|
||||
Reference in New Issue
Block a user