mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 17:00:59 +00:00
AgentInterface sets default streamFn and getApiKey
- Make Agent.streamFn and Agent.getApiKey public - AgentInterface sets defaults if not already set - Example no longer needs to configure these
This commit is contained in:
parent
92898f486b
commit
4d1936d3df
3 changed files with 21 additions and 14 deletions
|
|
@ -8,7 +8,6 @@ import {
|
|||
ChatPanel,
|
||||
CustomProvidersStore,
|
||||
createJavaScriptReplTool,
|
||||
createStreamFn,
|
||||
IndexedDBStorageBackend,
|
||||
// PersistentStorageDialog, // TODO: Fix - currently broken
|
||||
ProviderKeysStore,
|
||||
|
|
@ -177,16 +176,6 @@ Feel free to use these tools when needed to provide accurate and helpful respons
|
|||
},
|
||||
// Custom transformer: convert custom messages to LLM-compatible format
|
||||
convertToLlm: customConvertToLlm,
|
||||
// Get API keys from provider keys store
|
||||
getApiKey: async (provider: string) => {
|
||||
const key = await storage.providerKeys.get(provider);
|
||||
return key ?? undefined;
|
||||
},
|
||||
// Use streamFn with CORS proxy support (reads settings on each call)
|
||||
streamFn: createStreamFn(async () => {
|
||||
const enabled = await storage.settings.get<boolean>("proxy.enabled");
|
||||
return enabled ? (await storage.settings.get<string>("proxy.url")) || undefined : undefined;
|
||||
}),
|
||||
});
|
||||
|
||||
agentUnsubscribe = agent.subscribe((event: any) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue