max first steps

This commit is contained in:
Vladislav Yashnov 2026-05-06 00:24:47 +03:00
parent 3340c126d6
commit eed1533cdc
10 changed files with 589 additions and 0 deletions

View file

@ -0,0 +1,29 @@
"""Attachment queue handlers for MAX surface."""
from adapter.max.store import ChatStore
class AttachmentHandler:
def __init__(self, store: ChatStore):
self.store = store
def handle_list(self, max_chat_id: str) -> str:
attachments = self.store.get_attachments(max_chat_id)
if not attachments:
return "Attachment queue is empty."
lines = [f" {i+1}. {name}" for i, (_, name) in enumerate(attachments)]
return "\n".join(lines)
def handle_remove(self, max_chat_id: str, index: str) -> str:
attachments = self.store.staged_attachments.get(max_chat_id, [])
if index.lower() == "all":
self.store.staged_attachments[max_chat_id] = []
return "All attachments removed from queue."
try:
idx = int(index) - 1
if 0 <= idx < len(attachments):
removed = attachments.pop(idx)
return f"Removed: {removed[1]}"
return "Invalid index."
except ValueError:
return "Usage: !remove <number> or !remove all"