Cross-platform distribution, UI improvements, and performance optimizations
- PyInstaller frozen sidecar: spec file, build script, and ffmpeg path resolver for self-contained distribution without Python prerequisites - Dual-mode sidecar launcher: frozen binary (production) with dev mode fallback - Parallel transcription + diarization pipeline (~30-40% faster) - GPU auto-detection for diarization (CUDA when available) - Async run_pipeline command for real-time progress event delivery - Web Audio API backend for instant playback and seeking - OpenAI-compatible provider replacing LiteLLM client-side routing - Cross-platform RAM detection (Linux/macOS/Windows) - Settings: speaker count hint, token reveal toggles, dark dropdown styling - Loading splash screen, flexbox layout fix for viewport overflow - Gitea Actions CI/CD pipeline (Linux, Windows, macOS ARM) - Updated README and CLAUDE.md documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""LiteLLM provider — multi-provider gateway."""
|
||||
"""OpenAI-compatible provider — works with any OpenAI-compatible API endpoint."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -7,36 +7,44 @@ from typing import Any
|
||||
from voice_to_notes.providers.base import AIProvider
|
||||
|
||||
|
||||
class LiteLLMProvider(AIProvider):
|
||||
"""Routes through LiteLLM for access to 100+ LLM providers."""
|
||||
class OpenAICompatibleProvider(AIProvider):
|
||||
"""Connects to any OpenAI-compatible API (LiteLLM proxy, Ollama, vLLM, etc.)."""
|
||||
|
||||
def __init__(self, model: str = "gpt-4o-mini", **kwargs: Any) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
api_key: str | None = None,
|
||||
api_base: str | None = None,
|
||||
model: str = "gpt-4o-mini",
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
self._api_key = api_key or "sk-no-key"
|
||||
self._api_base = api_base
|
||||
self._model = model
|
||||
self._extra_kwargs = kwargs
|
||||
|
||||
def chat(self, messages: list[dict[str, str]], **kwargs: Any) -> str:
|
||||
try:
|
||||
import litellm
|
||||
except ImportError:
|
||||
raise RuntimeError("litellm package is required. Install with: pip install litellm")
|
||||
from openai import OpenAI
|
||||
|
||||
merged_kwargs = {**self._extra_kwargs, **kwargs}
|
||||
response = litellm.completion(
|
||||
model=merged_kwargs.get("model", self._model),
|
||||
client_kwargs: dict[str, Any] = {"api_key": self._api_key}
|
||||
if self._api_base:
|
||||
client_kwargs["base_url"] = self._api_base
|
||||
|
||||
client = OpenAI(**client_kwargs)
|
||||
response = client.chat.completions.create(
|
||||
model=kwargs.get("model", self._model),
|
||||
messages=messages,
|
||||
temperature=merged_kwargs.get("temperature", 0.7),
|
||||
max_tokens=merged_kwargs.get("max_tokens", 2048),
|
||||
temperature=kwargs.get("temperature", 0.7),
|
||||
max_tokens=kwargs.get("max_tokens", 2048),
|
||||
)
|
||||
return response.choices[0].message.content or ""
|
||||
|
||||
def is_available(self) -> bool:
|
||||
try:
|
||||
import litellm # noqa: F401
|
||||
|
||||
return True
|
||||
import openai # noqa: F401
|
||||
return bool(self._api_key and self._api_base)
|
||||
except ImportError:
|
||||
return False
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "LiteLLM"
|
||||
return "OpenAI Compatible"
|
||||
|
||||
Reference in New Issue
Block a user