feat(deploy): finalize MVP deployment and file transfer approach
This commit is contained in:
parent
6369721876
commit
0f79494fbe
43 changed files with 3078 additions and 645 deletions
|
|
@ -8,6 +8,7 @@ from nio.api import RoomVisibility
|
|||
from nio.responses import RoomCreateError
|
||||
|
||||
from adapter.matrix.agent_registry import AgentRegistry
|
||||
from adapter.matrix.handlers.auth import default_agent_notice
|
||||
from adapter.matrix.store import (
|
||||
get_user_meta,
|
||||
next_chat_id,
|
||||
|
|
@ -107,10 +108,11 @@ def make_handle_new_chat(
|
|||
)
|
||||
|
||||
agent_id = None
|
||||
agent_assignment = "none"
|
||||
if registry is not None:
|
||||
agent_id = registry.get_agent_id_for_user(event.user_id)
|
||||
if agent_id is None and registry.agents:
|
||||
agent_id = registry.agents[0].agent_id
|
||||
assignment = registry.resolve_agent_for_user(event.user_id)
|
||||
agent_id = assignment.agent_id
|
||||
agent_assignment = assignment.source
|
||||
|
||||
room_meta: dict = {
|
||||
"room_type": "chat",
|
||||
|
|
@ -120,6 +122,7 @@ def make_handle_new_chat(
|
|||
"space_id": space_id,
|
||||
"platform_chat_id": platform_chat_id,
|
||||
"agent_id": agent_id,
|
||||
"agent_assignment": agent_assignment,
|
||||
}
|
||||
await set_room_meta(store, room_id, room_meta)
|
||||
ctx = await chat_mgr.get_or_create(
|
||||
|
|
@ -129,10 +132,13 @@ def make_handle_new_chat(
|
|||
surface_ref=room_id,
|
||||
name=room_name,
|
||||
)
|
||||
text = f"Создан чат: {ctx.display_name} ({ctx.chat_id})"
|
||||
if agent_assignment == "default":
|
||||
text = f"{text}\n\n{default_agent_notice()}"
|
||||
return [
|
||||
OutgoingMessage(
|
||||
chat_id=event.chat_id,
|
||||
text=f"Создан чат: {ctx.display_name} ({ctx.chat_id})",
|
||||
text=text,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue