diff --git a/backend/apps/system/api/assistant.py b/backend/apps/system/api/assistant.py index 6577c3b4..0b1b7cd7 100644 --- a/backend/apps/system/api/assistant.py +++ b/backend/apps/system/api/assistant.py @@ -45,7 +45,7 @@ async def info(session: SessionDep, id: str, virtual: Optional[int] = Query(None @router.get("", response_model=list[AssistantModel]) async def query(session: SessionDep): - list_result = session.exec(select(AssistantModel).order_by(AssistantModel.create_time)).all() + list_result = session.exec(select(AssistantModel).order_by(AssistantModel.create_time.asc())).all() return list_result @router.post("") diff --git a/backend/common/core/sqlbot_cache.py b/backend/common/core/sqlbot_cache.py index 93aeb27c..196a7275 100644 --- a/backend/common/core/sqlbot_cache.py +++ b/backend/common/core/sqlbot_cache.py @@ -164,11 +164,13 @@ def clear_cache( ) async with _get_cache_lock(cache_key): - await FastAPICache.clear(key=cache_key) - result = await func(*args, **kwargs) - logging.info(f"Clearing cache for key: {cache_key}") - print(f"Clearing cache for key: {cache_key}") - return result + if await FastAPICache.get_backend().get(cache_key): + await FastAPICache.clear(key=cache_key) + result = await func(*args, **kwargs) + logging.info(f"Clearing cache for key: {cache_key}") + print(f"Clearing cache for key: {cache_key}") + return result + return await func(*args, **kwargs) return wrapper return decorator \ No newline at end of file