Files
meeting-room/backend/create_test_user.py
flying-hero 845817a028 🤖 添加虚拟坐席功能
后端:
- 创建会议时自动添加虚拟龙虾参会者
- 如果指定了 host_agent_id,添加该龙虾
- 否则添加 2 个虚拟助手(🤖🦊)

前端:
- 创建会议时可选"添加虚拟坐席"
- 默认勾选,方便测试 @ 功能
- 提示文字说明用途

使用场景:
- 用户创建会议 → 自动有虚拟龙虾
- 点击虚拟龙虾座位 → @ 该龙虾
- 测试 @ 功能无需真实龙虾在线
2026-04-04 13:04:26 +08:00

41 lines
1.1 KiB
Python
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.
#!/usr/bin/env python3
"""
创建测试用户
"""
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'meeting_room.settings')
import django
django.setup()
from django.contrib.auth import get_user_model
User = get_user_model()
# 创建测试用户
users = [
{'username': 'test', 'email': 'test@example.com', 'password': 'test123'},
{'username': 'polaris', 'email': 'polaris@example.com', 'password': 'password123'},
]
for u in users:
user, created = User.objects.get_or_create(username=u['username'])
if created:
user.email = u['email']
user.set_password(u['password'])
user.save()
print(f"✅ 创建用户:{u['username']}")
else:
# 更新密码
user.set_password(u['password'])
user.save()
print(f"🔄 更新用户密码:{u['username']}")
# 绑定一个测试龙虾
user.add_linked_agent('flying_hero', '飞行侠', '🦸', 'phospher-openclaw')
print(f" 🔗 绑定龙虾:飞行侠 🦸")
print("\n✅ 测试用户创建完成!")
print(" 用户名test / 密码test123")
print(" 用户名polaris / 密码password123")