MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / deleteModel

Method deleteModel

src/main/api/renderer/aiModels.ts:161–177  ·  view source on GitHub ↗

* 删除 AI 模型

(modelId: string)

Source from the content-addressed store, hash-verified

159 * 删除 AI 模型
160 */
161 public deleteModel(modelId: string): { success: boolean; error?: string } {
162 const models = this.getAllModels()
163
164 // 查找要删除的模型
165 const index = models.findIndex((m: AiModel) => m.id === modelId)
166 if (index === -1) {
167 return { success: false, error: '未找到该模型' }
168 }
169
170 // 删除模型
171 models.splice(index, 1)
172
173 // 保存到数据库(databaseAPI 会自动处理 _rev)
174 databaseAPI.dbPut(this.DB_KEY, models)
175
176 return { success: true }
177 }
178}
179
180// 导出单例

Callers 2

setupIPCMethod · 0.95
setupIPCMethod · 0.80

Calls 2

getAllModelsMethod · 0.95
dbPutMethod · 0.45

Tested by

no test coverage detected