You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
823 B
TypeScript
30 lines
823 B
TypeScript
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
import { personalAssistantAgent } from "./agents/personalAssistant.js";
|
|
import { chefAgent } from "./agents/chef.js";
|
|
import { Agent } from "./types.js";
|
|
|
|
// This declaration is primarily for providing type hints in your code
|
|
interface Env {
|
|
OPENROUTER_API_KEY: string;
|
|
}
|
|
|
|
declare global {
|
|
const env: Env;
|
|
}
|
|
|
|
// Create OpenRouter instance
|
|
export const openrouter = createOpenRouter({
|
|
apiKey: import.meta.env.VITE_OPENROUTER_API_KEY || env.OPENROUTER_API_KEY,
|
|
});
|
|
|
|
// Define the agents by ID
|
|
export const agentsById: Record<string, Agent> = {
|
|
"personal-assistant": personalAssistantAgent,
|
|
chef: chefAgent,
|
|
};
|
|
|
|
// Helper function to get an agent by ID
|
|
export function getAgentById(agentId: string): Agent | undefined {
|
|
return agentsById[agentId];
|
|
}
|