mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 07:04:25 +00:00
Add Anthropic prompt caching, pluggable storage, and CORS proxy support
Storage Architecture:
- New pluggable storage system with backends (LocalStorage, ChromeStorage, IndexedDB)
- SettingsRepository for app settings (proxy config, etc.)
- ProviderKeysRepository for API key management
- AppStorage with global accessors (getAppStorage, setAppStorage, initAppStorage)
Transport Refactoring:
- Renamed DirectTransport → ProviderTransport (calls LLM providers with optional CORS proxy)
- Renamed ProxyTransport → AppTransport (uses app server with user auth)
- Updated TransportMode: "direct" → "provider", "proxy" → "app"
CORS Proxy Integration:
- ProviderTransport checks proxy.enabled/proxy.url from storage
- When enabled, modifies model baseUrl to route through proxy: {proxyUrl}/?url={originalBaseUrl}
- ProviderKeyInput test function also honors proxy settings
- Settings dialog with Proxy tab (Switch toggle, URL input, explanatory description)
Anthropic Prompt Caching:
- System prompt cached with cache_control markers (both OAuth and regular API keys)
- Last user message cached to cache conversation history
- Saves 90% on input tokens for cached content (10x cost reduction)
Settings Dialog Improvements:
- Configurable tab system with SettingsTab base class
- ApiKeysTab and ProxyTab as custom elements
- Switch toggle for proxy enable (instead of Checkbox)
- Explanatory paragraphs for each tab
- ApiKeyPromptDialog reuses ProviderKeyInput component
Removed:
- Deprecated ApiKeysDialog (replaced by ProviderKeyInput in SettingsDialog)
- Old storage-adapter and key-store (replaced by new storage architecture)
This commit is contained in:
parent
66f092c0c6
commit
0496651308
31 changed files with 1141 additions and 488 deletions
|
|
@ -98,6 +98,16 @@ declare module "@mariozechner/mini-lit" {
|
|||
Download: string;
|
||||
"No logs for {filename}": string;
|
||||
"API Keys Settings": string;
|
||||
Settings: string;
|
||||
"API Keys": string;
|
||||
Proxy: string;
|
||||
"Use CORS Proxy": string;
|
||||
"Proxy URL": string;
|
||||
"Settings are stored locally in your browser": string;
|
||||
Clear: string;
|
||||
"API Key Required": string;
|
||||
"Enter your API key for {provider}": string;
|
||||
"The CORS proxy strips CORS headers from API responses, allowing browser-based apps to make direct calls to LLM providers without CORS restrictions. It forwards requests to providers while removing headers that would otherwise block cross-origin requests.": string;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,6 +212,17 @@ const translations = {
|
|||
Download: "Download",
|
||||
"No logs for {filename}": "No logs for {filename}",
|
||||
"API Keys Settings": "API Keys Settings",
|
||||
Settings: "Settings",
|
||||
"API Keys": "API Keys",
|
||||
Proxy: "Proxy",
|
||||
"Use CORS Proxy": "Use CORS Proxy",
|
||||
"Proxy URL": "Proxy URL",
|
||||
"Settings are stored locally in your browser": "Settings are stored locally in your browser",
|
||||
Clear: "Clear",
|
||||
"API Key Required": "API Key Required",
|
||||
"Enter your API key for {provider}": "Enter your API key for {provider}",
|
||||
"The CORS proxy strips CORS headers from API responses, allowing browser-based apps to make direct calls to LLM providers without CORS restrictions. It forwards requests to providers while removing headers that would otherwise block cross-origin requests.":
|
||||
"The CORS proxy strips CORS headers from API responses, allowing browser-based apps to make direct calls to LLM providers without CORS restrictions. It forwards requests to providers while removing headers that would otherwise block cross-origin requests.",
|
||||
},
|
||||
de: {
|
||||
...defaultGerman,
|
||||
|
|
@ -303,6 +324,17 @@ const translations = {
|
|||
Download: "Herunterladen",
|
||||
"No logs for {filename}": "Keine Logs für {filename}",
|
||||
"API Keys Settings": "API-Schlüssel Einstellungen",
|
||||
Settings: "Einstellungen",
|
||||
"API Keys": "API-Schlüssel",
|
||||
Proxy: "Proxy",
|
||||
"Use CORS Proxy": "CORS-Proxy verwenden",
|
||||
"Proxy URL": "Proxy-URL",
|
||||
"Settings are stored locally in your browser": "Einstellungen werden lokal in Ihrem Browser gespeichert",
|
||||
Clear: "Löschen",
|
||||
"API Key Required": "API-Schlüssel erforderlich",
|
||||
"Enter your API key for {provider}": "Geben Sie Ihren API-Schlüssel für {provider} ein",
|
||||
"The CORS proxy strips CORS headers from API responses, allowing browser-based apps to make direct calls to LLM providers without CORS restrictions. It forwards requests to providers while removing headers that would otherwise block cross-origin requests.":
|
||||
"Der CORS-Proxy entfernt CORS-Header aus API-Antworten und ermöglicht browserbasierte Anwendungen, direkte Aufrufe an LLM-Anbieter ohne CORS-Einschränkungen durchzuführen. Er leitet Anfragen an Anbieter weiter und entfernt Header, die sonst Cross-Origin-Anfragen blockieren würden.",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue