Web UIwebui/storage-and-settings

Storage, Settings, and Discovery

Storage Architecture

Files:

  • webui/storage/app-storage.ts
  • webui/storage/store.ts
  • webui/storage/types.ts
  • webui/storage/backends/indexeddb-storage-backend.ts

AppStorage is a facade over multiple stores and a storage backend. Stores extend the Store base class and use a StorageBackend interface. The default backend is IndexedDB via IndexedDBStorageBackend.

Global helpers:

  • getAppStorage()
  • setAppStorage(storage)

Stores

SettingsStore

Key-value store for app settings. Example keys used by the UI:

  • proxy.enabled
  • proxy.url

ProviderKeysStore

Stores API keys by provider name. Used by AgentInterface to resolve API keys for the active session.

SessionsStore

Persists full session data plus lightweight metadata. Includes helpers for save, load, delete, update title, and latest session ID.

CustomProvidersStore

Stores manual providers and auto-discovery providers. Supported types include:

  • ollama, llama.cpp, vllm, lmstudio
  • openai-completions, openai-responses, anthropic-messages

Model Discovery

File: webui/utils/model-discovery.ts

Discovery helpers:

  • discoverOllamaModels(baseUrl, apiKey)
  • discoverLlamaCppModels(baseUrl, apiKey)
  • discoverVLLMModels(baseUrl, apiKey)

Each function returns Model[] compatible with the AI module.

Proxy Utilities

File: webui/utils/proxy-utils.ts

Helpers:

  • shouldUseProxyForProvider(provider, apiKey)
  • applyProxyIfNeeded(model, apiKey, proxyUrl)
  • createStreamFn(getProxyUrl)

These are used by AgentInterface to handle CORS-sensitive providers in browser contexts.

Auth Token Utilities

File: webui/utils/auth-token.ts

  • getAuthToken() prompts and stores a token in localStorage.
  • clearAuthToken() removes the stored token.