feat: 模型管理独立页与会话级选模型

This commit is contained in:
2026-09-20 15:42:25 +08:00
parent ffb8d5f7dc
commit aac3424911
24 changed files with 845 additions and 523 deletions
+2
View File
@@ -58,6 +58,8 @@ class Session:
title: str = "新对话"
status: SessionStatus = SessionStatus.ACTIVE
summary: str | None = None
# 会话选用的模型 id;空则对话时回落公司默认
llm_model: str | None = None
created_at: datetime = field(default_factory=datetime.utcnow)
updated_at: datetime = field(default_factory=datetime.utcnow)
last_message_at: datetime | None = None
+14 -4
View File
@@ -63,20 +63,30 @@ class MemoryRepository(ABC):
class LlmRuntimeCache(ABC):
@abstractmethod
async def get(self, company_id: int) -> LlmRuntimeConfig | None: ...
async def get(
self, company_id: int, model: str | None = None
) -> LlmRuntimeConfig | None: ...
@abstractmethod
async def set(self, company_id: int, config: LlmRuntimeConfig, ttl_seconds: int) -> None: ...
async def set(
self,
company_id: int,
config: LlmRuntimeConfig,
ttl_seconds: int,
model: str | None = None,
) -> None: ...
@abstractmethod
async def delete(self, company_id: int) -> None: ...
async def delete(self, company_id: int, model: str | None = None) -> None: ...
class LlmRuntimeGateway(ABC):
"""从 Server 拉取运行时模型配置(MySQL 真相源)。"""
@abstractmethod
async def fetch(self, company_id: int) -> LlmRuntimeConfig | None: ...
async def fetch(
self, company_id: int, model: str | None = None
) -> LlmRuntimeConfig | None: ...
class ChatStreamer(ABC):