From e7fc203422eff505d93105bc48680a20ee43ea7d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 24 Jul 2025 12:10:39 +0800 Subject: [PATCH 1/3] refactor: update style --- frontend/src/i18n/en.json | 3 ++- frontend/src/i18n/zh-CN.json | 3 ++- frontend/src/views/dashboard/common/ResourceGroupOpt.vue | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index eb6a3563..ee534d96 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -32,6 +32,7 @@ "password_reset_successful": "Password reset successful" }, "dashboard": { + "length_limit64": "Field length must be between 1 and 64", "sort_column": "Sort field", "sort_type": "Sort type", "time": "Time", @@ -59,7 +60,7 @@ "name_desc": "Sort by Name (Descending)", "select_dashboard": "Please Select Dashboard", "view": "View", - "text": "Text", + "text": "Rich Text", "preview": "Preview", "creator": "Creator", "dashboard_id": "Dashboard ID", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index fc11d6a4..6ceb58e2 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -34,6 +34,7 @@ "password_reset_successful": "重置密码成功" }, "dashboard": { + "length_limit64": "字段长度需要在1-64之间", "sort_column": "排序字段", "sort_type": "排序方式", "time": "时间", @@ -62,7 +63,7 @@ "select_dashboard": "请选择仪表板", "name": "名称", "view": "图表", - "text": "文本", + "text": "富文本", "preview": "预览", "creator": "创建人", "dashboard_id": "仪表板ID", diff --git a/frontend/src/views/dashboard/common/ResourceGroupOpt.vue b/frontend/src/views/dashboard/common/ResourceGroupOpt.vue index ab76de83..24da8906 100644 --- a/frontend/src/views/dashboard/common/ResourceGroupOpt.vue +++ b/frontend/src/views/dashboard/common/ResourceGroupOpt.vue @@ -95,7 +95,7 @@ const resourceFormRules = ref({ { min: 1, max: 64, - message: 'Chart limit 1-64', + message: t('dashboard.length_limit64'), trigger: 'change', }, { required: true, trigger: 'blur' }, From cc87040c25f2e2c1693a4d0f02b539f17d13c58b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 24 Jul 2025 12:42:02 +0800 Subject: [PATCH 2/3] perf: User cache log --- backend/apps/system/middleware/auth.py | 1 - backend/common/core/sqlbot_cache.py | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 From 78367610ac43f13a1866c23726cf24053bdd6a38 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 24 Jul 2025 12:57:19 +0800 Subject: [PATCH 3/3] perf: Frontend error --- frontend/src/views/ds/ChatCard.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/ds/ChatCard.vue b/frontend/src/views/ds/ChatCard.vue index c41d8218..2eef2393 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 = () => {