Skip to content

Commit f4f43ff

Browse files
committed
Merge branch 'main' of https://github.com/dataease/SQLBot
2 parents 3b25d8a + 7836761 commit f4f43ff

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

backend/apps/system/middleware/auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ async def validateToken(self, token: Optional[str]):
6363
with Session(engine) as session:
6464
session_user = await get_user_info(session = session, user_id = token_data.id)
6565
session_user = UserInfoDTO.model_validate(session_user)
66-
session_user = UserInfoDTO.model_validate(session_user)
6766
""" if token_data.oid != session_user.oid:
6867
raise HTTPException(
6968
status_code=401,

backend/common/core/sqlbot_cache.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import random
99
from collections import defaultdict
1010

11+
from apps.system.schemas.auth import CacheName
12+
from apps.system.schemas.system_schema import UserInfoDTO
1113
from common.utils.utils import SQLBotLogUtil
1214

1315
# 使用contextvar来跟踪当前线程已持有的锁
@@ -118,6 +120,9 @@ async def wrapper(*args, **kwargs):
118120
# 双重检查
119121
if (cached := await backend.get(cache_key)) is not None:
120122
SQLBotLogUtil.debug(f"Cache hit: {cache_key}")
123+
if CacheName.USER_INFO.value in cache_key:
124+
user = UserInfoDTO.model_validate(cached)
125+
SQLBotLogUtil.info(f"User cache hit: [uid: {user.id}, account: {user.account}, oid: {user.oid}]")
121126
return cached
122127

123128
# 执行函数并缓存结果
@@ -129,6 +134,9 @@ async def wrapper(*args, **kwargs):
129134
await backend.set(cache_key, result, actual_expire)
130135

131136
SQLBotLogUtil.debug(f"Cache set: {cache_key} (expire: {actual_expire}s)")
137+
if CacheName.USER_INFO.value in cache_key:
138+
user = UserInfoDTO.model_validate(result)
139+
SQLBotLogUtil.info(f"User cache set: [uid: {user.id}, account: {user.account}, oid: {user.oid}]")
132140
return result
133141

134142
return wrapper

frontend/src/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"password_reset_successful": "Password reset successful"
3333
},
3434
"dashboard": {
35+
"length_limit64": "Field length must be between 1 and 64",
3536
"sort_column": "Sort field",
3637
"sort_type": "Sort type",
3738
"time": "Time",
@@ -59,7 +60,7 @@
5960
"name_desc": "Sort by Name (Descending)",
6061
"select_dashboard": "Please Select Dashboard",
6162
"view": "View",
62-
"text": "Text",
63+
"text": "Rich Text",
6364
"preview": "Preview",
6465
"creator": "Creator",
6566
"dashboard_id": "Dashboard ID",

frontend/src/i18n/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"password_reset_successful": "重置密码成功"
3535
},
3636
"dashboard": {
37+
"length_limit64": "字段长度需要在1-64之间",
3738
"sort_column": "排序字段",
3839
"sort_type": "排序方式",
3940
"time": "时间",
@@ -62,7 +63,7 @@
6263
"select_dashboard": "请选择仪表板",
6364
"name": "名称",
6465
"view": "图表",
65-
"text": "文本",
66+
"text": "富文本",
6667
"preview": "预览",
6768
"creator": "创建人",
6869
"dashboard_id": "仪表板ID",

frontend/src/views/dashboard/common/ResourceGroupOpt.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const resourceFormRules = ref({
9595
{
9696
min: 1,
9797
max: 64,
98-
message: 'Chart limit 1-64',
98+
message: t('dashboard.length_limit64'),
9999
trigger: 'change',
100100
},
101101
{ required: true, trigger: 'blur' },

frontend/src/views/ds/ChatCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const props = withDefaults(
99
type: string
1010
typeName: string
1111
num: string
12-
isSelected: boolean
12+
isSelected?: boolean
1313
description?: string
1414
id?: string
1515
}>(),
@@ -34,7 +34,7 @@ const SelectDs = () => {
3434
</script>
3535

3636
<template>
37-
<div class="card" @click="SelectDs" :class="isSelected && 'is-selected'">
37+
<div class="card" :class="isSelected && 'is-selected'" @click="SelectDs">
3838
<div class="name-icon">
3939
<img :src="icon" width="32px" height="32px" />
4040
<div class="info">

0 commit comments

Comments
 (0)