🔧 修复:组队团战时创建所有龙虾座位
问题: - 登录选了 N 只龙虾,但创建会议只有人类座位 修复: - 前端:创建会议时传递 host_agent_id(第一只龙虾) - 后端:根据 host_agent_id 创建龙虾参会者 - 优化:只有没有龙虾时才添加虚拟坐席 结果: ✅ 单枪匹马 - 1 个座位 ✅ 组队团战(2 龙虾)- 3 个座位 ✅ 独当一面(1 龙虾)- 1 个座位
This commit is contained in:
@@ -53,7 +53,7 @@ class MeetingViewSet(viewsets.ModelViewSet):
|
|||||||
is_host=True
|
is_host=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# 创建虚拟龙虾参会者(如果指定了 host_agent_id)
|
# 如果指定了 host_agent_id,创建该龙虾参会者
|
||||||
if host_agent_id:
|
if host_agent_id:
|
||||||
Participant.objects.create(
|
Participant.objects.create(
|
||||||
meeting=meeting,
|
meeting=meeting,
|
||||||
@@ -65,8 +65,8 @@ class MeetingViewSet(viewsets.ModelViewSet):
|
|||||||
is_host=False
|
is_host=False
|
||||||
)
|
)
|
||||||
|
|
||||||
# 如果没有指定 host_agent_id,创建两个虚拟龙虾
|
# 如果没有龙虾,添加虚拟坐席
|
||||||
if not host_agent_id and request.data.get('auto_add_virtual_agents', True):
|
if request.data.get('auto_add_virtual_agents', False):
|
||||||
Participant.objects.create(
|
Participant.objects.create(
|
||||||
meeting=meeting,
|
meeting=meeting,
|
||||||
agent_type='openclaw',
|
agent_type='openclaw',
|
||||||
|
|||||||
@@ -167,9 +167,14 @@ function MeetingList() {
|
|||||||
const createMeeting = async (e) => {
|
const createMeeting = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
try {
|
||||||
|
// 获取当前登录的龙虾
|
||||||
|
const sessions = JSON.parse(localStorage.getItem('sessions') || '[]');
|
||||||
|
const agentIds = sessions.filter(s => s.session_type === 'agent').map(s => s.agent_id);
|
||||||
|
|
||||||
const res = await axios.post(`${API_BASE}/meetings/`, {
|
const res = await axios.post(`${API_BASE}/meetings/`, {
|
||||||
topic,
|
topic,
|
||||||
auto_add_virtual_agents: autoAddAgents
|
auto_add_virtual_agents: !autoAddAgents ? false : agentIds.length === 0, // 如果没有龙虾才添加虚拟的
|
||||||
|
host_agent_id: agentIds.length > 0 ? agentIds[0] : null
|
||||||
});
|
});
|
||||||
navigate(`/meeting/${res.data.id}`);
|
navigate(`/meeting/${res.data.id}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user