MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / duplicateAssistant

Function duplicateAssistant

src/stores/assistant.ts:273–288  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

271 }
272
273 async function duplicateAssistant(id: string): Promise<{ success: boolean; error?: string }> {
274 try {
275 const svc = useAssistantService()
276 const config = await svc.getConfig(id)
277 if (!config) return { success: false, error: 'Assistant not found' }
278 const { id: _id, builtinId: _bid, ...rest } = config
279 const result = await svc.create({
280 ...rest,
281 name: `${config.name}${i18n.global.t('ai.assistant.duplicateSuffix')}`,
282 })
283 if (result.success) await loadAssistants()
284 return result
285 } catch (error) {
286 return { success: false, error: String(error) }
287 }
288 }
289
290 async function deleteAssistant(id: string): Promise<{ success: boolean; error?: string }> {
291 try {

Callers

nothing calls this directly

Calls 4

useAssistantServiceFunction · 0.90
loadAssistantsFunction · 0.85
getConfigMethod · 0.65
createMethod · 0.65

Tested by

no test coverage detected