mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -73,7 +73,9 @@ const _chatList = computed({
|
||||
|
||||
const computedChatList = computed<Array<ChatInfo>>(() => {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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%;
|
||||
}
|
||||
|
||||
@@ -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 = () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="card" @click="SelectDs" :class="isSelected && 'is-selected'">
|
||||
<div class="card" :class="isSelected && 'is-selected'" @click="SelectDs">
|
||||
<div class="name-icon">
|
||||
<img :src="icon" width="32px" height="32px" />
|
||||
<div class="info">
|
||||
@@ -103,6 +103,7 @@ const SelectDs = () => {
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ const handleEmbedded = () => {
|
||||
height: 44px;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
word-break: break-word;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ const handlePublic = () => {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
word-break: break-word;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,12 @@
|
||||
<el-icon size="28">
|
||||
<avatar_personal></avatar_personal>
|
||||
</el-icon>
|
||||
<span class="ml-4"> {{ space.name }}</span>
|
||||
<span class="account">({{ space.account }})</span>
|
||||
<span class="ml-4 ellipsis" style="max-width: 40%" :title="space.name">
|
||||
{{ space.name }}</span
|
||||
>
|
||||
<span class="account ellipsis" style="max-width: 40%" :title="space.account"
|
||||
>({{ space.account }})</span
|
||||
>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
@@ -59,12 +63,16 @@
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-for="ele in checkedWorkspace" :key="ele.name" class="flex-between">
|
||||
<div class="flex align-center">
|
||||
<div class="flex align-center ellipsis" style="width: 100%">
|
||||
<el-icon size="28">
|
||||
<avatar_personal></avatar_personal>
|
||||
</el-icon>
|
||||
<span class="ml-4 lighter">{{ ele.name }}</span>
|
||||
<span class="account">({{ ele.account }})</span>
|
||||
<span class="ml-4 lighter ellipsis" style="max-width: 40%" :title="ele.name">{{
|
||||
ele.name
|
||||
}}</span>
|
||||
<span class="account ellipsis" style="max-width: 40%" :title="ele.account"
|
||||
>({{ ele.account }})</span
|
||||
>
|
||||
</div>
|
||||
<el-button text>
|
||||
<el-icon size="16" @click="clearWorkspace(ele)"><Close /></el-icon>
|
||||
|
||||
@@ -51,8 +51,12 @@
|
||||
<el-icon size="28">
|
||||
<avatar_personal></avatar_personal>
|
||||
</el-icon>
|
||||
<span class="ml-4"> {{ space.name }}</span>
|
||||
<span class="account">({{ space.account }})</span>
|
||||
<span class="ml-4 ellipsis" style="max-width: 40%" :title="space.name">
|
||||
{{ space.name }}</span
|
||||
>
|
||||
<span class="account ellipsis" style="max-width: 40%" :title="space.account"
|
||||
>({{ space.account }})</span
|
||||
>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
@@ -68,13 +72,21 @@
|
||||
{{ $t('workspace.clear') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-for="ele in checkedWorkspace" :key="ele.name" class="flex-between">
|
||||
<div class="flex align-center">
|
||||
<div v-for="ele in checkedWorkspace" :key="ele.name" class="flex-between align-center">
|
||||
<div
|
||||
:title="`${ele.name}(${ele.account})`"
|
||||
class="flex align-center ellipsis"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-icon size="28">
|
||||
<avatar_personal></avatar_personal>
|
||||
</el-icon>
|
||||
<span class="ml-4 lighter">{{ ele.name }}</span>
|
||||
<span class="account">({{ ele.account }})</span>
|
||||
<span class="ml-4 lighter ellipsis" style="max-width: 40%" :title="ele.name">{{
|
||||
ele.name
|
||||
}}</span>
|
||||
<span class="account ellipsis" style="max-width: 40%" :title="ele.account"
|
||||
>({{ ele.account }})</span
|
||||
>
|
||||
</div>
|
||||
<el-button text>
|
||||
<el-icon size="16" @click="clearWorkspace(ele)"><Close /></el-icon>
|
||||
|
||||
Reference in New Issue
Block a user