reallife_asset/wwwroot/api/submit_virtual_create_group.dspy
yumoqing 925f58b025 feat: 添加私域虚拟人素材功能
- init.py: 新增6个虚拟人函数(create/list/upload/sync等),注册到ServerEnv
- api_mapping: 新增create_group→CreateAssetGroup映射
- 外部API: 5个rl_virtual_*.dspy端点(创建组合/列表/上传/素材列表/状态)
- 前端API: 4个submit/get dspy端点(UI表单提交和数据获取)
- UI页面: 3个页面(创建组合/上传素材/查看素材)
- index.ui: 左侧导航新增虚拟人素材分区(3个按钮)
- load_path.py: RBAC新增virtual页面和api/%路径
- docs: api_downapp.md新增虚拟人API文档(5个端点)
2026-06-02 15:25:14 +08:00

39 lines
1.3 KiB
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.

vendor = params_kw.get('vendor', '')
name = params_kw.get('name', '')
description = params_kw.get('description', '')
if not vendor or not name:
return json.dumps({
"widgettype": "Error",
"options": {"title": "错误", "message": "请选择供应商并输入组合名称"}
})
org_id = (await get_userorgid()) or '0'
user_id = (await get_user()) or ''
result = await rl_create_virtual_group(org_id, vendor, name, description, "default", user_id)
if result.get('success'):
vendor_group_id = result.get('vendor_group_id', '')
msg = f"素材组合创建成功!\n组合ID{vendor_group_id}\n现在可以上传虚拟人素材到此组合。"
return json.dumps({
"widgettype": "Message",
"id": "virtual_group_result_popup",
"options": {"title": "创建成功", "message": "", "anchor": "cc"},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"padding": "8px", "gap": "12px"},
"subwidgets": [
{"widgettype": "Text", "options": {"text": msg}}
]
}
]
})
else:
return json.dumps({
"widgettype": "Error",
"options": {"title": "创建失败", "message": result.get('message', '未知错误')}
})