Page - Settings

abstract

Settings dashboard for configuring AI providers (API keys, active model), RAG parameters (top-k, score threshold), storage management (clear vector DB / chat history), and UI preferences. All settings persist to the appsetting PostgreSQL table via PUT /api/v1/settings.


Route

PropertyValue
Path/settings
Filefrontend/src/app/settings/page.tsx
Auth RequiredNo
Layoutfrontend/src/app/layout.tsx
Dynamic SegmentNone

Component Tree

RootLayout (layout.tsx)
└── ThemeProvider
    └── SidebarProvider
        ├── AppSidebar
        └── SidebarInset
            └── header (h-12, border-b)   ← "Settings" title
                └── div.max-w-2xl.space-y-6
                    ├── AiProvidersSettings   ← provider selector + API keys + test connection
                    ├── RagSettings           ← top_k, score_threshold inputs
                    ├── StorageSettings       ← clear vector DB, clear chat history
                    └── PreferencesSettings   ← UI preferences (theme, etc.)

Data Layer

Server State (per component)

ComponentEndpointPurpose
AiProvidersSettingsGET /api/v1/settings, PUT /api/v1/settings, POST /api/v1/settings/test-connectionLoad/save API keys + test connectivity
RagSettingsGET /api/v1/settings, PUT /api/v1/settingsLoad/save rag_top_k, rag_score_threshold
StorageSettingsDELETE /api/v1/data/vector, DELETE /api/v1/data/chatClear vector store or chat history
PreferencesSettingsLocal only (ThemeProvider)No API calls — theme stored in browser

Local State (within setting components)

VariableTypePurpose
isSavingbooleanDisable save button during PUT request
isTestingbooleanDisable test button during POST request
isClearingbooleanDisable clear button during DELETE request

Page Lifecycle


Render Conditions

ConditionResult
API key has a saved valueInput shows "****" — never plaintext
isTesting === true"Test Connection" button shows spinner
Storage clear triggeredConfirmation dialog before DELETE

RoleLink
Settings API (read)API-GET-v1-settings
Settings API (write)API-PUT-v1-settings
Connection test APIAPI-POST-v1-settings-test-connection
Storage clear APIAPI-DELETE-v1-data-vector, API-DELETE-v1-data-chat
Settings DB tableDB - appsetting