()
| 676 | } |
| 677 | |
| 678 | async function createRole() { |
| 679 | const roleName = $("roleName").value.trim(); |
| 680 | if (!roleName) throw new Error("请输入角色名。"); |
| 681 | setStatus(`创建角色 ${roleName}`, true); |
| 682 | const data = await api("/api/roles", { |
| 683 | method: "POST", |
| 684 | body: JSON.stringify({ |
| 685 | action: "create", |
| 686 | role_name: roleName, |
| 687 | description: $("roleDescription").value.trim(), |
| 688 | feishu_chat_id: $("roleChatId").value.trim(), |
| 689 | }), |
| 690 | }); |
| 691 | state.roles = data.roles || []; |
| 692 | renderRoles(state.roles); |
| 693 | await loadUsers(state.userId); |
| 694 | setStatus("角色已创建"); |
| 695 | } |
| 696 | |
| 697 | function renderProfile(profile) { |
| 698 | $("profileSnapshot").textContent = JSON.stringify(profile || {}, null, 2); |
nothing calls this directly
no test coverage detected