fix: worker creates venv before execution, prompt enforces uv pip install
This commit is contained in:
parent
c56bfd9377
commit
63b577ee46
@ -27,6 +27,7 @@
|
||||
## 环境信息
|
||||
|
||||
- 工作目录是独立的项目工作区,Python venv 已预先激活(.venv/)
|
||||
- 使用 `uv add <包名>` 或 `pip install <包名>` 安装依赖
|
||||
- 安装 Python 包**必须**使用 `uv pip install <包名>`(不要用裸 pip)
|
||||
- 运行 Python 脚本直接用 `python3 xxx.py`(venv 已在 PATH 中)
|
||||
|
||||
请使用中文回复。
|
||||
|
||||
@ -150,7 +150,15 @@ async fn connect_and_run(server_url: &str, worker_name: &str, llm_config: &crate
|
||||
let llm = LlmClient::new(llm_config);
|
||||
let exec = LocalExecutor::new(None);
|
||||
let workdir = format!("workspaces/{}", project_id);
|
||||
let instructions = String::new(); // TODO: load from template
|
||||
let instructions = String::new();
|
||||
|
||||
// Ensure workspace has a venv
|
||||
let _ = tokio::fs::create_dir_all(&workdir).await;
|
||||
let venv_path = format!("{}/.venv", workdir);
|
||||
if !std::path::Path::new(&venv_path).exists() {
|
||||
tracing::info!("Setting up venv in {}", workdir);
|
||||
let _ = exec.execute("uv venv .venv", &workdir).await;
|
||||
}
|
||||
|
||||
// update channel → serialize → WebSocket
|
||||
let (update_tx, mut update_rx) = mpsc::channel::<AgentUpdate>(64);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user