-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from midday-ai/ollama-suport
Ollama suport
- Loading branch information
Showing
26 changed files
with
223 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
export default { | ||
hello: "Bonjour", | ||
welcome: "Bonjour {name} !", | ||
"about.you": "Bonjour {name} ! Tu as {age} ans", | ||
"scope.test": "Un domaine", | ||
"scope.more.test": "Un domaine", | ||
"scope.more.param": "Un domaine avec {param}", | ||
"scope.more.and.more.test": "Un domaine", | ||
welcome: "Bonjour {name}!", | ||
"about.you": "Bonjour {name}! Vous avez {age} ans", | ||
"scope.test": "Un scope", | ||
"scope.more.test": "Un scope", | ||
"scope.more.param": "Un scope avec {param}", | ||
"scope.more.and.more.test": "Un scope", | ||
"scope.more.stars#one": "1 étoile sur GitHub", | ||
"scope.more.stars#other": "{count} étoiles sur GitHub", | ||
"missing.translation.in.fr": "Cela devrait fonctionner", | ||
"cows#one": "Une vache", | ||
"cows#other": "{count} vaches", | ||
"languine.hello": "Hello Languine", | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import dotenv from "dotenv"; | ||
dotenv.config(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { outro } from "@clack/prompts"; | ||
import chalk from "chalk"; | ||
import ollama from "ollama"; | ||
import type { Provider } from "./types.js"; | ||
|
||
type ModelInfo = { | ||
value: string; | ||
label: string; | ||
}; | ||
|
||
type ProviderConfig = { | ||
value: Provider; | ||
label: string; | ||
getModels: () => Promise<ModelInfo[]>; | ||
}; | ||
|
||
export const providers: Record<Provider, ProviderConfig> = { | ||
openai: { | ||
value: "openai", | ||
label: "OpenAI", | ||
getModels: async () => [ | ||
{ value: "gpt-4-turbo", label: "GPT-4 Turbo (Default)" }, | ||
{ value: "gpt-4", label: "GPT-4" }, | ||
{ value: "gpt-4o", label: "GPT-4o" }, | ||
{ value: "gpt-4o-mini", label: "GPT-4o mini" }, | ||
{ value: "gpt-3.5-turbo", label: "GPT-3.5 Turbo" }, | ||
], | ||
}, | ||
ollama: { | ||
value: "ollama", | ||
label: "Ollama", | ||
getModels: async () => { | ||
try { | ||
const { models } = await ollama.list(); | ||
|
||
return models.map((model) => ({ | ||
value: model.name, | ||
label: model.name, | ||
})); | ||
} catch { | ||
outro( | ||
chalk.red( | ||
"Failed to get models from Ollama, is it installed and running?", | ||
), | ||
); | ||
process.exit(1); | ||
} | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.