Merge branch 'test' into prod

This commit is contained in:
sophie committed 2026-07-17 13:26:59 +08:00
commit ec2c9eca6f
9 files changed
+41 -15

No files matched your search

+2
View File
@@ -78,6 +78,8 @@ def _backend_path(env_key: str, *parts: str) -> str:
class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.getenv('SECRET_KEY')
# 配置最大上传文件大小(200MB)
MAX_CONTENT_LENGTH = 200 * 1024 * 1024
KB_STORAGE_ROOT = _data_path('KB_STORAGE_ROOT', 'kb')
KB_TASK_EXECUTION_MODE = os.getenv('KB_TASK_EXECUTION_MODE', 'worker').strip().lower()
KB_WORKER_POLL_SECONDS = float(os.getenv('KB_WORKER_POLL_SECONDS', '2'))
+6 -2
View File
@@ -83,8 +83,12 @@ def upload_guide_file(file_storage: FileStorage | None) -> dict:
if not file_storage or file_storage.filename == '':
raise ValidationError('No selected file' if file_storage else 'No file part')
content_type = file_storage.content_type
file_size = len(file_storage.read())
file_storage.seek(0)
# 更高效地获取文件大小,不一次性读取全部内容到内存
file_storage.seek(0, 2) # 移动到文件末尾
file_size = file_storage.tell() # 获取当前位置(即文件大小)
file_storage.seek(0) # 重置到文件开头
try:
object_name = minio_service.upload_file(file_storage, file_storage.filename, content_type, file_size)
return {
+5 -1
View File
@@ -1,7 +1,9 @@
server {
listen 80;
server_name localhost;
client_max_body_size 100m;
client_max_body_size 200m;
client_body_timeout 300s;
send_timeout 300s;
resolver 127.0.0.11 valid=30s ipv6=off;
resolver_timeout 5s;
@@ -28,5 +30,7 @@ server {
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
proxy_send_timeout 300s;
}
}
@@ -239,8 +239,20 @@ export function useLoginAuth(deps: LoginDeps, options: LoginAuthOptions) {
}
};
/**
* 发起企业微信登录(OAuth 跳转)。
* 核心逻辑:功能未就绪时提示用户;就绪后按 Casdoor/直连企微获取授权 URL 并跳转。
* @returns Promise<void>
*/
const handleWecomLogin = async () => {
if (!config.auth?.wecom?.enabled) return;
// TODO: 企微登录开发完成后改为 true
const wecomLoginReady = false;
if (!wecomLoginReady) {
msg.info(t('login.wecomComingSoon'));
return;
}
const wecomCfg = config.auth.wecom as { loginViaCasdoor?: boolean; callbackPath?: string; authorizeApi?: string };
const viaCasdoor = Boolean(wecomCfg?.loginViaCasdoor);
try {
@@ -2,7 +2,8 @@
* features/chat/components/ChatSidebar.vue
* 用途:桌面端聊天侧栏,承载 Agent 信息、会话历史、Agent 切换面板与底部用户菜单。
* 依赖:lucide-vue-next、LocaleToggleButton、AgentCategoryList、chat.types。
* 逻辑:由聊天页面传入当前 Agent、历史记录与用户可用 Agent;通过事件把新会话、切换 Agent、反馈等操作回传给页面。
* 逻辑:由聊天页面传入当前 Agent、历史记录与用户可用 Agent;通过事件把新会话、切换 Agent、反馈、进入管理控制台等操作回传给页面。
* 管理员通过底部右侧工具图标进入管理控制台;用户下拉菜单仅保留退出登录。
*/
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
@@ -290,18 +291,8 @@ const userInitial = (fallback: string) => {
</div>
<button
v-if="currentUser?.role === 'admin'"
type="button"
class="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-secondary transition-colors hover:bg-surface-soft"
@click="onGoAdmin"
>
<Settings class="h-4 w-4" />
{{ $t('workspace.nav.admin') }}
</button>
<button
type="button"
class="flex w-full items-center gap-2 border-t border-subtle px-4 py-2 text-left text-sm text-red-600 transition-colors hover:bg-red-50"
class="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-red-600 transition-colors hover:bg-red-50"
@click="onLogout"
>
<LogOut class="h-4 w-4" />
@@ -326,6 +317,15 @@ const userInitial = (fallback: string) => {
<button type="button" class="transition-colors hover:text-secondary" :title="$t('workspace.title')" @click="emit('go-workspace')">
<Briefcase class="h-4 w-4" />
</button>
<button
v-if="currentUser?.role === 'admin'"
type="button"
class="transition-colors hover:text-secondary"
:title="$t('admin.title')"
@click="onGoAdmin"
>
<Settings class="h-4 w-4" />
</button>
</div>
</div>
</div>
+1
View File
@@ -65,6 +65,7 @@
"retryLogin": "Please close this dialog and sign in again."
},
"wecomLogin": "Login with WeCom",
"wecomComingSoon": "WeCom login is under development. Please stay tuned.",
"wecomConnecting": "Connecting to WeCom...",
"wecomStartFailed": "Failed to start WeCom login",
"wecomInvalidState": "Invalid WeCom login state",
+1
View File
@@ -55,6 +55,7 @@
"retryLogin": "กรุณาปิดหน้าต่างนี้แล้วเข้าสู่ระบบใหม่"
},
"wecomLogin": "เข้าสู่ระบบด้วย WeCom",
"wecomComingSoon": "ฟีเจอร์เข้าสู่ระบบด้วย WeCom กำลังพัฒนา กรุณารอติดตาม",
"wecomConnecting": "กำลังเชื่อมต่อ WeCom...",
"wecomStartFailed": "เริ่มต้นการเข้าสู่ระบบด้วย WeCom ไม่สำเร็จ",
"wecomInvalidState": "สถานะการเข้าสู่ระบบ WeCom ไม่ถูกต้อง",
+1
View File
@@ -65,6 +65,7 @@
"retryLogin": "请关闭此窗口后重新登录。"
},
"wecomLogin": "企业微信登录",
"wecomComingSoon": "企业微信登录功能正在开发中,敬请期待",
"wecomConnecting": "正在连接企业微信...",
"wecomStartFailed": "启动企业微信登录失败",
"wecomInvalidState": "企业微信登录状态无效",
+1
View File
@@ -55,6 +55,7 @@
"retryLogin": "請關閉此窗口後重新登入。"
},
"wecomLogin": "企業微信登錄",
"wecomComingSoon": "企業微信登錄功能正在開發中,敬請期待",
"wecomConnecting": "正在連接企業微信...",
"wecomStartFailed": "啟動企業微信登錄失敗",
"wecomInvalidState": "企業微信登入狀態無效",