feat: Add presence heartbeat for Matrix online status

- matrix-gateway: POST /internal/matrix/presence/online endpoint
- usePresenceHeartbeat hook with activity tracking
- Auto away after 5 min inactivity
- Offline on page close/visibility change
- Integrated in MatrixChatRoom component
This commit is contained in:
Apple
2025-11-27 00:19:40 -08:00
parent 5bed515852
commit 3de3c8cb36
6371 changed files with 1317450 additions and 932 deletions

View File

@@ -0,0 +1,36 @@
from abc import ABC, abstractmethod
from typing import Protocol
from models import ChatMessage, LLMResponse
class BaseProvider(Protocol):
"""Base protocol for LLM providers"""
@abstractmethod
async def chat(
self,
messages: list[ChatMessage],
model_name: str,
max_tokens: int | None = None,
temperature: float = 0.7,
top_p: float = 1.0,
**kwargs
) -> LLMResponse:
"""
Send chat completion request to LLM provider
Args:
messages: List of chat messages
model_name: Physical model name for this provider
max_tokens: Maximum tokens to generate
temperature: Sampling temperature
top_p: Nucleus sampling parameter
**kwargs: Provider-specific parameters
Returns:
LLMResponse with content, usage, and metadata
"""
...