MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / deleteAttachment

Method deleteAttachment

src/app/repo/agent_chat.ts:138–154  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

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> {

Callers 2

deleteAttachmentsMethod · 0.95
agent_chat.test.tsFile · 0.80

Calls 3

getWorkspaceRootFunction · 0.90
getDirectoryFunction · 0.90
getChildDirMethod · 0.80

Tested by

no test coverage detected