feat: profile-aware cache isolation and UX improvements
- Fix chat store cache keys to include profile name, prevent data leaking between profiles - Defer cache hydration to after profile load to avoid race condition - Remove collapsible sidebar feature (not needed) - Remove confirmation dialog on profile switch (direct reload) - Auto-start gateway when creating new profile - Clear profile-specific localStorage cache on profile delete (safe prefix matching) - Clean up unused imports in SettingsView Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,16 @@ import { onMounted } from 'vue'
|
||||
import ChatPanel from '@/components/hermes/chat/ChatPanel.vue'
|
||||
import { useAppStore } from '@/stores/hermes/app'
|
||||
import { useChatStore } from '@/stores/hermes/chat'
|
||||
import { useProfilesStore } from '@/stores/hermes/profiles'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const chatStore = useChatStore()
|
||||
const profilesStore = useProfilesStore()
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
appStore.loadModels()
|
||||
// 先加载 profile,确保缓存 key 使用正确的 profile name
|
||||
await profilesStore.fetchProfiles()
|
||||
chatStore.loadSessions()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -4,10 +4,6 @@ import {
|
||||
NTabs,
|
||||
NTabPane,
|
||||
NSpin,
|
||||
NSwitch,
|
||||
NInput,
|
||||
NInputNumber,
|
||||
useMessage,
|
||||
} from "naive-ui";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useSettingsStore } from "@/stores/hermes/settings";
|
||||
@@ -16,23 +12,13 @@ import AgentSettings from "@/components/hermes/settings/AgentSettings.vue";
|
||||
import MemorySettings from "@/components/hermes/settings/MemorySettings.vue";
|
||||
import SessionSettings from "@/components/hermes/settings/SessionSettings.vue";
|
||||
import PrivacySettings from "@/components/hermes/settings/PrivacySettings.vue";
|
||||
import SettingRow from "@/components/hermes/settings/SettingRow.vue";
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
const message = useMessage();
|
||||
const { t } = useI18n();
|
||||
|
||||
onMounted(() => {
|
||||
settingsStore.fetchSettings();
|
||||
});
|
||||
async function saveApiServer(values: Record<string, any>) {
|
||||
try {
|
||||
await settingsStore.saveSection("platforms", { api_server: values });
|
||||
message.success(t("settings.saved"));
|
||||
} catch (err: any) {
|
||||
message.error(t("settings.saveFailed"));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user