Skip to content

Commit 69c58c1

Browse files
authored
Merge branch 'main' into bolt-shell-race-condition
2 parents e9e7857 + 296e5d9 commit 69c58c1

File tree

18 files changed

+404
-441
lines changed

18 files changed

+404
-441
lines changed

FAQ.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
# bolt.diy
44

5+
## Recommended Models for bolt.diy
6+
7+
For the best experience with bolt.diy, we recommend using the following models:
8+
9+
- **Claude 3.5 Sonnet (old)**: Best overall coder, providing excellent results across all use cases
10+
- **Gemini 2.0 Flash**: Exceptional speed while maintaining good performance
11+
- **GPT-4o**: Strong alternative to Claude 3.5 Sonnet with comparable capabilities
12+
- **DeepSeekCoder V2 236b**: Best open source model (available through OpenRouter, DeepSeek API, or self-hosted)
13+
- **Qwen 2.5 Coder 32b**: Best model for self-hosting with reasonable hardware requirements
14+
15+
**Note**: Models with less than 7b parameters typically lack the capability to properly interact with bolt!
16+
517
## FAQ
618

719
### How do I get the best results with bolt.diy?
@@ -34,14 +46,18 @@ We have seen this error a couple times and for some reason just restarting the D
3446

3547
We promise you that we are constantly testing new PRs coming into bolt.diy and the preview is core functionality, so the application is not broken! When you get a blank preview or don’t get a preview, this is generally because the LLM hallucinated bad code or incorrect commands. We are working on making this more transparent so it is obvious. Sometimes the error will appear in developer console too so check that as well.
3648

37-
### How to add a LLM:
49+
### Everything works but the results are bad
3850

