- Create llm_catalog_rel model for one-to-many relationship - Remove llmcatelogid from llm model - Update SQL queries in utils.py and dspy files to use join - Add maintenance UI (llm_catalog_rel_manage.ui) and API endpoints - Filter options by user's orgid
21 lines
772 B
Python
21 lines
772 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
|
|
result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
|
|
|
|
try:
|
|
dbname = get_module_dbname('llmage')
|
|
rel_id = params_kw.get('id', '')
|
|
|
|
if not rel_id:
|
|
result['options'] = {'title': 'Error', 'message': '缺少ID参数', 'type': 'error'}
|
|
else:
|
|
async with DBPools().sqlorContext(dbname) as sor:
|
|
await sor.sqlExe("delete from llm_catalog_rel where id = ${id}$", {'id': rel_id})
|
|
result['options'] = {'title': 'Success', 'message': '删除成功', 'type': 'success'}
|
|
|
|
except Exception as e:
|
|
result['options'] = {'title': 'Error', 'message': f'删除失败: {str(e)}', 'type': 'error'}
|
|
|
|
return json.dumps(result, ensure_ascii=False)
|