fix: AIParticipantHandler recognizes plugin rooms (locked_by=ai_assistant) as AI-active
This commit is contained in:
@@ -52,6 +52,8 @@ class AIParticipantHandler(ParticipantHandler):
|
|||||||
# Check if AI is mentioned or it's a direct chat with only user + ai
|
# Check if AI is mentioned or it's a direct chat with only user + ai
|
||||||
ai_mentioned = "KI" in mentions or "ai" in mentions
|
ai_mentioned = "KI" in mentions or "ai" in mentions
|
||||||
is_direct = conversation.get("is_direct", False)
|
is_direct = conversation.get("is_direct", False)
|
||||||
|
is_locked = conversation.get("is_locked", False)
|
||||||
|
locked_by = conversation.get("locked_by", "")
|
||||||
|
|
||||||
if is_direct:
|
if is_direct:
|
||||||
# For direct chats, check that only user and ai are participants
|
# For direct chats, check that only user and ai are participants
|
||||||
@@ -62,6 +64,10 @@ class AIParticipantHandler(ParticipantHandler):
|
|||||||
if len(non_system_participants) <= 2:
|
if len(non_system_participants) <= 2:
|
||||||
ai_mentioned = True
|
ai_mentioned = True
|
||||||
|
|
||||||
|
# Plugin rooms (locked by ai_assistant) are always AI-active
|
||||||
|
if is_locked and locked_by == "ai_assistant":
|
||||||
|
ai_mentioned = True
|
||||||
|
|
||||||
if not ai_mentioned:
|
if not ai_mentioned:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user