Agent config in auth.ok + provider/max_concurrent_tasks in AgentConfig
Some checks failed
Deploy Tracker / deploy (push) Failing after 3s
Some checks failed
Deploy Tracker / deploy (push) Failing after 3s
- auth.ok now includes agent_config for agent members - AgentConfig model: added provider, max_concurrent_tasks columns - Fixed project_id injection in WS handler (syntax error) - capabilities read from AgentConfig, not Member
This commit is contained in:
parent
d953cb73ab
commit
80494c5058
@ -48,5 +48,7 @@ class AgentConfig(Base):
|
||||
task_listen: Mapped[str] = mapped_column(String(20), default=ListenMode.MENTIONS) # all | mentions | none
|
||||
prompt: Mapped[str | None] = mapped_column(Text)
|
||||
model: Mapped[str | None] = mapped_column(String(100))
|
||||
provider: Mapped[str | None] = mapped_column(String(50))
|
||||
max_concurrent_tasks: Mapped[int] = mapped_column(default=2)
|
||||
|
||||
member: Mapped["Member"] = relationship(back_populates="agent_config")
|
||||
|
||||
@ -232,15 +232,31 @@ async def _authenticate(ws: WebSocket, token: str, on_behalf_of: str | None = No
|
||||
seen.add(s.member_id)
|
||||
online_list.append({"id": s.member_id, "slug": s.member_slug})
|
||||
|
||||
await ws.send_json({
|
||||
"type": WSEventType.AUTH_OK,
|
||||
"data": {
|
||||
auth_data: dict = {
|
||||
"member_id": str(effective_member.id),
|
||||
"slug": effective_member.slug,
|
||||
"name": effective_member.name,
|
||||
"lobby_chat_id": str(lobby_chat.id) if lobby_chat else None,
|
||||
"projects": project_list,
|
||||
"online": online_list,
|
||||
},
|
||||
}
|
||||
|
||||
# For agents: include full config from DB
|
||||
if effective_member.agent_config:
|
||||
ac = effective_member.agent_config
|
||||
auth_data["agent_config"] = {
|
||||
"model": ac.model,
|
||||
"provider": ac.provider,
|
||||
"prompt": ac.prompt,
|
||||
"chat_listen": ac.chat_listen,
|
||||
"task_listen": ac.task_listen,
|
||||
"max_concurrent_tasks": ac.max_concurrent_tasks,
|
||||
"capabilities": ac.capabilities or [],
|
||||
}
|
||||
|
||||
await ws.send_json({
|
||||
"type": WSEventType.AUTH_OK,
|
||||
"data": auth_data,
|
||||
})
|
||||
|
||||
# Notify others
|
||||
@ -324,6 +340,12 @@ async def _handle_chat_send(session_id: str, data: dict):
|
||||
chat = chat_result.scalar_one_or_none()
|
||||
if chat and chat.project_id:
|
||||
project_id = str(chat.project_id)
|
||||
elif chat and chat.kind == ChatKind.LOBBY:
|
||||
await manager.broadcast_all(
|
||||
{"type": WSEventType.MESSAGE_NEW, "data": msg_data},
|
||||
exclude_member_id=client.member_id,
|
||||
)
|
||||
return
|
||||
elif task_id:
|
||||
from ..models import Task as TaskModel
|
||||
task_result = await db.execute(select(TaskModel).where(TaskModel.id == uuid.UUID(task_id)))
|
||||
@ -333,12 +355,6 @@ async def _handle_chat_send(session_id: str, data: dict):
|
||||
|
||||
if project_id:
|
||||
msg_data["project_id"] = project_id
|
||||
elif chat and chat.kind == ChatKind.LOBBY:
|
||||
await manager.broadcast_all(
|
||||
{"type": WSEventType.MESSAGE_NEW, "data": msg_data},
|
||||
exclude_member_id=client.member_id,
|
||||
)
|
||||
return
|
||||
|
||||
if project_id:
|
||||
await manager.broadcast_message(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user