agentscope-ai / agentscope-ai/QwenPaw

[Feature]: 删除对话时可选清理该对话产生的任意临时文件,

Aperta
#6,827 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
35k
Fork
3.1k
Merge medio
1g 13h
PR unite (30g)
228

Descrizione

## Summary

删除对话(Chat)时,提供可选选项,清理该对话过程中 agent 创建的临时文件(脚本、配置文件等),避免工作区堆积孤立文件。

## Problem / Motivation

当前 `qwenpaw chats delete` 只删除 Chat 元数据(UUID mapping),**不清理对话过程中 agent 通过 write_file / edit_file 等工具创建的临时文件**。这些文件随着对话删除变成了孤立文件,长期积累会占用磁盘空间,且难以区分哪些文件还有用、哪些是垃圾。

典型场景:
- 用户让 agent 生成一个 Python 脚本跑数据分析,跑完后删除对话,脚本文件留在工作区
- 多轮对话中 agent 反复创建临时配置文件,对话删除后无人清理

## Proposed Solution

在删除对话的 API 和 CLI 中增加一个可选参数 `--clean-files`:

1. **推荐方案**:扩展 ChatSpec,记录该对话中 agent 创建/修改过的文件路径列表。删除时如果指定 `--clean-files`,则遍历该列表删除对应文件。
2. **保守方案**:删除时只清理工作区中特定约定的临时目录(如 `tmp/`),不追踪具体文件。
3. **UI 层面**:控制台删除对话时增加一个"同时清理临时文件"的复选框。

## Alternatives Considered

1. **手动清理**:用户自己用 find 或 `qwenpaw clean` 清理——但前者繁琐,后者是核弹级(清空整个 WORKING_DIR)。
2. **约定临时目录**:让 agent 统一在 `tmp/` 下创建临时文件——但已有文件无法追溯。
3. **不做任何处理**:维持现状——对话越多,垃圾文件越多。

## Willing to Contribute

- [ ] I am willing to open a PR for this feature (after discussion).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start at the qwenpaw chats delete command and the ChatSpec mentioned in the proposal, then trace how write_file and edit_file paths could be associated with a chat. Compare this with qwenpaw clean, WORKING_DIR, and the proposed tmp/ convention. Done should include an optional --clean-files path for the deletion API and CLI while preserving normal metadata-only deletion.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend, cli
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.