39-
To make new LLMs available to use in this version of bolt.new, head on over to `app/utils/constants.ts` and find the constant MODEL_LIST. Each element in this array is an object that has the model ID for the name (get this from the provider's API documentation), a label for the frontend model dropdown, and the provider.
51+
This goes to the point above about how local LLMs are getting very powerful but you still are going to see better (sometimes much better) results with the largest LLMs like GPT-4o, Claude 3.5 Sonnet, and DeepSeek Coder V2 236b. If you are using smaller LLMs like Qwen-2.5-Coder, consider it more experimental and educational at this point. It can build smaller applications really well, which is super impressive for a local LLM, but for larger scale applications you want to use the larger LLMs still!
4052

41-
By default, Anthropic, OpenAI, Groq, and Ollama are implemented as providers, but the YouTube video for this repo covers how to extend this to work with more providers if you wish!
53+
### Received structured exception #0xc0000005: access violation
4254

43-
When you add a new model to the MODEL_LIST array, it will immediately be available to use when you run the app locally or reload it. For Ollama models, make sure you have the model installed already before trying to use it here!
55+
If you are getting this, you are probably on Windows. The fix is generally to update the [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170)
4456

45-
### Everything works but the results are bad
57+
### How to add an LLM:
4658

47-
This goes to the point above about how local LLMs are getting very powerful but you still are going to see better (sometimes much better) results with the largest LLMs like GPT-4o, Claude 3.5 Sonnet, and DeepSeek Coder V2 236b. If you are using smaller LLMs like Qwen-2.5-Coder, consider it more experimental and educational at this point. It can build smaller applications really well, which is super impressive for a local LLM, but for larger scale applications you want to use the larger LLMs still!
59+
To make new LLMs available to use in this version of bolt.new, head on over to `app/utils/constants.ts` and find the constant MODEL_LIST. Each element in this array is an object that has the model ID for the name (get this from the provider's API documentation), a label for the frontend model dropdown, and the provider.
60+
61+
By default, many providers are already implemented, but the YouTube video for this repo covers how to extend this to work with more providers if you wish!
62+
63+
When you add a new model to the MODEL_LIST array, it will immediately be available to use when you run the app locally or reload it.

README.md

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
Welcome to bolt.diy, the official open source version of Bolt.new (previously known as oTToDev and bolt.new ANY LLM), which allows you to choose the LLM that you use for each prompt! Currently, you can use OpenAI, Anthropic, Ollama, OpenRouter, Gemini, LMStudio, Mistral, xAI, HuggingFace, DeepSeek, or Groq models - and it is easily extended to use any other model supported by the Vercel AI SDK! See the instructions below for running this locally and extending it to include more models.
66

7-
Check the [bolt.diy Docs](https://stackblitz-labs.github.io/bolt.diy/) for more information. This documentation is still being updated after the transfer.
7+
Check the [bolt.diy Docs](https://stackblitz-labs.github.io/bolt.diy/) for more information.
8+
9+
We have also launched an experimental agent called the "bolt.diy Expert" that can answer common questions about bolt.diy. Find it here on the [oTTomator Live Agent Studio](https://studio.ottomator.ai/).
810

911
bolt.diy was originally started by [Cole Medin](https://www.youtube.com/@ColeMedin) but has quickly grown into a massive community effort to build the BEST open source AI coding assistant!
1012

@@ -95,34 +97,6 @@ Clone the repository using Git:
9597
git clone -b stable https://github.com/stackblitz-labs/bolt.diy
9698
```
9799

98-
### (Optional) Configure Environment Variables
99-
100-
Most environment variables can be configured directly through the settings menu of the application. However, if you need to manually configure them:
101-
102-
1. Rename `.env.example` to `.env.local`.
103-
2. Add your LLM API keys. For example:
104-
105-
```env
106-
GROQ_API_KEY=YOUR_GROQ_API_KEY
107-
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
108-
ANTHROPIC_API_KEY=YOUR_ANTHROPIC_API_KEY
109-
```
110-
111-
**Note**: Ollama does not require an API key as it runs locally.
112-
113-
3. Optionally, set additional configurations:
114-
115-
```env
116-
# Debugging
117-
VITE_LOG_LEVEL=debug
118-
119-
# Ollama settings (example: 8K context, localhost port 11434)
120-
OLLAMA_API_BASE_URL=http://localhost:11434
121-
DEFAULT_NUM_CTX=8192
122-
```
123-
124-
**Important**: Do not commit your `.env.local` file to version control. This file is already included in `.gitignore`.
125-
126100
---
127101

128102
## Run the Application
@@ -155,27 +129,30 @@ DEFAULT_NUM_CTX=8192
155129
156130
Use the provided NPM scripts:
157131
```bash
158-
npm run dockerbuild # Development build
159-
npm run dockerbuild:prod # Production build
132+
npm run dockerbuild
160133
```
161134
162135
Alternatively, use Docker commands directly:
163136
```bash
164-
docker build . --target bolt-ai-development # Development build
165-
docker build . --target bolt-ai-production # Production build
137+
docker build . --target bolt-ai-development
166138
```
167139
168140
2. **Run the Container**:
169141
Use Docker Compose profiles to manage environments:
170142
```bash
171-
docker-compose --profile development up # Development
172-
docker-compose --profile production up # Production
143+
docker-compose --profile development up
173144
```
174145
175146
- With the development profile, changes to your code will automatically reflect in the running container (hot reloading).
176147
177148
---
178149
150+
### Entering API Keys
151+
152+
All of your API Keys can be configured directly in the application. Just selecte the provider you want from the dropdown and click the pencile icon to enter your API key.
153+
154+
---
155+
179156
### Update Your Local Version to the Latest
180157
181158
To keep your local version of bolt.diy up to date with the latest changes, follow these steps for your operating system:
@@ -236,4 +213,4 @@ Explore upcoming features and priorities on our [Roadmap](https://roadmap.sh/r/o
236213

237214
## FAQ
238215

239-
For answers to common questions, visit our [FAQ Page](FAQ.md).
216+
For answers to common questions, issues, and to see a list of recommended models, visit our [FAQ Page](FAQ.md).

app/commit.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "commit": "69c0bf5873334c25d691b8db4a995b86125a6799" }
1+
{ "commit": "50e677878446f622531123b19912f38e8246afbd", "version": "0.0.3" }

app/components/chat/BaseChat.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
119119

120120
useEffect(() => {
121121
// Load API keys from cookies on component mount
122+
123+
let parsedApiKeys: Record<string, string> | undefined = {};
124+
122125
try {
123126
const storedApiKeys = Cookies.get('apiKeys');
124127

@@ -127,6 +130,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
127130

128131
if (typeof parsedKeys === 'object' && parsedKeys !== null) {
129132
setApiKeys(parsedKeys);
133+
parsedApiKeys = parsedKeys;
130134
}
131135
}
132136
} catch (error) {
@@ -155,7 +159,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
155159
Cookies.remove('providers');
156160
}
157161

158-
initializeModelList(providerSettings).then((modelList) => {
162+
initializeModelList({ apiKeys: parsedApiKeys, providerSettings }).then((modelList) => {
159163
setModelList(modelList);
160164
});
161165

app/components/settings/debug/DebugTab.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useState } from 'react';
22
import { useSettings } from '~/lib/hooks/useSettings';
33
import commit from '~/commit.json';
44
import { toast } from 'react-toastify';
5+
import { providerBaseUrlEnvKeys } from '~/utils/constants';
56

67
interface ProviderStatus {
78
name: string;
@@ -236,7 +237,7 @@ const checkProviderStatus = async (url: string | null, providerName: string): Pr
236237
}
237238

238239
// Try different endpoints based on provider
239-
const checkUrls = [`${url}/api/health`, `${url}/v1/models`];
240+
const checkUrls = [`${url}/api/health`, url.endsWith('v1') ? `${url}/models` : `${url}/v1/models`];
240241
console.log(`[Debug] Checking additional endpoints:`, checkUrls);
241242

242243
const results = await Promise.all(
@@ -321,14 +322,16 @@ export default function DebugTab() {
321322
.filter(([, provider]) => LOCAL_PROVIDERS.includes(provider.name))
322323
.map(async ([, provider]) => {
323324
const envVarName =
324-
provider.name.toLowerCase() === 'ollama'
325-
? 'OLLAMA_API_BASE_URL'
326-
: provider.name.toLowerCase() === 'lmstudio'
327-
? 'LMSTUDIO_API_BASE_URL'
328-
: `REACT_APP_${provider.name.toUpperCase()}_URL`;
325+
providerBaseUrlEnvKeys[provider.name].baseUrlKey || `REACT_APP_${provider.name.toUpperCase()}_URL`;
329326

330327
// Access environment variables through import.meta.env
331-
const url = import.meta.env[envVarName] || provider.settings.baseUrl || null; // Ensure baseUrl is used
328+
let settingsUrl = provider.settings.baseUrl;
329+
330+
if (settingsUrl && settingsUrl.trim().length === 0) {
331+
settingsUrl = undefined;
332+
}
333+
334+
const url = settingsUrl || import.meta.env[envVarName] || null; // Ensure baseUrl is used
332335
console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
333336

334337
const status = await checkProviderStatus(url, provider.name);

app/components/settings/providers/ProvidersTab.tsx

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { logStore } from '~/lib/stores/logs';
77

88
// Import a default fallback icon
99
import DefaultIcon from '/icons/Default.svg'; // Adjust the path as necessary
10+
import { providerBaseUrlEnvKeys } from '~/utils/constants';
1011

1112
export default function ProvidersTab() {
1213
const { providers, updateProviderSettings, isLocalModel } = useSettings();
@@ -47,60 +48,77 @@ export default function ProvidersTab() {
4748
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
4849
/>
4950
</div>
50-
{filteredProviders.map((provider) => (
51-
<div
52-
key={provider.name}
53-
className="flex flex-col mb-2 provider-item hover:bg-bolt-elements-bg-depth-3 p-4 rounded-lg border border-bolt-elements-borderColor "
54-
>
55-
<div className="flex items-center justify-between mb-2">
56-
<div className="flex items-center gap-2">
57-
<img
58-
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
59-
onError={(e) => {
60-
// Fallback to default icon on error
61-
e.currentTarget.src = DefaultIcon;
51+
{filteredProviders.map((provider) => {
52+
const envBaseUrlKey = providerBaseUrlEnvKeys[provider.name].baseUrlKey;
53+
const envBaseUrl = envBaseUrlKey ? import.meta.env[envBaseUrlKey] : undefined;
54+
55+
return (
56+
<div
57+
key={provider.name}
58+
className="flex flex-col mb-2 provider-item hover:bg-bolt-elements-bg-depth-3 p-4 rounded-lg border border-bolt-elements-borderColor "
59+
>
60+
<div className="flex items-center justify-between mb-2">
61+
<div className="flex items-center gap-2">
62+
<img
63+
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
64+
onError={(e) => {
65+
// Fallback to default icon on error
66+
e.currentTarget.src = DefaultIcon;
67+
}}
68+
alt={`${provider.name} icon`}
69+
className="w-6 h-6 dark:invert"
70+
/>
71+
<span className="text-bolt-elements-textPrimary">{provider.name}</span>
72+
</div>
73+
<Switch
74+
className="ml-auto"
75+
checked={provider.settings.enabled}
76+
onCheckedChange={(enabled) => {
77+
updateProviderSettings(provider.name, { ...provider.settings, enabled });
78+
79+
if (enabled) {
80+
logStore.logProvider(`Provider ${provider.name} enabled`, { provider: provider.name });
81+
} else {
82+
logStore.logProvider(`Provider ${provider.name} disabled`, { provider: provider.name });
83+
}
6284
}}
63-
alt={`${provider.name} icon`}
64-
className="w-6 h-6 dark:invert"
6585
/>
66-
<span className="text-bolt-elements-textPrimary">{provider.name}</span>
6786
</div>
68-
<Switch
69-
className="ml-auto"
70-
checked={provider.settings.enabled}
71-
onCheckedChange={(enabled) => {
72-
updateProviderSettings(provider.name, { ...provider.settings, enabled });
87+
{/* Base URL input for configurable providers */}
88+
{URL_CONFIGURABLE_PROVIDERS.includes(provider.name) && provider.settings.enabled && (
89+
<div className="mt-2">
90+
{envBaseUrl && (
91+
<label className="block text-xs text-bolt-elements-textSecondary text-green-300 mb-2">
92+
Set On (.env) : {envBaseUrl}
93+
</label>
94+
)}
95+
<label className="block text-sm text-bolt-elements-textSecondary mb-2">
96+
{envBaseUrl ? 'Override Base Url' : 'Base URL '}:{' '}
97+
</label>
98+
<input
99+
type="text"
100+
value={provider.settings.baseUrl || ''}
101+
onChange={(e) => {
102+
let newBaseUrl: string | undefined = e.target.value;
103+
104+
if (newBaseUrl && newBaseUrl.trim().length === 0) {
105+
newBaseUrl = undefined;
106+
}
73107

74-
if (enabled) {
75-
logStore.logProvider(`Provider ${provider.name} enabled`, { provider: provider.name });
76-
} else {
77-
logStore.logProvider(`Provider ${provider.name} disabled`, { provider: provider.name });
78-
}
79-
}}
80-
/>
108+
updateProviderSettings(provider.name, { ...provider.settings, baseUrl: newBaseUrl });
109+
logStore.logProvider(`Base URL updated for ${provider.name}`, {
110+
provider: provider.name,
111+
baseUrl: newBaseUrl,
112+
});
113+
}}
114+
placeholder={`Enter ${provider.name} base URL`}
115+
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
116+
/>
117+
</div>
118+
)}
81119
</div>
82-
{/* Base URL input for configurable providers */}
83-
{URL_CONFIGURABLE_PROVIDERS.includes(provider.name) && provider.settings.enabled && (
84-
<div className="mt-2">
85-
<label className="block text-sm text-bolt-elements-textSecondary mb-1">Base URL:</label>
86-
<input
87-
type="text"
88-
value={provider.settings.baseUrl || ''}
89-
onChange={(e) => {
90-
const newBaseUrl = e.target.value;
91-
updateProviderSettings(provider.name, { ...provider.settings, baseUrl: newBaseUrl });
92-
logStore.logProvider(`Base URL updated for ${provider.name}`, {
93-
provider: provider.name,
94-
baseUrl: newBaseUrl,
95-
});
96-
}}
97-
placeholder={`Enter ${provider.name} base URL`}
98-
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
99-
/>
100-
</div>
101-
)}
102-
</div>
103-
))}
120+
);
121+
})}
104122
</div>
105123
);
106124
}

app/entry.server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default async function handleRequest(
1414
remixContext: EntryContext,
1515
_loadContext: AppLoadContext,
1616
) {
17-
await initializeModelList();
17+
await initializeModelList({});
1818

1919
const readable = await renderToReadableStream(<RemixServer context={remixContext} url={request.url} />, {
2020
signal: request.signal,

0 commit comments

Comments
 (0)