From 8ebfcd8dd551967cafffb4ce09f6713af11489d6 Mon Sep 17 00:00:00 2001 From: ZHOU Shujian Date: Wed, 22 Apr 2026 21:21:28 +0800 Subject: [PATCH] chore: revert unintentional auto-formatting changes Reverts formatting changes in files that were unrelated to semantic chunking to match upstream project style. --- backend/package/yuxi/services/oidc_service.py | 24 +++++++---- web/src/components/AgentChatComponent.vue | 43 ++++++------------- web/src/components/AgentConfigSidebar.vue | 6 ++- .../ToolCallingResult/BaseToolCall.vue | 4 +- .../components/ToolCallsGroupComponent.vue | 13 ++---- .../components/UserManagementComponent.vue | 5 ++- web/src/views/AgentView.vue | 9 +++- 7 files changed, 51 insertions(+), 53 deletions(-) diff --git a/backend/package/yuxi/services/oidc_service.py b/backend/package/yuxi/services/oidc_service.py index a57ff60f..9c154f62 100644 --- a/backend/package/yuxi/services/oidc_service.py +++ b/backend/package/yuxi/services/oidc_service.py @@ -475,7 +475,10 @@ async def find_user_by_oidc_sub(db, sub: str) -> User | None: # 方法1: 检查是否有用户的 user_id 直接等于 "oidc:{sub}"(标准 OIDC 用户) standard_oidc_user_id = f"oidc:{sub}" # 占位绑定记录会被标记为 is_deleted=1,但我们仍需要查询它们来获取绑定关系 - result = await db.execute(select(User).filter(User.user_id == standard_oidc_user_id, User.is_deleted == 0)) + result = await db.execute(select(User).filter( + User.user_id == standard_oidc_user_id, + User.is_deleted == 0 + )) user = result.scalar_one_or_none() if user: return user @@ -483,9 +486,10 @@ async def find_user_by_oidc_sub(db, sub: str) -> User | None: # 方法2: 检查是否有绑定占位用户格式: "oidc:{sub}:{target_user_id}"(use_raw_username 绑定记录) # 绑定占位用户被标记为 is_deleted=1,需要包括deleted来查询 legacy_result = await db.execute( - select(User) - .filter(User.user_id.like(f"{standard_oidc_user_id}:%"), User.is_deleted.in_([0, 1])) - .order_by(User.id.asc()) + select(User).filter( + User.user_id.like(f"{standard_oidc_user_id}:%"), + User.is_deleted.in_([0, 1]) + ).order_by(User.id.asc()) ) legacy_users = list(legacy_result.scalars().all()) if legacy_users: @@ -524,7 +528,10 @@ async def find_deleted_oidc_user_by_sub(db, sub: str) -> User | None: # 检查绑定占位格式 oidc:{sub}:{target_user_id}(占位本身是deleted,需要查询目标用户) legacy_result = await db.execute( - select(User).filter(User.user_id.like(f"{oidc_user_id}:%"), User.is_deleted == 1).order_by(User.id.asc()) + select(User).filter( + User.user_id.like(f"{oidc_user_id}:%"), + User.is_deleted == 1 + ).order_by(User.id.asc()) ) legacy_users = list(legacy_result.scalars().all()) if legacy_users: @@ -578,7 +585,6 @@ async def _create_oidc_binding_placeholder(db, sub: str, target_user: User) -> N # username 使用 oidc-binding-{sub_hash} 避免冲突,sub_hash 基于完整 sub 生成 import hashlib - sub_hash = hashlib.sha256(sub.encode()).hexdigest()[:8] username = f"oidc-binding-{sub_hash}" @@ -598,7 +604,8 @@ async def _create_oidc_binding_placeholder(db, sub: str, target_user: User) -> N db.add(placeholder_user) await db.commit() logger.info( - f"Created OIDC binding placeholder (deleted) for sub {sub} -> user {target_user.id} ({target_user.user_id})" + f"Created OIDC binding placeholder (deleted) for sub {sub} -> " + f"user {target_user.id} ({target_user.user_id})" ) except IntegrityError: # 并发创建冲突,回滚后忽略 @@ -654,7 +661,8 @@ async def create_oidc_user(db, user_info: dict, department_id: int | None = None if user_by_sub and user_by_sub.id == existing_user.id: # sub 已经正确绑定到该用户,允许返回 logger.info( - f"User with raw username {user_id} already exists and bound to sub {sub}, returning existing user" + f"User with raw username {user_id} already exists and " + f"bound to sub {sub}, returning existing user" ) return existing_user elif user_by_sub is None: diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index e5bee707..83730d74 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -183,13 +183,8 @@ size="16" class="agent-switcher-menu-icon" /> - {{ - agent.name || 'Unknown' - }} - + {{ agent.name || 'Unknown' }} + 当前 @@ -610,10 +605,7 @@ const conversationRows = computed(() => { if (currentThreadConfigNotice.value) { const insertAfterCount = Math.max( 0, - Math.min( - Number(currentThreadConfigNotice.value.insertAfterConversationCount) || 0, - rows.length - ) + Math.min(Number(currentThreadConfigNotice.value.insertAfterConversationCount) || 0, rows.length) ) rows.splice(insertAfterCount, 0, { type: 'notice', @@ -654,10 +646,7 @@ const showStartAgentSelector = computed(() => { }) const showStartAgentDropdown = computed(() => { - return ( - showStartAgentSelector.value && - (startAgents.value.length >= 4 || localUIState.chatMainWidth < 380) - ) + return showStartAgentSelector.value && (startAgents.value.length >= 4 || localUIState.chatMainWidth < 380) }) const showStartAgentSegment = computed(() => { @@ -870,11 +859,7 @@ const queuePendingThreadConfigNotice = (threadId) => { } const flushPendingThreadConfigNotice = (threadId) => { - if ( - !threadId || - !currentThreadHasHistory.value || - !threadPendingConfigNoticeMap.value[threadId] - ) { + if (!threadId || !currentThreadHasHistory.value || !threadPendingConfigNoticeMap.value[threadId]) { return } @@ -1434,11 +1419,7 @@ const selectChat = async (chatId) => { // 先更新当前线程,确保底部智能体名称与选中项即时同步。 chatState.currentThreadId = chatId - if ( - !props.singleMode && - targetChat?.agent_id && - targetChat.agent_id !== currentAgentId.value - ) { + if (!props.singleMode && targetChat?.agent_id && targetChat.agent_id !== currentAgentId.value) { await agentStore.selectAgent(targetChat.agent_id) } @@ -1931,10 +1912,10 @@ const hasVisibleAssistantBody = (message) => { const { content, reasoningContent } = extractAssistantMessageBody(message) return Boolean( content || - reasoningContent || - message.error_type || - message.extra_metadata?.error_type || - message.isStoppedByUser + reasoningContent || + message.error_type || + message.extra_metadata?.error_type || + message.isStoppedByUser ) } @@ -2016,7 +1997,9 @@ const isDisplayMessageProcessing = (conv, displayItem) => { const isToolGroupActive = (conv, itemIndex, displayItems) => { return ( - isReplyLoading.value && conv?.status === 'streaming' && itemIndex === displayItems.length - 1 + isReplyLoading.value && + conv?.status === 'streaming' && + itemIndex === displayItems.length - 1 ) } diff --git a/web/src/components/AgentConfigSidebar.vue b/web/src/components/AgentConfigSidebar.vue index f822b5b9..1ed66c02 100644 --- a/web/src/components/AgentConfigSidebar.vue +++ b/web/src/components/AgentConfigSidebar.vue @@ -57,7 +57,11 @@ />