chore: revert unintentional auto-formatting changes

Reverts formatting changes in files that were unrelated to semantic chunking
to match upstream project style.
This commit is contained in:
ZHOU Shujian 2026-04-22 21:21:28 +08:00
parent edf66bbe38
commit 8ebfcd8dd5
7 changed files with 51 additions and 53 deletions

View File

@ -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:

View File

@ -183,13 +183,8 @@
size="16"
class="agent-switcher-menu-icon"
/>
<span class="agent-switcher-menu-text">{{
agent.name || 'Unknown'
}}</span>
<span
v-if="agent.id === currentAgentId"
class="agent-switcher-menu-badge"
>
<span class="agent-switcher-menu-text">{{ agent.name || 'Unknown' }}</span>
<span v-if="agent.id === currentAgentId" class="agent-switcher-menu-badge">
当前
</span>
</div>
@ -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
)
}

View File

@ -57,7 +57,11 @@
/>
<!-- 统一显示所有配置项 -->
<template v-for="(value, key) in filteredConfigurableItems" :key="key">
<a-form-item :label="getConfigLabel(key, value)" :name="key" class="config-item">
<a-form-item
:label="getConfigLabel(key, value)"
:name="key"
class="config-item"
>
<p v-if="value.description" class="config-description">{{ value.description }}</p>
<!-- <div>{{ value }}</div> -->

View File

@ -77,7 +77,7 @@
</div>
<!-- Result Slot -->
<div class="tool-result" style="opacity: 0.8" v-if="hasResult">
<div class="tool-result" style="opacity: 0.8;" v-if="hasResult">
<slot name="result" :tool-call="toolCall" :result-content="resultContent">
<div class="tool-result-content" :data-tool-call-id="toolCall.id">
<!-- Default rendering -->
@ -234,7 +234,7 @@ const formatResultData = (data) => {
background-color: var(--gray-25);
}
& > span {
&>span {
display: flex;
align-items: center;
}

View File

@ -13,12 +13,8 @@
</span>
<span class="summary-content">
<span class="summary-title">{{ toolCallsSummaryTitle }}</span>
<span class="summary-separator" v-if="normalizedToolCalls.length > 1 && toolCallsNamesMeta"
>·</span
>
<span class="summary-meta" v-if="normalizedToolCalls.length > 1 && toolCallsNamesMeta">{{
toolCallsNamesMeta
}}</span>
<span class="summary-separator" v-if="normalizedToolCalls.length > 1 && toolCallsNamesMeta">·</span>
<span class="summary-meta" v-if="normalizedToolCalls.length > 1 && toolCallsNamesMeta">{{ toolCallsNamesMeta }}</span>
<span class="summary-status-tag" v-if="statusSummary">{{ statusSummary }}</span>
</span>
<span class="summary-trailing">
@ -127,9 +123,8 @@ const statusSummary = computed(() => {
(toolCall) =>
toolCall.status !== 'success' && toolCall.status !== 'error' && !toolCall.tool_call_result
).length
const errorCount = normalizedToolCalls.value.filter(
(toolCall) => toolCall.status === 'error'
).length
const errorCount = normalizedToolCalls.value.filter((toolCall) => toolCall.status === 'error')
.length
const parts = []
if (successCount > 0 && successCount === normalizedToolCalls.value.length) {

View File

@ -208,7 +208,10 @@
<!-- 部门选择器仅超级管理员可见 -->
<a-form-item v-if="userStore.isSuperAdmin" label="部门" class="form-item">
<a-select v-model:value="userManagement.form.departmentId" placeholder="请选择部门">
<a-select
v-model:value="userManagement.form.departmentId"
placeholder="请选择部门"
>
<a-select-option
v-for="dept in departmentManagement.departments"
:key="dept.id"

View File

@ -167,8 +167,13 @@ const route = useRoute()
const router = useRouter()
// agentStore
const { selectedAgentId, defaultAgentId, selectedAgentConfigId, agentConfigs, isLoadingConfig } =
storeToRefs(agentStore)
const {
selectedAgentId,
defaultAgentId,
selectedAgentConfigId,
agentConfigs,
isLoadingConfig
} = storeToRefs(agentStore)
const syncingRouteThread = ref(false)