scense_demo/wwwroot/api/session_delete.dspy
2026-08-29 21:10:23 +08:00

16 lines
638 B
Plaintext

# -*- coding: utf-8 -*-
# demo/api/session_delete.dspy —— 演示会话 CRUD 删除(等价 stop_demo 清理)
# 入参: id(必填) 或 session_id(必填)
try:
sid = params_kw.get('id') or params_kw.get('session_id')
if not sid:
return {"status": 400, "message": "id 不能为空"}
data = await stop_demo(session_id=sid)
return {"status": 200, "data": data}
except DemoParamError as e:
return {"status": 400, "message": str(e)}
except DemoNotFoundError as e:
return {"status": 404, "message": str(e)}
except Exception as e:
return {"status": 500, "message": "session_delete 内部错误: %s" % e}