Skip to content

Trial mode API settings are saved/read under inconsistent localStorage keys #14

@Anionex

Description

@Anionex

Summary

In trial mode (no logged-in user), saving API settings in the frontend can succeed visually, but generating a mind map still shows:

请先在设置中配置 API URL 和 API Key

I confirmed this on the latest upstream origin/main as of 2026-03-30:

  • commit: 025f39828dade791d527e8dd3e9db6df1e84b49f

Reproduction

  1. Start the app in trial mode (Supabase not configured / not logged in).
  2. Open Settings and save API URL + API Key.
  3. Go to a notebook, select files, click Generate Mind Map.
  4. The UI still warns that API settings are missing.

Expected

The saved API settings should be reused consistently across Dashboard, Settings modal, and NotebookView actions in trial mode.

Actual

Different parts of the frontend read/write different localStorage keys for trial-mode users, so the config is effectively "saved" in one place and "missing" in another.

Root Cause

The trial-mode user identity is inconsistent across pages/components:

  • Settings modal uses default
  • Dashboard uses local
  • Some generation paths use null -> global

That leads to inconsistent storage keys under kb_api_settings_*.

Relevant code paths:

  • frontend_zh/src/components/SettingsModal.tsx
  • frontend_zh/src/pages/Dashboard.tsx
  • frontend_zh/src/pages/NotebookView.tsx
  • same pattern also exists in frontend_en/

Suggested Fix

Unify trial-mode settings storage so default / local / global resolve to the same logical settings bucket, or standardize all trial-mode callers on a single key.

Impact

  • Mind map generation in trial mode
  • Other features that require frontend-stored API settings may also be affected
  • Both Chinese and English frontends appear affected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions