(id: string)
| 136 | |
| 137 | // 删除单个附件(同时清理新旧路径) |
| 138 | async deleteAttachment(id: string): Promise<void> { |
| 139 | // 新路径: agents/workspace/uploads/{id} |
| 140 | try { |
| 141 | const workspace = await getWorkspaceRoot(); |
| 142 | const dir = await getDirectory(workspace, "uploads"); |
| 143 | await dir.removeEntry(id); |
| 144 | } catch { |
| 145 | // 新路径不存在则忽略 |
| 146 | } |
| 147 | // 旧路径: agents/conversations/attachments/{id} |
| 148 | try { |
| 149 | const dir = await this.getChildDir(ATTACHMENTS_DIR); |
| 150 | await dir.removeEntry(id); |
| 151 | } catch { |
| 152 | // 旧路径不存在则忽略 |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | // 删除会话关联的所有附件(需传入附件 ID 列表) |
| 157 | async deleteAttachments(ids: string[]): Promise<void> { |
no test coverage detected