Skip to content

feat: add OpenAI-compatible API provider for protocol generation#4

Merged
pasrom merged 7 commits intomainfrom
feat/openai-compatible-provider
Mar 12, 2026
Merged

feat: add OpenAI-compatible API provider for protocol generation#4
pasrom merged 7 commits intomainfrom
feat/openai-compatible-provider

Conversation

@pasrom
Copy link
Copy Markdown
Owner

@pasrom pasrom commented Mar 12, 2026

Summary

  • Refactors ProtocolGenerating protocol to remove claudeBin parameter — provider config is now encapsulated in each implementation
  • Adds ProtocolProvider enum (claudeCLI, openAICompatible) with new AppSettings properties (endpoint, model, API key via KeychainHelper)
  • New OpenAIProtocolGenerator with SSE streaming via URLSession.bytes — supports Ollama, LM Studio, llama.cpp, and any OpenAI-compatible server
  • Settings UI with provider picker, auto-fetched model list from /v1/models, and connection test button
  • Claude CLI remains the default — no behavior change for existing users

Test plan

  • 411 tests pass (25 new tests added)
  • Manual: Settings → Provider picker → switch between Claude CLI and OpenAI-Compatible
  • Manual: OpenAI-Compatible → models auto-fetched on appear (requires running Ollama/LM Studio)
  • Manual: "Fetch Models" button → model picker populates
  • Manual: Switch back to Claude CLI → binary picker visible
  • Manual: Full pipeline with local LLM (Ollama + llama3.1)

@pasrom pasrom force-pushed the feat/openai-compatible-provider branch from 64aafda to 27d471d Compare March 12, 2026 07:50
pasrom added 7 commits March 12, 2026 10:26
Move provider-specific configuration into the provider object.
Rename DefaultProtocolGenerator → ClaudeCLIProtocolGenerator with
claudeBin as a stored property. PipelineQueue no longer carries
claudeBin — it's encapsulated in the generator passed at construction.
Add ProtocolProvider enum (claudeCLI, openAICompatible) and new
AppSettings properties: protocolProvider, openAIEndpoint, openAIModel,
openAIAPIKey (stored via KeychainHelper). Add httpError and
connectionFailed cases to ProtocolError.
HTTP client for OpenAI-compatible APIs (Ollama, LM Studio, llama.cpp).
Uses URLSession.bytes for server-sent event streaming. Includes
testConnection() for the settings UI to verify endpoint reachability.
Add provider picker to Settings with conditional UI: Claude CLI shows
binary picker, OpenAI-Compatible shows endpoint/model/API key fields
and a "Test Connection" button. MeetingTranscriberApp creates the
appropriate ProtocolGenerating implementation based on the selected
provider.
SSE line parsing tests (content extraction, [DONE], empty delta,
invalid JSON, role-only delta). AppSettings tests for new protocol
provider properties (default, persistence, Keychain-backed API key).
SettingsView tests for provider picker and conditional UI rendering.
What: Wider settings window (520px), full-width endpoint field,
model Picker populated from API, auto-fetch on section appear.

Reasoning:
- Problem: Endpoint URL wrapped/overlapped in 480px, model TextField
  showed duplicate placeholder, no model discovery
- Decision: VStack for endpoint (full width), Picker for model when
  models are fetched, auto-fetch via testConnection on appear. Button
  label changes from "Fetch Models" to "Refresh Models" once populated.
  Auto-selects first model if current setting not in fetched list.
What: Replace stored ProtocolGenerating instance with a factory closure
that is called each time a job is processed.

Reasoning:
- Problem: Switching provider in Settings required restarting the watch
  loop because the generator was fixed at PipelineQueue construction
- Decision: protocolGeneratorFactory closure captures current settings,
  evaluated per-job — hot-swapping between Claude CLI and OpenAI works
  without restart
@pasrom pasrom force-pushed the feat/openai-compatible-provider branch from 27d471d to 6bac554 Compare March 12, 2026 09:26
@pasrom pasrom merged commit d9d5f96 into main Mar 12, 2026
1 check passed
@pasrom pasrom deleted the feat/openai-compatible-provider branch March 12, 2026 09:33
@pasrom pasrom added the enhancement New feature or request label Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant