Download webui/src/features/settings/SettingsContainer.jsx from a3216/ds2api: direct link, hf CLI and curl.
- Browser
- Download file 5.03 kB
-
https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/webui/src/features/settings/SettingsContainer.jsx
- Command line
-
hf download hf://spaces/a3216/ds2api@ce5a019598af8a3a8fa70d3880098df3e850ecd7/webui/src/features/settings/SettingsContainer.jsx
-
curl -L -o SettingsContainer.jsx https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/webui/src/features/settings/SettingsContainer.jsx
5.03 kB
| import { AlertTriangle, Save } from 'lucide-react' | |
| import { useI18n } from '../../i18n' | |
| import { useSettingsForm } from './useSettingsForm' | |
| import SecuritySection from './SecuritySection' | |
| import PlatformSection from './PlatformSection' | |
| import RuntimeSection from './RuntimeSection' | |
| import BehaviorSection from './BehaviorSection' | |
| import CurrentInputFileSection from './CurrentInputFileSection' | |
| import FileAuditSection from './FileAuditSection' | |
| import AutoDeleteSection from './AutoDeleteSection' | |
| import ModelSection from './ModelSection' | |
| import BackupSection from './BackupSection' | |
| export default function SettingsContainer({ onRefresh, onMessage, authFetch, onForceLogout, isVercel = false }) { | |
| const { t } = useI18n() | |
| const apiFetch = authFetch || fetch | |
| const { | |
| form, | |
| setForm, | |
| loading, | |
| saving, | |
| changingPassword, | |
| importing, | |
| exportData, | |
| importMode, | |
| setImportMode, | |
| importText, | |
| setImportText, | |
| newPassword, | |
| setNewPassword, | |
| consecutiveFailures, | |
| autoFetchPaused, | |
| lastError, | |
| settingsMeta, | |
| syncHintVisible, | |
| retryLoadSettings, | |
| saveSettings, | |
| updatePassword, | |
| loadExportData, | |
| downloadExportFile, | |
| loadImportFile, | |
| doImport, | |
| } = useSettingsForm({ | |
| apiFetch, | |
| t, | |
| onMessage, | |
| onRefresh, | |
| onForceLogout, | |
| isVercel, | |
| }) | |
| return ( | |
| <div className="space-y-6"> | |
| {autoFetchPaused && ( | |
| <div className="p-4 rounded-lg border border-destructive/30 bg-destructive/10 text-destructive flex items-center justify-between gap-4"> | |
| <div className="flex items-center gap-2"> | |
| <AlertTriangle className="w-4 h-4" /> | |
| <span className="text-sm"> | |
| {t('settings.autoFetchPaused', { count: consecutiveFailures, error: lastError || t('settings.loadFailed') })} | |
| </span> | |
| </div> | |
| <button | |
| type="button" | |
| onClick={retryLoadSettings} | |
| className="px-3 py-1.5 text-xs rounded-md border border-destructive/40 hover:bg-destructive/10" | |
| > | |
| {t('settings.retryLoad')} | |
| </button> | |
| </div> | |
| )} | |
| {settingsMeta.default_password_warning && ( | |
| <div className="p-4 rounded-lg border border-amber-300/30 bg-amber-500/10 text-amber-700 flex items-center gap-2"> | |
| <AlertTriangle className="w-4 h-4" /> | |
| <span className="text-sm">{t('settings.defaultPasswordWarning')}</span> | |
| </div> | |
| )} | |
| {syncHintVisible && ( | |
| <div className="p-4 rounded-lg border border-amber-300/30 bg-amber-500/10 text-amber-700 flex items-center gap-2"> | |
| <AlertTriangle className="w-4 h-4" /> | |
| <span className="text-sm">{t('settings.vercelSyncHint')}</span> | |
| </div> | |
| )} | |
| <SecuritySection | |
| t={t} | |
| form={form} | |
| setForm={setForm} | |
| newPassword={newPassword} | |
| setNewPassword={setNewPassword} | |
| changingPassword={changingPassword} | |
| onUpdatePassword={updatePassword} | |
| /> | |
| <PlatformSection t={t} form={form} setForm={setForm} /> | |
| <RuntimeSection t={t} form={form} setForm={setForm} /> | |
| <BehaviorSection t={t} form={form} setForm={setForm} /> | |
| <CurrentInputFileSection t={t} form={form} setForm={setForm} /> | |
| <FileAuditSection t={t} form={form} setForm={setForm} /> | |
| <AutoDeleteSection t={t} form={form} setForm={setForm} /> | |
| <ModelSection t={t} form={form} setForm={setForm} /> | |
| <BackupSection | |
| t={t} | |
| importMode={importMode} | |
| setImportMode={setImportMode} | |
| importing={importing} | |
| onLoadExportData={loadExportData} | |
| onDownloadExportFile={downloadExportFile} | |
| onImport={doImport} | |
| onImportFileChange={loadImportFile} | |
| importText={importText} | |
| setImportText={setImportText} | |
| exportData={exportData} | |
| /> | |
| <div className="flex justify-end"> | |
| <button | |
| type="button" | |
| onClick={saveSettings} | |
| disabled={loading || saving} | |
| className="px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 flex items-center gap-2" | |
| > | |
| <Save className="w-4 h-4" /> | |
| {saving ? t('settings.saving') : t('settings.save')} | |
| </button> | |
| </div> | |
| </div> | |
| ) | |
| } | |