16 lines
556 B
Plaintext
16 lines
556 B
Plaintext
# -*- coding: utf-8 -*-
|
|
# template_save.dspy — 保存模板(有 id 走更新,无 id 走新建)
|
|
# POST /drag/api/template_save.dspy body: {id?, name, category, description?, blocks, connections}
|
|
try:
|
|
ns = dict(params_kw)
|
|
if 'id' in ns and not ns.get('id'):
|
|
ns.pop('id', None)
|
|
tid = ns.get('id')
|
|
if tid:
|
|
result = await update_drag_template(ns)
|
|
else:
|
|
result = await create_drag_template(ns)
|
|
return result
|
|
except Exception as e:
|
|
return {'success': False, 'message': 'template_save.dspy: ' + str(e)}
|