Commit graph

7 commits

Author SHA1 Message Date
fancivez
e4b2ae3e22 refactor(settings): collapsible sections + smart auto-expand
The settings tab listed ~23 entries on first paint (API mode), most of
which the typical user never touches. Restructured into 5 sections,
of which only the first two are expanded by default.

Sections (default visibility):
- Quick setup (open):     backend / provider preset / credential / model / test
- Reading output (open):  prompt language / card range / export folder / UI lang
- Advanced connection:    api format / base URL / auth type / headers /
                          max tokens / streaming + timeout merged
- Advanced prompt:        max input chars / custom system prompt
- Cache & maintenance:    max entries / clear-all

First-paint count drops from ~23 to ~9 rows.

Smart auto-expand: Advanced connection opens automatically when the
user has departed from preset defaults — custom-* provider, custom
headers, non-default base URL, non-auto auth type, streaming=false,
non-default max tokens, or api format mismatching preset. Same idea
for Advanced prompt (custom prompt or non-default max input chars)
and CLI advanced (non-default cli timeout). Old users find their
configured values without manual digging.

Other simplifications:
- API key + env var fallback combined into one row. The env var input
  lives behind a tiny details/summary disclosure and is built with
  raw DOM (label + input) instead of a nested `new Setting` to avoid
  Obsidian theme CSS conflicts on .setting-item.
- Provider preset row gains an inline read-only summary of the
  derived API format and base URL, replacing the standalone rows
  for those two fields under built-in presets.
- Streaming toggle and streaming timeout are now one row; the
  timeout input is wrapped in its own div and toggled visible only
  when streaming is on.

No data.json changes — every settings key keeps its existing name and
default value. Existing installs upgrade with zero migration.

styles.css: add scoped classes for the collapsible sections, env-var
inline row, timeout inline input, and a generic .parallel-reader-hidden.
i18n: 7 new keys × zh+en for section headings + summary fallbacks.

Codex review pass:
- shouldOpenAdvancedConnection now also reacts to streaming=false /
  non-default apiMaxTokens / apiFormat ≠ preset.format.
- streaming + timeout merged row hides a dedicated wrapper instead of
  inputEl.parentElement (which on some themes shares the controlEl
  with the toggle).
- env-var fallback no longer nests `new Setting` inside a controlEl.
- "(no base url)" placeholder in the preset summary is now i18n'd.

Change-Id: I8ef11c56a89121df13a630b1c724652e78b4069f
2026-05-02 15:54:43 +08:00
wujunchen
abce923f14 fix: salvage truncated LLM JSON and make errors copyable
- Add repairTruncatedCardsJson to recover complete cards when output
  is cut off mid-card (e.g. token limit reached)
- Log raw LLM response to console on parse failure for debugging
- Make error panel text selectable and add "copy error" button

Change-Id: I4e76121138888234d42f84f3695cbbfd6beba886
2026-04-27 11:56:40 +08:00
wujunchen
6e83d216c2 feat: add generate button to empty state panel
When a note has no cached parallel notes, the empty state now shows a
clickable "Generate" button so users can trigger generation directly
without going through the command palette. Closes #2.

Change-Id: I879897168ef77c44e0ab570e9c094fa9af9f66d4
2026-04-27 10:24:05 +08:00
wujunchen
447ad1414b feat: add streaming API responses for OpenAI Chat and Anthropic
Implement SSE streaming for API backends that support it (OpenAI Chat
Completions and Anthropic Messages). During generation the view shows
a live streaming preview with accumulated text. Adds a streaming toggle
in settings (enabled by default). Non-streaming-capable formats (Gemini,
OpenAI Responses) and CLI backends continue using the existing path.

Change-Id: I3361a5ca5aec3e25a7d16e4fb585185f6fc0695e
2026-04-26 09:30:51 +08:00
wujunchen
5c2c97fdbe feat: improve reader cache and card UX
Change-Id: Ie1b5c5ba1a6538b701af2591effd1845dca2f670
2026-04-25 19:44:39 +08:00
wujunchen
1fada9f472 feat: add TypeScript build and provider architecture
Introduce an esbuild/TypeScript source layout while keeping the generated Obsidian main.js entrypoint. Add provider-format adapters, structured-output requests, settings-aware bounded cache, prompt controls, concurrency guards, and regression tests.

Change-Id: I8ecbc4c6eff3925249778732bd75747619b818e4
2026-04-25 14:12:17 +08:00
wujunchen
ff856f719b init: Obsidian Parallel Reader v0.1.0
Split-view reading plugin for long-form notes:
- LLM self-adaptive segmentation (no heading dependency)
- Anchor-based line resolution with fallbacks
- Scroll-sync highlight + click-to-jump
- Right-click context menu for copy actions
- MarkdownRenderer for native table/bold/code rendering
- SHA-1 content-hash cache with stale-detection banner
- Three backends: Claude Code CLI / Codex CLI / Anthropic API

Change-Id: I105c57e3df0b2d8d1570c31e3e3a689ecf52ff71
2026-04-24 19:31:23 +08:00