forked from stackblitz/bolt.new
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let the ollama models be auto generated from ollama api #5
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { json } from '@remix-run/cloudflare'; | ||
import { MODEL_LIST } from '~/utils/constants'; | ||
|
||
export async function loader() { | ||
return json(MODEL_LIST); | ||
} |
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,40 +1,57 @@ | ||
import type { ModelInfo } from './types'; | ||
|
||
export const WORK_DIR_NAME = 'project'; | ||
export const WORK_DIR = `/home/${WORK_DIR_NAME}`; | ||
export const MODIFICATIONS_TAG_NAME = 'bolt_file_modifications'; | ||
export const MODEL_REGEX = /^\[Model: (.*?)\]\n\n/; | ||
export const DEFAULT_MODEL = "claude-3-5-sonnet-20240620"; | ||
export const DEFAULT_PROVIDER = "Anthropic"; | ||
export const MODEL_LIST = [ | ||
{ name: 'claude-3-5-sonnet-20240620', label: 'Claude 3.5 Sonnet', provider: 'Anthropic' }, | ||
{ name: 'gemini-1.5-flash-latest', label: 'Gemini 1.5 Flash', provider: 'Google' }, | ||
{ name: 'gemini-1.5-pro-latest', label: 'Gemini 1.5 Pro', provider: 'Google'}, | ||
{ name: 'gpt-4o', label: 'GPT-4o', provider: 'OpenAI' }, | ||
{ name: 'gpt-4o-mini', label: 'GPT-4o Mini', provider: 'OpenAI' }, | ||
{ name: 'gpt-4-turbo', label: 'GPT-4 Turbo', provider: 'OpenAI' }, | ||
{ name: 'gpt-4', label: 'GPT-4', provider: 'OpenAI' }, | ||
{ name: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo', provider: 'OpenAI' }, | ||
{ name: 'qwen2.5-coder:7b', label: 'Qwen 2.5 Coder 7b', provider: 'Ollama' }, | ||
{ name: 'qwen2.5-coder:1.5b', label: 'Qwen 2.5 Coder 1.5b', provider: 'Ollama' }, | ||
{ name: 'deepseek-coder-v2:236b', label: 'DeepSeek-Coder-V2 236b', provider: 'Ollama' }, | ||
{ name: 'deepseek-coder-v2:16b', label: 'DeepSeek-Coder-V2 16b', provider: 'Ollama' }, | ||
{ name: 'codebooga', label: 'Codebooga 34b', provider: 'Ollama' }, | ||
{ name: 'phind-codellama', label: 'Phind CodeLlama 34b', provider: 'Ollama' }, | ||
{ name: 'codellama:70b', label: 'Code Llama 70b', provider: 'Ollama' }, | ||
{ name: 'codellama:34b', label: 'Code Llama 34b', provider: 'Ollama' }, | ||
{ name: 'codellama:13b', label: 'Code Llama 13b', provider: 'Ollama' }, | ||
{ name: 'codellama:7b', label: 'Code Llama 7b', provider: 'Ollama' }, | ||
{ name: 'deepseek/deepseek-coder', label: 'Deepseek-Coder V2 236B (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'google/gemini-flash-1.5', label: 'Google Gemini Flash 1.5 (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'google/gemini-pro-1.5', label: 'Google Gemini Pro 1.5 (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'mistralai/mistral-nemo', label: 'OpenRouter Mistral Nemo (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'qwen/qwen-110b-chat', label: 'OpenRouter Qwen 110b Chat (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'cohere/command', label: 'Cohere Command (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'llama-3.1-70b-versatile', label: 'Llama 3.1 70b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.1-8b-instant', label: 'Llama 3.1 8b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.2-11b-vision-preview', label: 'Llama 3.2 11b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.2-3b-preview', label: 'Llama 3.2 3b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.2-1b-preview', label: 'Llama 3.2 1b (Groq)', provider: 'Groq' }, | ||
{ name: 'claude-3-opus-20240229', label: 'Claude 3 Opus', provider: 'Anthropic' }, | ||
{ name: 'claude-3-sonnet-20240229', label: 'Claude 3 Sonnet', provider: 'Anthropic' }, | ||
{ name: 'claude-3-haiku-20240307', label: 'Claude 3 Haiku', provider: 'Anthropic' }, | ||
export const DEFAULT_MODEL = 'claude-3-5-sonnet-20240620'; | ||
export const DEFAULT_PROVIDER = 'Anthropic'; | ||
|
||
const staticModels: ModelInfo[] = [ | ||
{ name: 'claude-3-5-sonnet-20240620', label: 'Claude 3.5 Sonnet', provider: 'Anthropic' }, | ||
{ name: 'gpt-4o', label: 'GPT-4o', provider: 'OpenAI' }, | ||
{ name: 'deepseek/deepseek-coder', label: 'Deepseek-Coder V2 236B (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'google/gemini-flash-1.5', label: 'Google Gemini Flash 1.5 (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'google/gemini-pro-1.5', label: 'Google Gemini Pro 1.5 (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'mistralai/mistral-nemo', label: 'OpenRouter Mistral Nemo (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'qwen/qwen-110b-chat', label: 'OpenRouter Qwen 110b Chat (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'cohere/command', label: 'Cohere Command (OpenRouter)', provider: 'OpenRouter' }, | ||
{ name: 'gemini-1.5-flash-latest', label: 'Gemini 1.5 Flash', provider: 'Google' }, | ||
{ name: 'gemini-1.5-pro-latest', label: 'Gemini 1.5 Pro', provider: 'Google'}, | ||
{ name: 'llama-3.1-70b-versatile', label: 'Llama 3.1 70b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.1-8b-instant', label: 'Llama 3.1 8b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.2-11b-vision-preview', label: 'Llama 3.2 11b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.2-3b-preview', label: 'Llama 3.2 3b (Groq)', provider: 'Groq' }, | ||
{ name: 'llama-3.2-1b-preview', label: 'Llama 3.2 1b (Groq)', provider: 'Groq' }, | ||
{ name: 'claude-3-opus-20240229', label: 'Claude 3 Opus', provider: 'Anthropic' }, | ||
{ name: 'claude-3-sonnet-20240229', label: 'Claude 3 Sonnet', provider: 'Anthropic' }, | ||
{ name: 'claude-3-haiku-20240307', label: 'Claude 3 Haiku', provider: 'Anthropic' }, | ||
{ name: 'gpt-4o-mini', label: 'GPT-4o Mini', provider: 'OpenAI' }, | ||
{ name: 'gpt-4-turbo', label: 'GPT-4 Turbo', provider: 'OpenAI' }, | ||
{ name: 'gpt-4', label: 'GPT-4', provider: 'OpenAI' }, | ||
{ name: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo', provider: 'OpenAI' }, | ||
]; | ||
|
||
export let MODEL_LIST: ModelInfo[] = [...staticModels]; | ||
|
||
async function getOllamaModels(): Promise<ModelInfo[]> { | ||
try { | ||
const response = await fetch(`http://localhost:11434/api/tags`); | ||
const data = await response.json(); | ||
|
||
return data.models.map((model: any) => ({ | ||
name: model.name, | ||
label: `${model.name} (${model.details.parameter_size})`, | ||
provider: 'Ollama', | ||
})); | ||
} catch (e) { | ||
return []; | ||
} | ||
} | ||
|
||
async function initializeModelList(): Promise<void> { | ||
const ollamaModels = await getOllamaModels(); | ||
MODEL_LIST = [...ollamaModels, ...staticModels]; | ||
} | ||
initializeModelList().then(); | ||
export { getOllamaModels, initializeModelList }; |
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,28 @@ | ||
|
||
interface OllamaModelDetails { | ||
parent_model: string; | ||
format: string; | ||
family: string; | ||
families: string[]; | ||
parameter_size: string; | ||
quantization_level: string; | ||
} | ||
|
||
interface OllamaModel { | ||
name: string; | ||
model: string; | ||
modified_at: string; | ||
size: number; | ||
digest: string; | ||
details: OllamaModelDetails; | ||
} | ||
|
||
export interface OllamaApiResponse { | ||
models: OllamaModel[]; | ||
} | ||
|
||
export interface ModelInfo { | ||
name: string; | ||
label: string; | ||
provider: string; | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, there is a hardcoded ref to localhost instead of using the .env.