mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 09:09:20 +08:00
feat: 模型管理独立页与会话级选模型
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user