mirror of
https://github.com/EKKOLearnAI/hermes-web-ui.git
synced 2026-05-26 22:10:15 +00:00
1abe308742
- Display persistent warning bar when Node.js version < 23 - Fix provider model fetching to support non-v1 API versions (e.g. /v4) - Add v0.4.4 changelog entries to frontend - Bump version to 0.4.4 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
120 lines
3.2 KiB
Vue
120 lines
3.2 KiB
Vue
<script setup lang="ts">
|
|
import { onMounted, onUnmounted, computed, ref, watch } from 'vue'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { darkTheme, NConfigProvider, NMessageProvider, NDialogProvider, NNotificationProvider } from 'naive-ui'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { getThemeOverrides } from '@/styles/theme'
|
|
import { useTheme } from '@/composables/useTheme'
|
|
import AppSidebar from '@/components/layout/AppSidebar.vue'
|
|
import { useKeyboard } from '@/composables/useKeyboard'
|
|
import { useAppStore } from '@/stores/hermes/app'
|
|
import SessionSearchModal from '@/components/hermes/chat/SessionSearchModal.vue'
|
|
|
|
const { isDark } = useTheme()
|
|
const { t } = useI18n()
|
|
const appStore = useAppStore()
|
|
const route = useRoute()
|
|
const router = useRouter()
|
|
const ready = ref(false)
|
|
|
|
const themeOverrides = computed(() => getThemeOverrides(isDark.value))
|
|
const naiveTheme = computed(() => isDark.value ? darkTheme : null)
|
|
|
|
const isLoginPage = computed(() => route.name === 'login')
|
|
|
|
const nodeVersionLow = computed(() => {
|
|
const v = appStore.nodeVersion
|
|
const major = parseInt(v.split('.')[0], 10)
|
|
return !isNaN(major) && major < 23
|
|
})
|
|
|
|
// Close mobile sidebar on route change
|
|
watch(() => route.path, () => {
|
|
appStore.closeSidebar()
|
|
})
|
|
|
|
// Wait for router to resolve before rendering layout
|
|
router.isReady().then(() => {
|
|
ready.value = true
|
|
})
|
|
|
|
onMounted(() => {
|
|
if (!isLoginPage.value) {
|
|
appStore.loadModels()
|
|
appStore.startHealthPolling()
|
|
}
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
appStore.stopHealthPolling()
|
|
})
|
|
|
|
useKeyboard()
|
|
</script>
|
|
|
|
<template>
|
|
<NConfigProvider :theme="naiveTheme" :theme-overrides="themeOverrides">
|
|
<NMessageProvider>
|
|
<NDialogProvider>
|
|
<NNotificationProvider>
|
|
<div v-if="nodeVersionLow && ready" class="node-warning-bar">
|
|
{{ t('sidebar.nodeVersionWarning', { version: appStore.nodeVersion }) }}
|
|
</div>
|
|
<div v-if="ready" class="app-layout" :class="{ 'no-sidebar': isLoginPage }">
|
|
<button v-if="!isLoginPage" class="hamburger-btn" @click="appStore.toggleSidebar">
|
|
<img src="/logo.png" alt="Menu" style="width: 24px; height: 24px;" />
|
|
</button>
|
|
<div v-if="!isLoginPage && appStore.sidebarOpen" class="mobile-backdrop" @click="appStore.closeSidebar" />
|
|
<AppSidebar v-if="!isLoginPage" />
|
|
<main class="app-main">
|
|
<router-view />
|
|
</main>
|
|
</div>
|
|
<SessionSearchModal />
|
|
</NNotificationProvider>
|
|
</NDialogProvider>
|
|
</NMessageProvider>
|
|
</NConfigProvider>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
@use '@/styles/variables' as *;
|
|
|
|
.app-layout {
|
|
display: flex;
|
|
height: calc(100 * var(--vh));
|
|
width: 100vw;
|
|
overflow: hidden;
|
|
|
|
&.no-sidebar {
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
.app-main {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
background-color: $bg-primary;
|
|
|
|
.no-sidebar & {
|
|
height: calc(100 * var(--vh));
|
|
}
|
|
}
|
|
|
|
.node-warning-bar {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
z-index: 100;
|
|
padding: 4px 16px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
color: #b45309;
|
|
background-color: #fef3c7;
|
|
border-bottom: 1px solid #fde68a;
|
|
text-align: center;
|
|
line-height: 1.4;
|
|
}
|
|
</style>
|