mirror of
https://github.com/openai/codex.git
synced 2026-05-02 18:37:01 +00:00
feat: mem slash commands (#11569)
Add 2 slash commands for memories: * `/m_drop` delete all the memories * `/m_update` update the memories with phase 1 and 2
This commit is contained in:
@@ -18,6 +18,32 @@ const MEMORY_CONSOLIDATION_JOB_KEY: &str = "global";
|
||||
const DEFAULT_RETRY_REMAINING: i64 = 3;
|
||||
|
||||
impl StateRuntime {
|
||||
pub async fn clear_memory_data(&self) -> anyhow::Result<()> {
|
||||
let mut tx = self.pool.begin().await?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
DELETE FROM stage1_outputs
|
||||
"#,
|
||||
)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
DELETE FROM jobs
|
||||
WHERE kind = ? OR kind = ?
|
||||
"#,
|
||||
)
|
||||
.bind(JOB_KIND_MEMORY_STAGE1)
|
||||
.bind(JOB_KIND_MEMORY_CONSOLIDATE_GLOBAL)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
tx.commit().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn claim_stage1_jobs_for_startup(
|
||||
&self,
|
||||
current_thread_id: ThreadId,
|
||||
|
||||
Reference in New Issue
Block a user