chore(ai): remove env toggle and default AI assistant to settings switch
This commit is contained in:
@@ -30,7 +30,7 @@ const size = computed(() => appStore.size as ComponentSize);
|
||||
const showWatermark = computed(() => settingsStore.showWatermark);
|
||||
const watermarkContent = appConfig.name;
|
||||
|
||||
// 只有在启用 AI 助手且用户已登录时才显示
|
||||
// 只有在用户启用 AI 助手且已登录时才显示
|
||||
// 使用 userInfo 作为响应式依赖,当用户退出登录时会自动更新
|
||||
const enableAiAssistant = computed(() => {
|
||||
const isEnabled = settingsStore.enableAiAssistant;
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<el-switch v-model="settingsStore.colorWeak" />
|
||||
</div>
|
||||
|
||||
<div v-if="aiSystemEnabled" class="config-item flex-x-between">
|
||||
<div class="config-item flex-x-between">
|
||||
<span class="text-xs">AI 助手</span>
|
||||
<el-switch v-model="settingsStore.userEnableAi" />
|
||||
</div>
|
||||
@@ -173,7 +173,7 @@ import { DocumentCopy, RefreshLeft, Check } from "@element-plus/icons-vue";
|
||||
const { t } = useI18n();
|
||||
import { LayoutMode, PageSwitchingAnimationOptions, SidebarColor, ThemeMode } from "@/enums";
|
||||
import { useSettingsStore } from "@/store";
|
||||
import { themeColorPresets, appConfig } from "@/settings";
|
||||
import { themeColorPresets } from "@/settings";
|
||||
|
||||
// 页面切换动画选项
|
||||
const pageSwitchingAnimationOptions: Record<string, OptionItem> = PageSwitchingAnimationOptions;
|
||||
@@ -182,9 +182,6 @@ const pageSwitchingAnimationOptions: Record<string, OptionItem> = PageSwitchingA
|
||||
const copyIcon = markRaw(DocumentCopy);
|
||||
const resetIcon = markRaw(RefreshLeft);
|
||||
|
||||
// AI 系统级开关
|
||||
const aiSystemEnabled = appConfig.aiEnabled;
|
||||
|
||||
// 加载状态
|
||||
const copyLoading = ref(false);
|
||||
const resetLoading = ref(false);
|
||||
|
||||
@@ -18,7 +18,6 @@ export const appConfig = {
|
||||
|
||||
// 功能开关
|
||||
tenantEnabled: env.VITE_APP_TENANT_ENABLED === "true",
|
||||
aiEnabled: env.VITE_ENABLE_AI_ASSISTANT === "true",
|
||||
} as const;
|
||||
|
||||
// ============================================
|
||||
|
||||
@@ -2,7 +2,7 @@ import { SidebarColor, ThemeMode } from "@/enums";
|
||||
import type { LayoutMode } from "@/enums";
|
||||
import { applyTheme, generateThemeColors, toggleDarkMode, toggleSidebarColor } from "@/utils/theme";
|
||||
import { STORAGE_KEYS } from "@/constants";
|
||||
import { appConfig, defaults } from "@/settings";
|
||||
import { defaults } from "@/settings";
|
||||
|
||||
export const useSettingsStore = defineStore("setting", () => {
|
||||
// 界面显示
|
||||
@@ -30,9 +30,9 @@ export const useSettingsStore = defineStore("setting", () => {
|
||||
const grayMode = useStorage(STORAGE_KEYS.GRAY_MODE, false);
|
||||
const colorWeak = useStorage(STORAGE_KEYS.COLOR_WEAK, false);
|
||||
|
||||
// AI 助手:系统级 && 用户级
|
||||
const userEnableAi = useStorage(STORAGE_KEYS.ENABLE_AI_ASSISTANT, false);
|
||||
const enableAiAssistant = computed(() => appConfig.aiEnabled && userEnableAi.value);
|
||||
// AI 助手:用户级开关(默认开启)
|
||||
const userEnableAi = useStorage(STORAGE_KEYS.ENABLE_AI_ASSISTANT, true);
|
||||
const enableAiAssistant = computed(() => userEnableAi.value);
|
||||
|
||||
// 主题变化监听
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user