Merge branch 'dev' into hugo

# Conflicts:
#	.env.dev
#	.env.shared
#	backend/app/api/chat.py
This commit is contained in:
hugo committed 2026-06-08 16:11:42 +08:00
commit ee90b66ff7
63 files changed
+4786 -1422

No files matched your search

+26 -4
View File
@@ -242,6 +242,8 @@ const draggedSectionIndex = ref<number | null>(null);
// Computed
const isLoggedIn = computed(() => !!currentUser.value && currentUser.value.role !== 'guest');
const hasKnowledgeBaseAccess = computed(() => String(currentUser.value?.username || '').trim().toLowerCase() === 'admin');
const KB_ACCESS_DENIED_MESSAGE = '暂无权限,请登录admin账号操作知识库!';
const favoriteAgents = computed(() => {
return agents.value.filter(a => favoriteAgentIds.value.includes(a.id));
@@ -751,8 +753,9 @@ const isProfileLoading = ref(false);
const isProfileSaving = ref(false);
const isProfileEditing = ref(false);
const showPasswordModal = ref(false);
// TODO(casdoor): set true when Casdoor change-password is ready
const CHANGE_PASSWORD_ENABLED = false;
const CHANGE_PASSWORD_ENABLED = true;
const handleChangePasswordClick = () => {
if (!CHANGE_PASSWORD_ENABLED) {
@@ -979,7 +982,15 @@ const navigateToApplications = () => openWorkspaceSection('favorites', 'applicat
const navigateToUpdates = () => openWorkspaceSection('announcements', 'updates');
const showKnowledgeBaseAccessDenied = () => {
msg.warning(KB_ACCESS_DENIED_MESSAGE);
};
const navigateToKnowledgeBase = () => {
if (!hasKnowledgeBaseAccess.value) {
showKnowledgeBaseAccessDenied();
return;
}
activeSidebarItem.value = 'knowledge_base';
};
@@ -1347,7 +1358,12 @@ onMounted(async () => {
const viewParam = route.query.view as string;
const validViews: string[] = ['profile', 'applications', 'feedback', 'updates', 'knowledge_base', 'schedule_runs', 'shipping_notice', 'history'];
if (viewParam && validViews.includes(viewParam)) {
activeSidebarItem.value = viewParam as typeof activeSidebarItem.value;
if (viewParam === 'knowledge_base' && !hasKnowledgeBaseAccess.value) {
showKnowledgeBaseAccessDenied();
activeSidebarItem.value = 'applications';
} else {
activeSidebarItem.value = viewParam as typeof activeSidebarItem.value;
}
if (viewParam === 'profile' && !profileUser.value.id) {
await fetchProfile();
}
@@ -1361,6 +1377,12 @@ onMounted(async () => {
}
});
watch(hasKnowledgeBaseAccess, (allowed) => {
if (!allowed && activeSidebarItem.value === 'knowledge_base') {
activeSidebarItem.value = 'applications';
}
});
onBeforeUnmount(() => {
window.removeEventListener('hxops:logout', onAuthLogout);
});
@@ -1524,7 +1546,7 @@ onBeforeUnmount(() => {
<div v-else>
<header v-if="isMobile" class="sticky top-0 z-30 flex items-center justify-between border-b border-default bg-surface px-4 py-2.5">
<div class="flex items-center gap-2">
<button @click="navigateToGeneralChat" class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20" :title="$t('workspace.nav.backToChat')">AI</button>
<button @click="navigateToGeneralChat" class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20" :title="$t('workspace.nav.backToChat')">返</button>
<span class="text-sm font-semibold text-primary">{{ mobileTabTitle }}</span>
</div>
</header>
@@ -2323,7 +2345,7 @@ onBeforeUnmount(() => {
</div>
</div>
<!-- Change password modal: re-enable via CHANGE_PASSWORD_ENABLED when Casdoor is ready -->
<!-- Change password modal -->
<div
v-if="CHANGE_PASSWORD_ENABLED && showPasswordModal"
class="dialog-overlay z-50 items-center"