diff --git a/backend/apps/system/middleware/auth.py b/backend/apps/system/middleware/auth.py index a1e7b1e2..23bdd512 100644 --- a/backend/apps/system/middleware/auth.py +++ b/backend/apps/system/middleware/auth.py @@ -63,7 +63,6 @@ class TokenMiddleware(BaseHTTPMiddleware): with Session(engine) as session: session_user = await get_user_info(session = session, user_id = token_data.id) session_user = UserInfoDTO.model_validate(session_user) - session_user = UserInfoDTO.model_validate(session_user) """ if token_data.oid != session_user.oid: raise HTTPException( status_code=401, diff --git a/backend/common/core/sqlbot_cache.py b/backend/common/core/sqlbot_cache.py index e3fe8482..15d58308 100644 --- a/backend/common/core/sqlbot_cache.py +++ b/backend/common/core/sqlbot_cache.py @@ -8,6 +8,8 @@ import asyncio import random from collections import defaultdict +from apps.system.schemas.auth import CacheName +from apps.system.schemas.system_schema import UserInfoDTO from common.utils.utils import SQLBotLogUtil # 使用contextvar来跟踪当前线程已持有的锁 @@ -118,6 +120,9 @@ def cache( # 双重检查 if (cached := await backend.get(cache_key)) is not None: SQLBotLogUtil.debug(f"Cache hit: {cache_key}") + if CacheName.USER_INFO.value in cache_key: + user = UserInfoDTO.model_validate(cached) + SQLBotLogUtil.info(f"User cache hit: [uid: {user.id}, account: {user.account}, oid: {user.oid}]") return cached # 执行函数并缓存结果 @@ -129,6 +134,9 @@ def cache( await backend.set(cache_key, result, actual_expire) SQLBotLogUtil.debug(f"Cache set: {cache_key} (expire: {actual_expire}s)") + if CacheName.USER_INFO.value in cache_key: + user = UserInfoDTO.model_validate(result) + SQLBotLogUtil.info(f"User cache set: [uid: {user.id}, account: {user.account}, oid: {user.oid}]") return result return wrapper diff --git a/frontend/src/views/chat/ChatListContainer.vue b/frontend/src/views/chat/ChatListContainer.vue index 5231c6dc..88fc48f0 100644 --- a/frontend/src/views/chat/ChatListContainer.vue +++ b/frontend/src/views/chat/ChatListContainer.vue @@ -73,7 +73,9 @@ const _chatList = computed({ const computedChatList = computed>(() => { if (search.value && search.value.length > 0) { - return filter(_chatList.value, (c) => includes(c.brief, search.value)) + return filter(_chatList.value, (c) => + includes(c.brief?.toLowerCase(), search.value?.toLowerCase()) + ) } else { return _chatList.value } diff --git a/frontend/src/views/ds/Card.vue b/frontend/src/views/ds/Card.vue index 1a8c6015..f707f959 100644 --- a/frontend/src/views/ds/Card.vue +++ b/frontend/src/views/ds/Card.vue @@ -160,6 +160,7 @@ const onClickOutside = () => { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; + word-break: break-word; overflow: hidden; width: 100%; } diff --git a/frontend/src/views/ds/ChatCard.vue b/frontend/src/views/ds/ChatCard.vue index c41d8218..50ac8431 100644 --- a/frontend/src/views/ds/ChatCard.vue +++ b/frontend/src/views/ds/ChatCard.vue @@ -9,7 +9,7 @@ const props = withDefaults( type: string typeName: string num: string - isSelected: boolean + isSelected?: boolean description?: string id?: string }>(), @@ -34,7 +34,7 @@ const SelectDs = () => {