Skip to content

Commit

Permalink
Add OpenRouter + other minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicoptima committed Sep 4, 2024
1 parent 6dc19e3 commit 0aee3e1
Show file tree
Hide file tree
Showing 5 changed files with 1,975 additions and 1,451 deletions.
28 changes: 20 additions & 8 deletions common.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
export const PROVIDERS = ["cohere", "textsynth", "ocp", "openai", "openai-chat", "azure", "azure-chat", "anthropic"];
export const PROVIDERS = [
"cohere",
"textsynth",
"openai-compat",
"openai",
"openai-chat",
"azure",
"azure-chat",
"anthropic",
"openrouter",
];
export type Provider = (typeof PROVIDERS)[number];

type ProviderProps = {
"openai": { organization: string };
openai: { organization: string };
"openai-chat": { organization: string };
"ocp": { url: string };
"azure": { url: string };
"openai-compat": { url: string };
azure: { url: string };
"azure-chat": { url: string };
"anthropic": { url: string };//, systemPrompt: string, userMessage: string };
anthropic: { url: string };
openrouter: { quantization: string };
};

type SharedPresetSettings = {
Expand All @@ -18,7 +29,8 @@ type SharedPresetSettings = {
apiKey: string;
};

export type ModelPreset<P extends Provider> = SharedPresetSettings & (P extends keyof ProviderProps ? ProviderProps[P] : {}) & { provider: P };
export type ModelPreset<P extends Provider> = SharedPresetSettings &
(P extends keyof ProviderProps ? ProviderProps[P] : {}) & { provider: P };

export interface LoomSettings {
passageFolder: string;
Expand Down Expand Up @@ -46,10 +58,10 @@ export interface LoomSettings {
showSearchBar: boolean;
showNodeBorders: boolean;
showExport: boolean;

}

export const getPreset = (settings: LoomSettings) => settings.modelPresets[settings.modelPreset];
export const getPreset = (settings: LoomSettings) =>
settings.modelPresets[settings.modelPreset];

export type SearchResultState = "result" | "ancestor" | "none" | null;

Expand Down
Loading

0 comments on commit 0aee3e1

Please sign in to comment.