world/wwwroot/api/create_world.dspy

16 lines
806 B
Plaintext
Raw 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.

# -*- 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}