kboss/b/cntoai/model_management_list.dspy
2026-05-20 19:10:26 +08:00

25 lines
830 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def _escape(value):
if value is None:
return None
return str(value).replace("'", "''")
async def model_management_list(ns={}):
"""上架listing_status 置为 1"""
model_id = ns.get('id')
if not model_id:
return {'status': False, 'msg': 'id is required'}
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
update_sql = """
UPDATE model_management SET listing_status = 1 WHERE id = '%s';
""" % _escape(model_id)
await sor.sqlExe(update_sql, {})
return {'status': True, 'msg': 'model listed success'}
except Exception as e:
await sor.rollback()
return {'status': False, 'msg': 'model list failed, %s' % str(e)}
ret = await model_management_list(params_kw)
return ret