mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 05:03:26 +00:00
Implement unified storage architecture
- Replace fragmented storage backends with single IndexedDBStorageBackend - Create multi-store StorageBackend interface (storeName parameter) - Remove old backends: IndexedDBBackend, LocalStorageBackend, SessionIndexedDBBackend, WebExtensionStorageBackend - Remove old repositories: ProviderKeysRepository, SessionRepository, SettingsRepository - Simplify AppStorage to directly expose storage methods (getSetting/setSetting, getProviderKey/setProviderKey) - Create SessionsRepository for session-specific operations - Update all consumers to use new simplified API - Update example app to use new storage architecture - Benefits: 10GB+ quota (vs 10MB chrome.storage), single database, consistent API
This commit is contained in:
parent
b3cce7b400
commit
bbbc232c7c
19 changed files with 421 additions and 998 deletions
|
|
@ -173,7 +173,7 @@ export class AgentInterface extends LitElement {
|
|||
|
||||
// Check if API key exists for the provider (only needed in direct mode)
|
||||
const provider = session.state.model.provider;
|
||||
const apiKey = await getAppStorage().providerKeys.getKey(provider);
|
||||
const apiKey = await getAppStorage().getProviderKey(provider);
|
||||
|
||||
// If no API key, prompt for it
|
||||
if (!apiKey) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export class ProviderKeyInput extends LitElement {
|
|||
|
||||
private async checkKeyStatus() {
|
||||
try {
|
||||
const key = await getAppStorage().providerKeys.getKey(this.provider);
|
||||
const key = await getAppStorage().getProviderKey(this.provider);
|
||||
this.hasKey = !!key;
|
||||
} catch (error) {
|
||||
console.error("Failed to check key status:", error);
|
||||
|
|
@ -51,8 +51,8 @@ export class ProviderKeyInput extends LitElement {
|
|||
if (!model) return false;
|
||||
|
||||
// Check if CORS proxy is enabled and apply it
|
||||
const proxyEnabled = await getAppStorage().settings.get<boolean>("proxy.enabled");
|
||||
const proxyUrl = await getAppStorage().settings.get<string>("proxy.url");
|
||||
const proxyEnabled = await getAppStorage().getSetting<boolean>("proxy.enabled");
|
||||
const proxyUrl = await getAppStorage().getSetting<string>("proxy.url");
|
||||
|
||||
if (proxyEnabled && proxyUrl && model.baseUrl) {
|
||||
model = {
|
||||
|
|
@ -89,7 +89,7 @@ export class ProviderKeyInput extends LitElement {
|
|||
|
||||
if (success) {
|
||||
try {
|
||||
await getAppStorage().providerKeys.setKey(this.provider, this.keyInput);
|
||||
await getAppStorage().setProviderKey(this.provider, this.keyInput);
|
||||
this.hasKey = true;
|
||||
this.keyInput = "";
|
||||
this.requestUpdate();
|
||||
|
|
@ -112,7 +112,7 @@ export class ProviderKeyInput extends LitElement {
|
|||
|
||||
private async removeKey() {
|
||||
try {
|
||||
await getAppStorage().providerKeys.removeKey(this.provider);
|
||||
await getAppStorage().deleteProviderKey(this.provider);
|
||||
this.hasKey = false;
|
||||
this.keyInput = "";
|
||||
this.requestUpdate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue