Add /clear command
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4423148552
commit
4c7d67cabf
8 files changed
+60
-2
No files matched your search
@@ -1128,6 +1128,13 @@ pub(crate) fn send_prompt(app: &AppState, session: crate::types::Session, text:
|
||||
tokio::spawn(do_compact(app.clone(), id.clone()));
|
||||
return Ok(json!({"ok": true, "command": "compact"}));
|
||||
}
|
||||
if text == "/clear" {
|
||||
if app.is_busy(&id) {
|
||||
return Err(ApiError(StatusCode::CONFLICT, "session is busy".into()));
|
||||
}
|
||||
runner::clear_context(app, &id).map_err(|e| ApiError(StatusCode::INTERNAL_SERVER_ERROR, format!("{e:#}")))?;
|
||||
return Ok(json!({"ok": true, "command": "clear"}));
|
||||
}
|
||||
let cwd = PathBuf::from(&session.cwd);
|
||||
let root = app.root_for(session.owner_id.as_deref(), &cwd);
|
||||
let mut prompt_text = text.clone();
|
||||
|
||||
Reference in new issue
Block a user