Download packages/data-schemas/src/app/interface.ts from helloya20/chat: direct link, hf CLI and curl.
- Browser
- Download file 2.76 kB
-
https://huggingface.co/spaces/helloya20/chat/resolve/main/packages/data-schemas/src/app/interface.ts
- Command line
-
hf download hf://spaces/helloya20/chat/packages/data-schemas/src/app/interface.ts
-
curl -L -o interface.ts https://huggingface.co/spaces/helloya20/chat/resolve/main/packages/data-schemas/src/app/interface.ts
2.76 kB
| import { removeNullishValues } from 'librechat-data-provider'; | |
| import type { TCustomConfig, TConfigDefaults } from 'librechat-data-provider'; | |
| import type { AppConfig } from '~/types/app'; | |
| import { isMemoryEnabled } from './memory'; | |
| /** | |
| * Loads the default interface object. | |
| * @param params - The loaded custom configuration. | |
| * @param params.config - The loaded custom configuration. | |
| * @param params.configDefaults - The custom configuration default values. | |
| * @returns default interface object. | |
| */ | |
| export async function loadDefaultInterface({ | |
| config, | |
| configDefaults, | |
| }: { | |
| config?: Partial<TCustomConfig>; | |
| configDefaults: TConfigDefaults; | |
| }): Promise<AppConfig['interfaceConfig']> { | |
| const { interface: interfaceConfig } = config ?? {}; | |
| const { interface: defaults } = configDefaults; | |
| const hasModelSpecs = (config?.modelSpecs?.list?.length ?? 0) > 0; | |
| const includesAddedEndpoints = (config?.modelSpecs?.addedEndpoints?.length ?? 0) > 0; | |
| const memoryConfig = config?.memory; | |
| const memoryEnabled = isMemoryEnabled(memoryConfig); | |
| /** Only disable memories if memory config is present but disabled/invalid */ | |
| const shouldDisableMemories = memoryConfig && !memoryEnabled; | |
| const loadedInterface: AppConfig['interfaceConfig'] = removeNullishValues({ | |
| // UI elements - use schema defaults | |
| endpointsMenu: | |
| interfaceConfig?.endpointsMenu ?? (hasModelSpecs ? false : defaults.endpointsMenu), | |
| modelSelect: | |
| interfaceConfig?.modelSelect ?? | |
| (hasModelSpecs ? includesAddedEndpoints : defaults.modelSelect), | |
| parameters: interfaceConfig?.parameters ?? (hasModelSpecs ? false : defaults.parameters), | |
| presets: interfaceConfig?.presets ?? (hasModelSpecs ? false : defaults.presets), | |
| sidePanel: interfaceConfig?.sidePanel ?? defaults.sidePanel, | |
| privacyPolicy: interfaceConfig?.privacyPolicy ?? defaults.privacyPolicy, | |
| termsOfService: interfaceConfig?.termsOfService ?? defaults.termsOfService, | |
| mcpServers: interfaceConfig?.mcpServers ?? defaults.mcpServers, | |
| customWelcome: interfaceConfig?.customWelcome ?? defaults.customWelcome, | |
| // Permissions - only include if explicitly configured | |
| bookmarks: interfaceConfig?.bookmarks, | |
| memories: shouldDisableMemories ? false : interfaceConfig?.memories, | |
| prompts: interfaceConfig?.prompts, | |
| multiConvo: interfaceConfig?.multiConvo, | |
| agents: interfaceConfig?.agents, | |
| temporaryChat: interfaceConfig?.temporaryChat, | |
| runCode: interfaceConfig?.runCode, | |
| webSearch: interfaceConfig?.webSearch, | |
| fileSearch: interfaceConfig?.fileSearch, | |
| fileCitations: interfaceConfig?.fileCitations, | |
| peoplePicker: interfaceConfig?.peoplePicker, | |
| marketplace: interfaceConfig?.marketplace, | |
| }); | |
| return loadedInterface; | |
| } | |