mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Enable assistant cache
This commit is contained in:
@@ -32,7 +32,6 @@ async def info(session: SessionDep, id: str, virtual: Optional[int] = Query(None
|
||||
db_model = await get_assistant_info(session=session, assistant_id=id)
|
||||
if not db_model:
|
||||
return AssistantValidator()
|
||||
print(db_model)
|
||||
db_model = AssistantModel.model_validate(db_model)
|
||||
access_token_expires = timedelta(minutes=settings.ACCESS_TOKEN_EXPIRE_MINUTES)
|
||||
assistantDict = {
|
||||
|
||||
@@ -17,7 +17,7 @@ from starlette.middleware.cors import CORSMiddleware
|
||||
from common.core.config import settings
|
||||
from common.utils.utils import string_to_numeric_hash
|
||||
|
||||
#@cache(namespace=CacheNamespace.EMBEDDED_INFO, cacheName=CacheName.ASSISTANT_INFO, keyExpression="assistant_id")
|
||||
@cache(namespace=CacheNamespace.EMBEDDED_INFO, cacheName=CacheName.ASSISTANT_INFO, keyExpression="assistant_id")
|
||||
async def get_assistant_info(*, session: Session, assistant_id: int) -> AssistantModel | None:
|
||||
db_model = session.get(AssistantModel, assistant_id)
|
||||
return db_model
|
||||
|
||||
@@ -47,7 +47,7 @@ class AssistantBaseModel(SQLModel):
|
||||
name: str = Field(max_length=255, nullable=False)
|
||||
type: int = Field(nullable=False, default=0)
|
||||
domain: str = Field(max_length=255, nullable=False)
|
||||
description: str = Field(sa_type = Text(), nullable=True)
|
||||
description: Optional[str] = Field(sa_type = Text(), nullable=True)
|
||||
configuration: Optional[str] = Field(sa_type = Text(), nullable=True)
|
||||
create_time: int = Field(default=0, sa_type=BigInteger())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user