16 lines
806 B
Plaintext
16 lines
806 B
Plaintext
# -*- coding: utf-8 -*-
|
||
# create_world.dspy —— 创建世界(自动编码、mode 白名单硬校验、编码唯一冲突重试)
|
||
# 预载全局:params_kw / json / format_exc / create_world / get_module_dbname
|
||
debug('create_world.dspy: START params_kw=%s' % json.dumps(dict(params_kw), ensure_ascii=False))
|
||
try:
|
||
result = await create_world(dict(params_kw))
|
||
return {"status": "ok", "data": result}
|
||
except Exception as e:
|
||
code = getattr(e, 'code', 'INTERNAL_ERROR')
|
||
message = getattr(e, 'message', str(e)) or str(e)
|
||
field = getattr(e, 'field', '')
|
||
detail = getattr(e, 'detail', '') or ''
|
||
debug('create_world.dspy: ERROR %s %s' % (code, message))
|
||
exception(format_exc())
|
||
return {"status": "error", "code": code, "message": message, "field": field, "detail": detail}
|