Stijnus commited on
Commit
b732f20
Β·
1 Parent(s): e196442

bug fix for Open preview in a new tab.

Browse files
README.md CHANGED
@@ -1,4 +1,5 @@
1
  # bolt.diy (Previously oTToDev)
 
2
  [![bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy)
3
 
4
  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.
@@ -65,7 +66,7 @@ project, please check the [project management guide](./PROJECT.md) to get starte
65
  - βœ… Together Integration (@mouimet-infinisoft)
66
  - βœ… Mobile friendly (@qwikode)
67
  - βœ… Better prompt enhancing (@SujalXplores)
68
- - βœ… Attach images to prompts (@atrokhym)
69
  - βœ… Added Git Clone button (@thecodacus)
70
  - βœ… Git Import from url (@thecodacus)
71
  - βœ… PromptLibrary to have different variations of prompts for different use cases (@thecodacus)
@@ -86,8 +87,9 @@ project, please check the [project management guide](./PROJECT.md) to get starte
86
  - ⬜ Voice prompting
87
  - ⬜ Azure Open AI API Integration
88
  - ⬜ Vertex AI Integration
89
- - ⬜ Granite Integration
90
- - ⬜ Popout Window for Web Container
 
91
 
92
  ## Features
93
 
@@ -99,21 +101,18 @@ project, please check the [project management guide](./PROJECT.md) to get starte
99
  - **Download projects as ZIP** for easy portability.
100
  - **Integration-ready Docker support** for a hassle-free setup.
101
 
102
- ## Setup
103
 
104
- If you're new to installing software from GitHub, don't worry! If you encounter any issues, feel free to submit an "issue" using the provided links or improve this documentation by forking the repository, editing the instructions, and submitting a pull request. The following instruction will help you get the stable branch up and running on your local machine in no time.
105
 
106
  Let's get you up and running with the stable version of Bolt.DIY!
107
 
108
  ## Quick Download
109
 
110
- [![Download Latest Release](https://img.shields.io/github/v/release/stackblitz-labs/bolt.diy?label=Download%20Bolt&sort=semver)](https://github.com/stackblitz-labs/bolt.diy/releases/latest) ← Click here to go the the latest release version!
111
 
112
  - Next **click source.zip**
113
 
114
-
115
-
116
-
117
  ## Prerequisites
118
 
119
  Before you begin, you'll need to install two important pieces of software:
@@ -146,16 +145,19 @@ You have two options for running Bolt.DIY: directly on your machine or using Doc
146
  ### Option 1: Direct Installation (Recommended for Beginners)
147
 
148
  1. **Install Package Manager (pnpm)**:
 
149
  ```bash
150
  npm install -g pnpm
151
  ```
152
 
153
  2. **Install Project Dependencies**:
 
154
  ```bash
155
  pnpm install
156
  ```
157
 
158
  3. **Start the Application**:
 
159
  ```bash
160
  pnpm run dev
161
  ```
@@ -167,11 +169,13 @@ You have two options for running Bolt.DIY: directly on your machine or using Doc
167
  This option requires some familiarity with Docker but provides a more isolated environment.
168
 
169
  #### Additional Prerequisite
 
170
  - Install Docker: [Download Docker](https://www.docker.com/)
171
 
172
  #### Steps:
173
 
174
  1. **Build the Docker Image**:
 
175
  ```bash
176
  # Using npm script:
177
  npm run dockerbuild
@@ -185,9 +189,6 @@ This option requires some familiarity with Docker but provides a more isolated e
185
  docker-compose --profile development up
186
  ```
187
 
188
-
189
-
190
-
191
  ## Configuring API Keys and Providers
192
 
193
  ### Adding Your API Keys
@@ -216,6 +217,7 @@ For providers that support custom base URLs (such as Ollama or LM Studio), follo
216
  > **Note**: Custom base URLs are particularly useful when running local instances of AI models or using custom API endpoints.
217
 
218
  ### Supported Providers
 
219
  - Ollama
220
  - LM Studio
221
  - OpenAILike
@@ -223,23 +225,27 @@ For providers that support custom base URLs (such as Ollama or LM Studio), follo
223
  ## Setup Using Git (For Developers only)
224
 
225
  This method is recommended for developers who want to:
 
226
  - Contribute to the project
227
  - Stay updated with the latest changes
228
  - Switch between different versions
229
  - Create custom modifications
230
 
231
  #### Prerequisites
 
232
  1. Install Git: [Download Git](https://git-scm.com/downloads)
233
 
234
  #### Initial Setup
235
 
236
  1. **Clone the Repository**:
 
237
  ```bash
238
  # Using HTTPS
239
  git clone https://github.com/stackblitz-labs/bolt.diy.git
240
  ```
241
 
242
  2. **Navigate to Project Directory**:
 
243
  ```bash
244
  cd bolt.diy
245
  ```
@@ -249,6 +255,7 @@ This method is recommended for developers who want to:
249
  git checkout main
250
  ```
251
  4. **Install Dependencies**:
 
252
  ```bash
253
  pnpm install
254
  ```
@@ -263,16 +270,19 @@ This method is recommended for developers who want to:
263
  To get the latest changes from the repository:
264
 
265
  1. **Save Your Local Changes** (if any):
 
266
  ```bash
267
  git stash
268
  ```
269
 
270
  2. **Pull Latest Updates**:
 
271
  ```bash
272
  git pull origin main
273
  ```
274
 
275
  3. **Update Dependencies**:
 
276
  ```bash
277
  pnpm install
278
  ```
@@ -287,6 +297,7 @@ To get the latest changes from the repository:
287
  If you encounter issues:
288
 
289
  1. **Clean Installation**:
 
290
  ```bash
291
  # Remove node modules and lock files
292
  rm -rf node_modules pnpm-lock.yaml
 
1
  # bolt.diy (Previously oTToDev)
2
+
3
  [![bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy)
4
 
5
  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
  - βœ… Together Integration (@mouimet-infinisoft)
67
  - βœ… Mobile friendly (@qwikode)
68
  - βœ… Better prompt enhancing (@SujalXplores)
69
+ - βœ… Attach images to prompts (@atrokhym)(@stijnus)
70
  - βœ… Added Git Clone button (@thecodacus)
71
  - βœ… Git Import from url (@thecodacus)
72
  - βœ… PromptLibrary to have different variations of prompts for different use cases (@thecodacus)
 
87
  - ⬜ Voice prompting
88
  - ⬜ Azure Open AI API Integration
89
  - ⬜ Vertex AI Integration
90
+ - ⬜ Granite Integration
91
+ - βœ… Popout Window for Web Container(@stijnus)
92
+ - βœ… Ability to change Popout window size (@stijnus)
93
 
94
  ## Features
95
 
 
101
  - **Download projects as ZIP** for easy portability.
102
  - **Integration-ready Docker support** for a hassle-free setup.
103
 
104
+ ## Setup
105
 
106
+ If you're new to installing software from GitHub, don't worry! If you encounter any issues, feel free to submit an "issue" using the provided links or improve this documentation by forking the repository, editing the instructions, and submitting a pull request. The following instruction will help you get the stable branch up and running on your local machine in no time.
107
 
108
  Let's get you up and running with the stable version of Bolt.DIY!
109
 
110
  ## Quick Download
111
 
112
+ [![Download Latest Release](https://img.shields.io/github/v/release/stackblitz-labs/bolt.diy?label=Download%20Bolt&sort=semver)](https://github.com/stackblitz-labs/bolt.diy/releases/latest) ← Click here to go the the latest release version!
113
 
114
  - Next **click source.zip**
115
 
 
 
 
116
  ## Prerequisites
117
 
118
  Before you begin, you'll need to install two important pieces of software:
 
145
  ### Option 1: Direct Installation (Recommended for Beginners)
146
 
147
  1. **Install Package Manager (pnpm)**:
148
+
149
  ```bash
150
  npm install -g pnpm
151
  ```
152
 
153
  2. **Install Project Dependencies**:
154
+
155
  ```bash
156
  pnpm install
157
  ```
158
 
159
  3. **Start the Application**:
160
+
161
  ```bash
162
  pnpm run dev
163
  ```
 
169
  This option requires some familiarity with Docker but provides a more isolated environment.
170
 
171
  #### Additional Prerequisite
172
+
173
  - Install Docker: [Download Docker](https://www.docker.com/)
174
 
175
  #### Steps:
176
 
177
  1. **Build the Docker Image**:
178
+
179
  ```bash
180
  # Using npm script:
181
  npm run dockerbuild
 
189
  docker-compose --profile development up
190
  ```
191
 
 
 
 
192
  ## Configuring API Keys and Providers
193
 
194
  ### Adding Your API Keys
 
217
  > **Note**: Custom base URLs are particularly useful when running local instances of AI models or using custom API endpoints.
218
 
219
  ### Supported Providers
220
+
221
  - Ollama
222
  - LM Studio
223
  - OpenAILike
 
225
  ## Setup Using Git (For Developers only)
226
 
227
  This method is recommended for developers who want to:
228
+
229
  - Contribute to the project
230
  - Stay updated with the latest changes
231
  - Switch between different versions
232
  - Create custom modifications
233
 
234
  #### Prerequisites
235
+
236
  1. Install Git: [Download Git](https://git-scm.com/downloads)
237
 
238
  #### Initial Setup
239
 
240
  1. **Clone the Repository**:
241
+
242
  ```bash
243
  # Using HTTPS
244
  git clone https://github.com/stackblitz-labs/bolt.diy.git
245
  ```
246
 
247
  2. **Navigate to Project Directory**:
248
+
249
  ```bash
250
  cd bolt.diy
251
  ```
 
255
  git checkout main
256
  ```
257
  4. **Install Dependencies**:
258
+
259
  ```bash
260
  pnpm install
261
  ```
 
270
  To get the latest changes from the repository:
271
 
272
  1. **Save Your Local Changes** (if any):
273
+
274
  ```bash
275
  git stash
276
  ```
277
 
278
  2. **Pull Latest Updates**:
279
+
280
  ```bash
281
  git pull origin main
282
  ```
283
 
284
  3. **Update Dependencies**:
285
+
286
  ```bash
287
  pnpm install
288
  ```
 
297
  If you encounter issues:
298
 
299
  1. **Clean Installation**:
300
+
301
  ```bash
302
  # Remove node modules and lock files
303
  rm -rf node_modules pnpm-lock.yaml
app/components/workbench/Preview.tsx CHANGED
@@ -11,13 +11,14 @@ interface WindowSize {
11
  name: string;
12
  width: number;
13
  height: number;
 
14
  }
15
 
16
  const WINDOW_SIZES: WindowSize[] = [
17
- { name: 'Mobile (375x667)', width: 375, height: 667 },
18
- { name: 'Tablet (768x1024)', width: 768, height: 1024 },
19
- { name: 'Laptop (1366x768)', width: 1366, height: 768 },
20
- { name: 'Desktop (1920x1080)', width: 1920, height: 1080 },
21
  ];
22
 
23
  export const Preview = memo(() => {
@@ -249,14 +250,17 @@ export const Preview = memo(() => {
249
  {isPortDropdownOpen && (
250
  <div className="z-iframe-overlay w-full h-full absolute" onClick={() => setIsPortDropdownOpen(false)} />
251
  )}
252
- <div className="bg-bolt-elements-background-depth-2 p-2 flex items-center gap-1.5">
253
- <IconButton icon="i-ph:arrow-clockwise" onClick={reloadPreview} />
254
- <IconButton
255
- icon="i-ph:selection"
256
- onClick={() => setIsSelectionMode(!isSelectionMode)}
257
- className={isSelectionMode ? 'bg-bolt-elements-background-depth-3' : ''}
258
- />
259
- <div className="flex items-center gap-1 flex-grow bg-bolt-elements-preview-addressBar-background border border-bolt-elements-borderColor text-bolt-elements-preview-addressBar-text rounded-full px-3 py-1 text-sm hover:bg-bolt-elements-preview-addressBar-backgroundHover hover:focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive">
 
 
 
260
  <input
261
  title="URL"
262
  ref={inputRef}
@@ -278,68 +282,80 @@ export const Preview = memo(() => {
278
  />
279
  </div>
280
 
281
- {previews.length > 1 && (
282
- <PortDropdown
283
- activePreviewIndex={activePreviewIndex}
284
- setActivePreviewIndex={setActivePreviewIndex}
285
- isDropdownOpen={isPortDropdownOpen}
286
- setHasSelectedPreview={(value) => (hasSelectedPreview.current = value)}
287
- setIsDropdownOpen={setIsPortDropdownOpen}
288
- previews={previews}
 
 
 
 
 
 
 
 
289
  />
290
- )}
291
-
292
- <IconButton
293
- icon="i-ph:devices"
294
- onClick={toggleDeviceMode}
295
- title={isDeviceModeOn ? 'Switch to Responsive Mode' : 'Switch to Device Mode'}
296
- />
297
-
298
- <IconButton
299
- icon="i-ph:layout-light"
300
- onClick={() => setIsPreviewOnly(!isPreviewOnly)}
301
- title={isPreviewOnly ? 'Show Full Interface' : 'Show Preview Only'}
302
- />
303
-
304
- <IconButton
305
- icon={isFullscreen ? 'i-ph:arrows-in' : 'i-ph:arrows-out'}
306
- onClick={toggleFullscreen}
307
- title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}
308
- />
309
-
310
- <div className="relative">
311
  <IconButton
312
- icon="i-ph:arrow-square-out"
313
- onClick={() => openInNewWindow(selectedWindowSize)}
314
- title={`Open Preview in ${selectedWindowSize.name} Window`}
315
  />
 
316
  <IconButton
317
- icon="i-ph:caret-down"
318
- onClick={() => setIsWindowSizeDropdownOpen(!isWindowSizeDropdownOpen)}
319
- className="ml-1"
320
- title="Select Window Size"
321
  />
322
 
323
- {isWindowSizeDropdownOpen && (
324
- <>
325
- <div className="fixed inset-0 z-50" onClick={() => setIsWindowSizeDropdownOpen(false)} />
326
- <div className="absolute right-0 top-full mt-1 z-50 bg-bolt-elements-background-depth-2 rounded-lg shadow-lg border border-bolt-elements-borderColor overflow-hidden">
327
- {WINDOW_SIZES.map((size) => (
328
- <button
329
- key={size.name}
330
- className="w-full px-4 py-2 text-left hover:bg-bolt-elements-background-depth-3 text-sm whitespace-nowrap"
331
- onClick={() => {
332
- setSelectedWindowSize(size);
333
- setIsWindowSizeDropdownOpen(false);
334
- openInNewWindow(size);
335
- }}
336
- >
337
- {size.name}
338
- </button>
339
- ))}
340
- </div>
341
- </>
342
- )}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  </div>
344
  </div>
345
 
 
11
  name: string;
12
  width: number;
13
  height: number;
14
+ icon: string;
15
  }
16
 
17
  const WINDOW_SIZES: WindowSize[] = [
18
+ { name: 'Mobile', width: 375, height: 667, icon: 'i-ph:device-mobile' },
19
+ { name: 'Tablet', width: 768, height: 1024, icon: 'i-ph:device-tablet' },
20
+ { name: 'Laptop', width: 1366, height: 768, icon: 'i-ph:laptop' },
21
+ { name: 'Desktop', width: 1920, height: 1080, icon: 'i-ph:monitor' },
22
  ];
23
 
24
  export const Preview = memo(() => {
 
250
  {isPortDropdownOpen && (
251
  <div className="z-iframe-overlay w-full h-full absolute" onClick={() => setIsPortDropdownOpen(false)} />
252
  )}
253
+ <div className="bg-bolt-elements-background-depth-2 p-2 flex items-center gap-2">
254
+ <div className="flex items-center gap-2">
255
+ <IconButton icon="i-ph:arrow-clockwise" onClick={reloadPreview} />
256
+ <IconButton
257
+ icon="i-ph:selection"
258
+ onClick={() => setIsSelectionMode(!isSelectionMode)}
259
+ className={isSelectionMode ? 'bg-bolt-elements-background-depth-3' : ''}
260
+ />
261
+ </div>
262
+
263
+ <div className="flex-grow flex items-center gap-1 bg-bolt-elements-preview-addressBar-background border border-bolt-elements-borderColor text-bolt-elements-preview-addressBar-text rounded-full px-3 py-1 text-sm hover:bg-bolt-elements-preview-addressBar-backgroundHover hover:focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive">
264
  <input
265
  title="URL"
266
  ref={inputRef}
 
282
  />
283
  </div>
284
 
285
+ <div className="flex items-center gap-2">
286
+ {previews.length > 1 && (
287
+ <PortDropdown
288
+ activePreviewIndex={activePreviewIndex}
289
+ setActivePreviewIndex={setActivePreviewIndex}
290
+ isDropdownOpen={isPortDropdownOpen}
291
+ setHasSelectedPreview={(value) => (hasSelectedPreview.current = value)}
292
+ setIsDropdownOpen={setIsPortDropdownOpen}
293
+ previews={previews}
294
+ />
295
+ )}
296
+
297
+ <IconButton
298
+ icon="i-ph:devices"
299
+ onClick={toggleDeviceMode}
300
+ title={isDeviceModeOn ? 'Switch to Responsive Mode' : 'Switch to Device Mode'}
301
  />
302
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  <IconButton
304
+ icon="i-ph:layout-light"
305
+ onClick={() => setIsPreviewOnly(!isPreviewOnly)}
306
+ title={isPreviewOnly ? 'Show Full Interface' : 'Show Preview Only'}
307
  />
308
+
309
  <IconButton
310
+ icon={isFullscreen ? 'i-ph:arrows-in' : 'i-ph:arrows-out'}
311
+ onClick={toggleFullscreen}
312
+ title={isFullscreen ? 'Exit Full Screen' : 'Full Screen'}
 
313
  />
314
 
315
+ <div className="flex items-center relative">
316
+ <IconButton
317
+ icon="i-ph:arrow-square-out"
318
+ onClick={() => openInNewWindow(selectedWindowSize)}
319
+ title={`Open Preview in ${selectedWindowSize.name} Window`}
320
+ />
321
+ <IconButton
322
+ icon="i-ph:caret-down"
323
+ onClick={() => setIsWindowSizeDropdownOpen(!isWindowSizeDropdownOpen)}
324
+ className="ml-1"
325
+ title="Select Window Size"
326
+ />
327
+
328
+ {isWindowSizeDropdownOpen && (
329
+ <>
330
+ <div className="fixed inset-0 z-50" onClick={() => setIsWindowSizeDropdownOpen(false)} />
331
+ <div className="absolute right-0 top-full mt-2 z-50 min-w-[240px] bg-bolt-elements-background-depth-2 rounded-xl shadow-2xl border border-bolt-elements-borderColor overflow-hidden">
332
+ {WINDOW_SIZES.map((size) => (
333
+ <button
334
+ key={size.name}
335
+ className="w-full px-4 py-3.5 text-left hover:bg-bolt-elements-item-backgroundAccent text-bolt-elements-textSecondary text-sm whitespace-nowrap transition-all duration-200 flex items-center gap-3 group"
336
+ onClick={() => {
337
+ setSelectedWindowSize(size);
338
+ setIsWindowSizeDropdownOpen(false);
339
+ openInNewWindow(size);
340
+ }}
341
+ >
342
+ <div
343
+ className={`${size.icon} w-5 h-5 text-bolt-elements-textSecondary group-hover:text-bolt-elements-item-contentAccent transition-colors duration-200`}
344
+ />
345
+ <div className="flex flex-col">
346
+ <span className="font-medium text-bolt-elements-textPrimary group-hover:text-bolt-elements-item-contentAccent transition-colors duration-200">
347
+ {size.name}
348
+ </span>
349
+ <span className="text-xs text-bolt-elements-textSecondary group-hover:text-bolt-elements-textPrimary transition-colors duration-200">
350
+ {size.width} Γ— {size.height}
351
+ </span>
352
+ </div>
353
+ </button>
354
+ ))}
355
+ </div>
356
+ </>
357
+ )}
358
+ </div>
359
  </div>
360
  </div>
361
 
app/lib/modules/llm/providers/github.ts CHANGED
@@ -11,7 +11,8 @@ export default class GithubProvider extends BaseProvider {
11
  config = {
12
  apiTokenKey: 'GITHUB_API_KEY',
13
  };
14
- // find more in https://github.com/marketplace?type=models
 
15
  staticModels: ModelInfo[] = [
16
  { name: 'gpt-4o', label: 'GPT-4o', provider: 'Github', maxTokenAllowed: 8000 },
17
  { name: 'o1', label: 'o1-preview', provider: 'Github', maxTokenAllowed: 100000 },
 
11
  config = {
12
  apiTokenKey: 'GITHUB_API_KEY',
13
  };
14
+
15
+ // find more in https://github.com/marketplace?type=models
16
  staticModels: ModelInfo[] = [
17
  { name: 'gpt-4o', label: 'GPT-4o', provider: 'Github', maxTokenAllowed: 8000 },
18
  { name: 'o1', label: 'o1-preview', provider: 'Github', maxTokenAllowed: 100000 },