codacus commited on
Commit
f752bf7
·
unverified ·
2 Parent(s): 039e616 9766763

Merge branch 'main' into main

Browse files
Files changed (48) hide show
  1. .env.example +5 -0
  2. .github/workflows/commit.yaml +9 -1
  3. .github/workflows/update-stable.yml +4 -24
  4. .gitignore +3 -0
  5. CONTRIBUTING.md +2 -2
  6. FAQ.md +11 -18
  7. README.md +33 -30
  8. app/commit.json +1 -1
  9. app/components/chat/AssistantMessage.tsx +18 -1
  10. app/components/chat/BaseChat.tsx +26 -19
  11. app/components/chat/Chat.client.tsx +12 -1
  12. app/components/chat/GitCloneButton.tsx +9 -14
  13. app/components/chat/Messages.client.tsx +5 -1
  14. app/components/chat/ScreenshotStateManager.tsx +33 -0
  15. app/components/chat/UserMessage.tsx +15 -21
  16. app/components/chat/chatExportAndImport/ImportButtons.tsx +0 -1
  17. app/components/settings/SettingsWindow.tsx +1 -1
  18. app/components/settings/chat-history/ChatHistoryTab.tsx +6 -0
  19. app/components/settings/connections/ConnectionsTab.tsx +1 -0
  20. app/components/settings/debug/DebugTab.tsx +62 -49
  21. app/components/settings/features/FeaturesTab.tsx +23 -9
  22. app/components/settings/providers/ProvidersTab.tsx +12 -1
  23. app/components/workbench/FileTree.tsx +115 -33
  24. app/components/workbench/Preview.tsx +22 -2
  25. app/components/workbench/ScreenshotSelector.tsx +293 -0
  26. app/lib/.server/llm/api-key.ts +2 -0
  27. app/lib/.server/llm/model.ts +11 -0
  28. app/lib/.server/llm/stream-text.ts +90 -2
  29. app/lib/hooks/useMessageParser.ts +2 -2
  30. app/lib/hooks/useSettings.tsx +58 -0
  31. app/lib/stores/settings.ts +2 -0
  32. app/lib/stores/workbench.ts +14 -3
  33. app/routes/api.chat.ts +56 -15
  34. app/routes/api.enhancer.ts +35 -29
  35. app/utils/constants.ts +26 -7
  36. app/utils/sampler.ts +49 -0
  37. docs/docs/CONTRIBUTING.md +34 -6
  38. docs/docs/FAQ.md +8 -9
  39. docs/docs/index.md +36 -18
  40. docs/mkdocs.yml +6 -6
  41. package.json +2 -1
  42. pnpm-lock.yaml +70 -305
  43. public/favicon.ico +0 -0
  44. public/icons/Default.svg +4 -0
  45. public/icons/Perplexity.svg +4 -0
  46. uno.config.ts +1 -0
  47. vite.config.ts +2 -1
  48. worker-configuration.d.ts +1 -0
.env.example CHANGED
@@ -70,6 +70,11 @@ LMSTUDIO_API_BASE_URL=
70
  # You only need this environment variable set if you want to use xAI models
71
  XAI_API_KEY=
72
 
 
 
 
 
 
73
  # Include this environment variable if you want more logging for debugging locally
74
  VITE_LOG_LEVEL=debug
75
 
 
70
  # You only need this environment variable set if you want to use xAI models
71
  XAI_API_KEY=
72
 
73
+ # Get your Perplexity API Key here -
74
+ # https://www.perplexity.ai/settings/api
75
+ # You only need this environment variable set if you want to use Perplexity models
76
+ PERPLEXITY_API_KEY=
77
+
78
  # Include this environment variable if you want more logging for debugging locally
79
  VITE_LOG_LEVEL=debug
80
 
.github/workflows/commit.yaml CHANGED
@@ -20,9 +20,17 @@ jobs:
20
  - name: Get the latest commit hash
21
  run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
22
 
 
 
 
 
 
 
 
23
  - name: Update commit file
24
  run: |
25
- echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json
 
26
 
27
  - name: Commit and push the update
28
  run: |
 
20
  - name: Get the latest commit hash
21
  run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
22
 
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: '20'
28
+
29
+
30
  - name: Update commit file
31
  run: |
32
+ echo CURRENT_VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV
33
+ echo "{ \"commit\": \"$COMMIT_HASH\" , \"version\": \"$CURRENT_VERSION\" }" > app/commit.json
34
 
35
  - name: Commit and push the update
36
  run: |
.github/workflows/update-stable.yml CHANGED
@@ -9,30 +9,7 @@ permissions:
9
  contents: write
10
 
11
  jobs:
12
- update-commit:
13
- if: contains(github.event.head_commit.message, '#release')
14
- runs-on: ubuntu-latest
15
-
16
- steps:
17
- - name: Checkout the code
18
- uses: actions/checkout@v3
19
-
20
- - name: Get the latest commit hash
21
- run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
22
-
23
- - name: Update commit file
24
- run: |
25
- echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json
26
-
27
- - name: Commit and push the update
28
- run: |
29
- git config --global user.name "github-actions[bot]"
30
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
31
- git add app/commit.json
32
- git commit -m "chore: update commit hash to $COMMIT_HASH"
33
- git push
34
  prepare-release:
35
- needs: update-commit
36
  if: contains(github.event.head_commit.message, '#release')
37
  runs-on: ubuntu-latest
38
 
@@ -183,8 +160,11 @@ jobs:
183
 
184
  - name: Commit and Tag Release
185
  run: |
 
 
186
  git pull
187
- git add package.json pnpm-lock.yaml changelog.md
 
188
  git commit -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
189
  git tag "v${{ steps.bump_version.outputs.new_version }}"
190
  git push
 
9
  contents: write
10
 
11
  jobs:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  prepare-release:
 
13
  if: contains(github.event.head_commit.message, '#release')
14
  runs-on: ubuntu-latest
15
 
 
160
 
161
  - name: Commit and Tag Release
162
  run: |
163
+ echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
164
+ echo "CURRENT_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
165
  git pull
166
+ echo "{ \"commit\": \"$COMMIT_HASH\" , \"version\": \"$CURRENT_VERSION\" }" > app/commit.json
167
+ git add package.json pnpm-lock.yaml changelog.md app/commit.json
168
  git commit -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
169
  git tag "v${{ steps.bump_version.outputs.new_version }}"
170
  git push
.gitignore CHANGED
@@ -37,3 +37,6 @@ modelfiles
37
 
38
  # docs ignore
39
  site
 
 
 
 
37
 
38
  # docs ignore
39
  site
40
+
41
+ # commit file ignore
42
+ app/commit.json
CONTRIBUTING.md CHANGED
@@ -1,6 +1,6 @@
1
- # Contributing to oTToDev
2
 
3
- First off, thank you for considering contributing to Bolt.diy! This fork aims to expand the capabilities of the original project by integrating multiple LLM providers and enhancing functionality. Every contribution helps make Bolt.diy a better tool for developers worldwide.
4
 
5
  ## 📋 Table of Contents
6
  - [Code of Conduct](#code-of-conduct)
 
1
+ # Contributing to bolt.diy
2
 
3
+ First off, thank you for considering contributing to bolt.diy! This fork aims to expand the capabilities of the original project by integrating multiple LLM providers and enhancing functionality. Every contribution helps make bolt.diy a better tool for developers worldwide.
4
 
5
  ## 📋 Table of Contents
6
  - [Code of Conduct](#code-of-conduct)
FAQ.md CHANGED
@@ -1,12 +1,12 @@
1
- [![Bolt.new: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.new)
2
 
3
- # Bolt.new Fork by Cole Medin - Bolt.diy
4
 
5
  ## FAQ
6
 
7
- ### How do I get the best results with Bolt.diy?
8
 
9
- - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly.
10
 
11
  - **Use the enhance prompt icon**: Before sending your prompt, try clicking the 'enhance' icon to have the AI model help you refine your prompt, then edit the results before submitting.
12
 
@@ -14,36 +14,29 @@
14
 
15
  - **Batch simple instructions**: Save time by combining simple instructions into one message. For example, you can ask Bolt.diy to change the color scheme, add mobile responsiveness, and restart the dev server, all in one go saving you time and reducing API credit consumption significantly.
16
 
17
- ### Do you plan on merging Bolt.diy back into the official Bolt.new repo?
18
-
19
- More news coming on this coming early next month - stay tuned!
20
-
21
  ### Why are there so many open issues/pull requests?
22
 
23
- Bolt.diy was started simply to showcase how to edit an open source project and to do something cool with local LLMs on my (@ColeMedin) YouTube channel! However, it quickly
24
- grew into a massive community project that I am working hard to keep up with the demand of by forming a team of maintainers and getting as many people involved as I can.
25
- That effort is going well and all of our maintainers are ABSOLUTE rockstars, but it still takes time to organize everything so we can efficiently get through all
26
- the issues and PRs. But rest assured, we are working hard and even working on some partnerships behind the scenes to really help this project take off!
27
 
28
- ### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for Bolt.diy/Bolt.new?
29
 
30
  As much as the gap is quickly closing between open source and massive close source models, you’re still going to get the best results with the very large models like GPT-4o, Claude 3.5 Sonnet, and DeepSeek Coder V2 236b. This is one of the big tasks we have at hand - figuring out how to prompt better, use agents, and improve the platform as a whole to make it work better for even the smaller local LLMs!
31
 
32
  ### I'm getting the error: "There was an error processing this request"
33
 
34
- If you see this error within Bolt.diy, that is just the application telling you there is a problem at a high level, and this could mean a number of different things. To find the actual error, please check BOTH the terminal where you started the application (with Docker or pnpm) and the developer console in the browser. For most browsers, you can access the developer console by pressing F12 or right clicking anywhere in the browser and selecting “Inspect”. Then go to the “console” tab in the top right.
35
 
36
  ### I'm getting the error: "x-api-key header missing"
37
 
38
- We have seen this error a couple times and for some reason just restarting the Docker container has fixed it. This seems to be Ollama specific. Another thing to try is try to run Bolt.diy with Docker or pnpm, whichever you didn’t run first. We are still on the hunt for why this happens once and a while!
39
 
40
- ### I'm getting a blank preview when Bolt.diy runs my app!
41
 
42
- 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.
43
 
44
  ### How to add a LLM:
45
 
46
- 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.
47
 
48
  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!
49
 
 
1
+ [![bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy)
2
 
3
+ # bolt.diy
4
 
5
  ## FAQ
6
 
7
+ ### How do I get the best results with bolt.diy?
8
 
9
+ - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure bolt scaffolds the project accordingly.
10
 
11
  - **Use the enhance prompt icon**: Before sending your prompt, try clicking the 'enhance' icon to have the AI model help you refine your prompt, then edit the results before submitting.
12
 
 
14
 
15
  - **Batch simple instructions**: Save time by combining simple instructions into one message. For example, you can ask Bolt.diy to change the color scheme, add mobile responsiveness, and restart the dev server, all in one go saving you time and reducing API credit consumption significantly.
16
 
 
 
 
 
17
  ### Why are there so many open issues/pull requests?
18
 
19
+ bolt.diy was started simply to showcase how to edit an open source project and to do something cool with local LLMs on my (@ColeMedin) YouTube channel! However, it quickly grew into a massive community project that I am working hard to keep up with the demand of by forming a team of maintainers and getting as many people involved as I can. That effort is going well and all of our maintainers are ABSOLUTE rockstars, but it still takes time to organize everything so we can efficiently get through all the issues and PRs. But rest assured, we are working hard and even working on some partnerships behind the scenes to really help this project take off!
 
 
 
20
 
21
+ ### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for bolt.diy/bolt.new?
22
 
23
  As much as the gap is quickly closing between open source and massive close source models, you’re still going to get the best results with the very large models like GPT-4o, Claude 3.5 Sonnet, and DeepSeek Coder V2 236b. This is one of the big tasks we have at hand - figuring out how to prompt better, use agents, and improve the platform as a whole to make it work better for even the smaller local LLMs!
24
 
25
  ### I'm getting the error: "There was an error processing this request"
26
 
27
+ If you see this error within bolt.diy, that is just the application telling you there is a problem at a high level, and this could mean a number of different things. To find the actual error, please check BOTH the terminal where you started the application (with Docker or pnpm) and the developer console in the browser. For most browsers, you can access the developer console by pressing F12 or right clicking anywhere in the browser and selecting “Inspect”. Then go to the “console” tab in the top right.
28
 
29
  ### I'm getting the error: "x-api-key header missing"
30
 
31
+ We have seen this error a couple times and for some reason just restarting the Docker container has fixed it. This seems to be Ollama specific. Another thing to try is try to run bolt.diy with Docker or pnpm, whichever you didn’t run first. We are still on the hunt for why this happens once and a while!
32
 
33
+ ### I'm getting a blank preview when bolt.diy runs my app!
34
 
35
+ 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.
36
 
37
  ### How to add a LLM:
38
 
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.
40
 
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!
42
 
README.md CHANGED
@@ -1,14 +1,14 @@
1
- [![Bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy)
2
 
3
- # Bolt.diy (Previously oTToDev)
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.
6
 
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.
8
 
9
- 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!
10
 
11
- ## Join the community for Bolt.diy!
12
 
13
  https://thinktank.ottomator.ai
14
 
@@ -20,7 +20,7 @@ https://thinktank.ottomator.ai
20
  - ✅ Autogenerate Ollama models from what is downloaded (@yunatamos)
21
  - ✅ Filter models by provider (@jasonm23)
22
  - ✅ Download project as ZIP (@fabwaseem)
23
- - ✅ Improvements to the main Bolt.new prompt in `app\lib\.server\llm\prompts.ts` (@kofi-bhr)
24
  - ✅ DeepSeek API Integration (@zenith110)
25
  - ✅ Mistral API Integration (@ArulGandhi)
26
  - ✅ "Open AI Like" API Integration (@ZerxZ)
@@ -43,8 +43,9 @@ https://thinktank.ottomator.ai
43
  - ✅ Mobile friendly (@qwikode)
44
  - ✅ Better prompt enhancing (@SujalXplores)
45
  - ✅ Attach images to prompts (@atrokhym)
46
- - ✅ Detect package.json and commands to auto install and run preview for folder and git import (@wonderwhy-er)
47
- - **HIGH PRIORITY** - Prevent Bolt from rewriting files as often (file locking and diffs)
 
48
  - ⬜ **HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
49
  - ⬜ **HIGH PRIORITY** - Run agents in the backend as opposed to a single model call
50
  - ⬜ Deploy directly to Vercel/Netlify/other similar platforms
@@ -56,7 +57,7 @@ https://thinktank.ottomator.ai
56
  - ⬜ Perplexity Integration
57
  - ⬜ Vertex AI Integration
58
 
59
- ## Bolt.diy Features
60
 
61
  - **AI-powered full-stack web development** directly in your browser.
62
  - **Support for multiple LLMs** with an extensible architecture to integrate additional models.
@@ -66,7 +67,7 @@ https://thinktank.ottomator.ai
66
  - **Download projects as ZIP** for easy portability.
67
  - **Integration-ready Docker support** for a hassle-free setup.
68
 
69
- ## Setup Bolt.diy
70
 
71
  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.
72
 
@@ -174,7 +175,7 @@ DEFAULT_NUM_CTX=8192
174
 
175
  ### Update Your Local Version to the Latest
176
 
177
- To keep your local version of Bolt.diy up to date with the latest changes, follow these steps for your operating system:
178
 
179
  #### 1. **Navigate to your project folder**
180
  Navigate to the directory where you cloned the repository and open a terminal:
@@ -200,34 +201,36 @@ To keep your local version of Bolt.diy up to date with the latest changes, follo
200
  pnpm run dev
201
  ```
202
 
203
- This ensures that you're running the latest version of Bolt.diy and can take advantage of all the newest features and bug fixes.
204
 
205
  ---
206
 
207
- ## Available Scripts
208
 
209
- Here are the available commands for managing the application:
 
 
 
 
 
 
 
 
210
 
211
- - `pnpm run dev`: Start the development server.
212
- - `pnpm run build`: Build the project.
213
- - `pnpm run start`: Run the built application locally (uses Wrangler Pages).
214
- - `pnpm run preview`: Build and start the application locally for production testing.
215
- - `pnpm test`: Run the test suite using Vitest.
216
- - `pnpm run typecheck`: Perform TypeScript type checking.
217
- - `pnpm run typegen`: Generate TypeScript types using Wrangler.
218
- - `pnpm run deploy`: Build and deploy the project to Cloudflare Pages.
219
- - `pnpm lint:fix`: Run the linter and automatically fix issues.
220
 
221
- ## How do I contribute to Bolt.diy?
222
 
223
- [Please check out our dedicated page for contributing to Bolt.diy here!](CONTRIBUTING.md)
224
 
225
- ## What are the future plans for Bolt.diy?
226
 
227
- [Check out our Roadmap here!](https://roadmap.sh/r/ottodev-roadmap-2ovzo)
228
 
229
- Lot more updates to this roadmap coming soon!
230
 
231
  ## FAQ
232
 
233
- [Please check out our dedicated page for FAQ's related to Bolt.diy here!](FAQ.md)
 
1
+ [![bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy)
2
 
3
+ # bolt.diy (Previously oTToDev)
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.
6
 
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.
8
 
9
+ 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!
10
 
11
+ ## Join the community for bolt.diy!
12
 
13
  https://thinktank.ottomator.ai
14
 
 
20
  - ✅ Autogenerate Ollama models from what is downloaded (@yunatamos)
21
  - ✅ Filter models by provider (@jasonm23)
22
  - ✅ Download project as ZIP (@fabwaseem)
23
+ - ✅ Improvements to the main bolt.new prompt in `app\lib\.server\llm\prompts.ts` (@kofi-bhr)
24
  - ✅ DeepSeek API Integration (@zenith110)
25
  - ✅ Mistral API Integration (@ArulGandhi)
26
  - ✅ "Open AI Like" API Integration (@ZerxZ)
 
43
  - ✅ Mobile friendly (@qwikode)
44
  - ✅ Better prompt enhancing (@SujalXplores)
45
  - ✅ Attach images to prompts (@atrokhym)
46
+ - ✅ Detect package.json and commands to auto install & run preview for folder and git import (@wonderwhy-er)
47
+ - Selection tool to target changes visually (@emcconnell)
48
+ - ⬜ **HIGH PRIORITY** - Prevent bolt from rewriting files as often (file locking and diffs)
49
  - ⬜ **HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
50
  - ⬜ **HIGH PRIORITY** - Run agents in the backend as opposed to a single model call
51
  - ⬜ Deploy directly to Vercel/Netlify/other similar platforms
 
57
  - ⬜ Perplexity Integration
58
  - ⬜ Vertex AI Integration
59
 
60
+ ## bolt.diy Features
61
 
62
  - **AI-powered full-stack web development** directly in your browser.
63
  - **Support for multiple LLMs** with an extensible architecture to integrate additional models.
 
67
  - **Download projects as ZIP** for easy portability.
68
  - **Integration-ready Docker support** for a hassle-free setup.
69
 
70
+ ## Setup bolt.diy
71
 
72
  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.
73
 
 
175
 
176
  ### Update Your Local Version to the Latest
177
 
178
+ To keep your local version of bolt.diy up to date with the latest changes, follow these steps for your operating system:
179
 
180
  #### 1. **Navigate to your project folder**
181
  Navigate to the directory where you cloned the repository and open a terminal:
 
201
  pnpm run dev
202
  ```
203
 
204
+ This ensures that you're running the latest version of bolt.diy and can take advantage of all the newest features and bug fixes.
205
 
206
  ---
207
 
208
+ ## Available Scripts
209
 
210
+ - **`pnpm run dev`**: Starts the development server.
211
+ - **`pnpm run build`**: Builds the project.
212
+ - **`pnpm run start`**: Runs the built application locally using Wrangler Pages.
213
+ - **`pnpm run preview`**: Builds and runs the production build locally.
214
+ - **`pnpm test`**: Runs the test suite using Vitest.
215
+ - **`pnpm run typecheck`**: Runs TypeScript type checking.
216
+ - **`pnpm run typegen`**: Generates TypeScript types using Wrangler.
217
+ - **`pnpm run deploy`**: Deploys the project to Cloudflare Pages.
218
+ - **`pnpm run lint:fix`**: Automatically fixes linting issues.
219
 
220
+ ---
221
+
222
+ ## Contributing
 
 
 
 
 
 
223
 
224
+ We welcome contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started.
225
 
226
+ ---
227
 
228
+ ## Roadmap
229
 
230
+ Explore upcoming features and priorities on our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo).
231
 
232
+ ---
233
 
234
  ## FAQ
235
 
236
+ For answers to common questions, visit our [FAQ Page](FAQ.md).
app/commit.json CHANGED
@@ -1 +1 @@
1
- { "commit": "d3727459aa594505efd0cef58c4218eaf48d5baf" }
 
1
+ { "commit": "78505ed2f347dd3a7778b4c1c7c38c89ecacedd3" , "version": "" }
app/components/chat/AssistantMessage.tsx CHANGED
@@ -1,13 +1,30 @@
1
  import { memo } from 'react';
2
  import { Markdown } from './Markdown';
 
3
 
4
  interface AssistantMessageProps {
5
  content: string;
 
6
  }
7
 
8
- export const AssistantMessage = memo(({ content }: AssistantMessageProps) => {
 
 
 
 
 
 
 
 
 
 
9
  return (
10
  <div className="overflow-hidden w-full">
 
 
 
 
 
11
  <Markdown html>{content}</Markdown>
12
  </div>
13
  );
 
1
  import { memo } from 'react';
2
  import { Markdown } from './Markdown';
3
+ import type { JSONValue } from 'ai';
4
 
5
  interface AssistantMessageProps {
6
  content: string;
7
+ annotations?: JSONValue[];
8
  }
9
 
10
+ export const AssistantMessage = memo(({ content, annotations }: AssistantMessageProps) => {
11
+ const filteredAnnotations = (annotations?.filter(
12
+ (annotation: JSONValue) => annotation && typeof annotation === 'object' && Object.keys(annotation).includes('type'),
13
+ ) || []) as { type: string; value: any }[];
14
+
15
+ const usage: {
16
+ completionTokens: number;
17
+ promptTokens: number;
18
+ totalTokens: number;
19
+ } = filteredAnnotations.find((annotation) => annotation.type === 'usage')?.value;
20
+
21
  return (
22
  <div className="overflow-hidden w-full">
23
+ {usage && (
24
+ <div className="text-sm text-bolt-elements-textSecondary mb-2">
25
+ Tokens: {usage.totalTokens} (prompt: {usage.promptTokens}, completion: {usage.completionTokens})
26
+ </div>
27
+ )}
28
  <Markdown html>{content}</Markdown>
29
  </div>
30
  );
app/components/chat/BaseChat.tsx CHANGED
@@ -26,6 +26,8 @@ import FilePreview from './FilePreview';
26
  import { ModelSelector } from '~/components/chat/ModelSelector';
27
  import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition';
28
  import type { IProviderSetting, ProviderInfo } from '~/types/model';
 
 
29
 
30
  const TEXTAREA_MIN_HEIGHT = 76;
31
 
@@ -75,7 +77,6 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
75
  input = '',
76
  enhancingPrompt,
77
  handleInputChange,
78
- promptEnhanced,
79
  enhancePrompt,
80
  sendMessage,
81
  handleStop,
@@ -283,7 +284,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
283
  <div ref={scrollRef} className="flex flex-col lg:flex-row overflow-y-auto w-full h-full">
284
  <div className={classNames(styles.Chat, 'flex flex-col flex-grow lg:min-w-[var(--chat-min-width)] h-full')}>
285
  {!chatStarted && (
286
- <div id="intro" className="mt-[26vh] max-w-chat mx-auto text-center px-4 lg:px-0">
287
  <h1 className="text-3xl lg:text-6xl font-bold text-bolt-elements-textPrimary mb-4 animate-fade-in">
288
  Where ideas begin
289
  </h1>
@@ -376,6 +377,16 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
376
  setImageDataList?.(imageDataList.filter((_, i) => i !== index));
377
  }}
378
  />
 
 
 
 
 
 
 
 
 
 
379
  <div
380
  className={classNames(
381
  'relative shadow-xs border border-bolt-elements-borderColor backdrop-blur rounded-lg',
@@ -384,7 +395,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
384
  <textarea
385
  ref={textareaRef}
386
  className={classNames(
387
- 'w-full pl-4 pt-4 pr-16 focus:outline-none resize-none text-bolt-elements-textPrimary placeholder-bolt-elements-textTertiary bg-transparent text-sm',
388
  'transition-all duration-200',
389
  'hover:border-bolt-elements-focus',
390
  )}
@@ -431,6 +442,11 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
431
  return;
432
  }
433
 
 
 
 
 
 
434
  handleSendMessage?.(event);
435
  }
436
  }}
@@ -473,25 +489,16 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
473
  <IconButton
474
  title="Enhance prompt"
475
  disabled={input.length === 0 || enhancingPrompt}
476
- className={classNames(
477
- 'transition-all',
478
- enhancingPrompt ? 'opacity-100' : '',
479
- promptEnhanced ? 'text-bolt-elements-item-contentAccent' : '',
480
- promptEnhanced ? 'pr-1.5' : '',
481
- promptEnhanced ? 'enabled:hover:bg-bolt-elements-item-backgroundAccent' : '',
482
- )}
483
- onClick={() => enhancePrompt?.()}
484
  >
485
  {enhancingPrompt ? (
486
- <>
487
- <div className="i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress text-xl animate-spin"></div>
488
- <div className="ml-1.5">Enhancing prompt...</div>
489
- </>
490
  ) : (
491
- <>
492
- <div className="i-bolt:stars text-xl"></div>
493
- {promptEnhanced && <div className="ml-1.5">Prompt enhanced</div>}
494
- </>
495
  )}
496
  </IconButton>
497
 
 
26
  import { ModelSelector } from '~/components/chat/ModelSelector';
27
  import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition';
28
  import type { IProviderSetting, ProviderInfo } from '~/types/model';
29
+ import { ScreenshotStateManager } from './ScreenshotStateManager';
30
+ import { toast } from 'react-toastify';
31
 
32
  const TEXTAREA_MIN_HEIGHT = 76;
33
 
 
77
  input = '',
78
  enhancingPrompt,
79
  handleInputChange,
 
80
  enhancePrompt,
81
  sendMessage,
82
  handleStop,
 
284
  <div ref={scrollRef} className="flex flex-col lg:flex-row overflow-y-auto w-full h-full">
285
  <div className={classNames(styles.Chat, 'flex flex-col flex-grow lg:min-w-[var(--chat-min-width)] h-full')}>
286
  {!chatStarted && (
287
+ <div id="intro" className="mt-[16vh] max-w-chat mx-auto text-center px-4 lg:px-0">
288
  <h1 className="text-3xl lg:text-6xl font-bold text-bolt-elements-textPrimary mb-4 animate-fade-in">
289
  Where ideas begin
290
  </h1>
 
377
  setImageDataList?.(imageDataList.filter((_, i) => i !== index));
378
  }}
379
  />
380
+ <ClientOnly>
381
+ {() => (
382
+ <ScreenshotStateManager
383
+ setUploadedFiles={setUploadedFiles}
384
+ setImageDataList={setImageDataList}
385
+ uploadedFiles={uploadedFiles}
386
+ imageDataList={imageDataList}
387
+ />
388
+ )}
389
+ </ClientOnly>
390
  <div
391
  className={classNames(
392
  'relative shadow-xs border border-bolt-elements-borderColor backdrop-blur rounded-lg',
 
395
  <textarea
396
  ref={textareaRef}
397
  className={classNames(
398
+ 'w-full pl-4 pt-4 pr-16 outline-none resize-none text-bolt-elements-textPrimary placeholder-bolt-elements-textTertiary bg-transparent text-sm',
399
  'transition-all duration-200',
400
  'hover:border-bolt-elements-focus',
401
  )}
 
442
  return;
443
  }
444
 
445
+ // ignore if using input method engine
446
+ if (event.nativeEvent.isComposing) {
447
+ return;
448
+ }
449
+
450
  handleSendMessage?.(event);
451
  }
452
  }}
 
489
  <IconButton
490
  title="Enhance prompt"
491
  disabled={input.length === 0 || enhancingPrompt}
492
+ className={classNames('transition-all', enhancingPrompt ? 'opacity-100' : '')}
493
+ onClick={() => {
494
+ enhancePrompt?.();
495
+ toast.success('Prompt enhanced!');
496
+ }}
 
 
 
497
  >
498
  {enhancingPrompt ? (
499
+ <div className="i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress text-xl animate-spin"></div>
 
 
 
500
  ) : (
501
+ <div className="i-bolt:stars text-xl"></div>
 
 
 
502
  )}
503
  </IconButton>
504
 
app/components/chat/Chat.client.tsx CHANGED
@@ -92,6 +92,7 @@ export const ChatImpl = memo(
92
  const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
93
  const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
94
  const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
 
95
  const { activeProviders } = useSettings();
96
 
97
  const [model, setModel] = useState(() => {
@@ -113,14 +114,24 @@ export const ChatImpl = memo(
113
  api: '/api/chat',
114
  body: {
115
  apiKeys,
 
116
  },
 
117
  onError: (error) => {
118
  logger.error('Request failed\n\n', error);
119
  toast.error(
120
  'There was an error processing your request: ' + (error.message ? error.message : 'No details were returned'),
121
  );
122
  },
123
- onFinish: () => {
 
 
 
 
 
 
 
 
124
  logger.debug('Finished streaming');
125
  },
126
  initialMessages,
 
92
  const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
93
  const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
94
  const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
95
+ const files = useStore(workbenchStore.files);
96
  const { activeProviders } = useSettings();
97
 
98
  const [model, setModel] = useState(() => {
 
114
  api: '/api/chat',
115
  body: {
116
  apiKeys,
117
+ files,
118
  },
119
+ sendExtraMessageFields: true,
120
  onError: (error) => {
121
  logger.error('Request failed\n\n', error);
122
  toast.error(
123
  'There was an error processing your request: ' + (error.message ? error.message : 'No details were returned'),
124
  );
125
  },
126
+ onFinish: (message, response) => {
127
+ const usage = response.usage;
128
+
129
+ if (usage) {
130
+ console.log('Token usage:', usage);
131
+
132
+ // You can now use the usage data as needed
133
+ }
134
+
135
  logger.debug('Finished streaming');
136
  },
137
  initialMessages,
app/components/chat/GitCloneButton.tsx CHANGED
@@ -1,7 +1,6 @@
1
  import ignore from 'ignore';
2
  import { useGit } from '~/lib/hooks/useGit';
3
  import type { Message } from 'ai';
4
- import WithTooltip from '~/components/ui/Tooltip';
5
  import { detectProjectCommands, createCommandsMessage } from '~/utils/projectCommands';
6
  import { generateId } from '~/utils/fileUtils';
7
 
@@ -73,7 +72,7 @@ export default function GitCloneButton({ importChat }: GitCloneButtonProps) {
73
  const filesMessage: Message = {
74
  role: 'assistant',
75
  content: `Cloning the repo ${repoUrl} into ${workdir}
76
- <boltArtifact id="imported-files" title="Git Cloned Files" type="bundled">
77
  ${fileContents
78
  .map(
79
  (file) =>
@@ -99,17 +98,13 @@ ${file.content}
99
  };
100
 
101
  return (
102
- <WithTooltip tooltip="Clone A Git Repo">
103
- <button
104
- onClick={(e) => {
105
- onClick(e);
106
- }}
107
- title="Clone A Git Repo"
108
- className="px-4 py-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary hover:bg-bolt-elements-background-depth-3 transition-all flex items-center gap-2"
109
- >
110
- <span className="i-ph:git-branch" />
111
- Clone A Git Repo
112
- </button>
113
- </WithTooltip>
114
  );
115
  }
 
1
  import ignore from 'ignore';
2
  import { useGit } from '~/lib/hooks/useGit';
3
  import type { Message } from 'ai';
 
4
  import { detectProjectCommands, createCommandsMessage } from '~/utils/projectCommands';
5
  import { generateId } from '~/utils/fileUtils';
6
 
 
72
  const filesMessage: Message = {
73
  role: 'assistant',
74
  content: `Cloning the repo ${repoUrl} into ${workdir}
75
+ <boltArtifact id="imported-files" title="Git Cloned Files" type="bundled">
76
  ${fileContents
77
  .map(
78
  (file) =>
 
98
  };
99
 
100
  return (
101
+ <button
102
+ onClick={onClick}
103
+ title="Clone a Git Repo"
104
+ className="px-4 py-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary hover:bg-bolt-elements-background-depth-3 transition-all flex items-center gap-2"
105
+ >
106
+ <span className="i-ph:git-branch" />
107
+ Clone a Git Repo
108
+ </button>
 
 
 
 
109
  );
110
  }
app/components/chat/Messages.client.tsx CHANGED
@@ -65,7 +65,11 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
65
  </div>
66
  )}
67
  <div className="grid grid-col-1 w-full">
68
- {isUserMessage ? <UserMessage content={content} /> : <AssistantMessage content={content} />}
 
 
 
 
69
  </div>
70
  {!isUserMessage && (
71
  <div className="flex gap-2 flex-col lg:flex-row">
 
65
  </div>
66
  )}
67
  <div className="grid grid-col-1 w-full">
68
+ {isUserMessage ? (
69
+ <UserMessage content={content} />
70
+ ) : (
71
+ <AssistantMessage content={content} annotations={message.annotations} />
72
+ )}
73
  </div>
74
  {!isUserMessage && (
75
  <div className="flex gap-2 flex-col lg:flex-row">
app/components/chat/ScreenshotStateManager.tsx ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect } from 'react';
2
+
3
+ interface ScreenshotStateManagerProps {
4
+ setUploadedFiles?: (files: File[]) => void;
5
+ setImageDataList?: (dataList: string[]) => void;
6
+ uploadedFiles: File[];
7
+ imageDataList: string[];
8
+ }
9
+
10
+ export const ScreenshotStateManager = ({
11
+ setUploadedFiles,
12
+ setImageDataList,
13
+ uploadedFiles,
14
+ imageDataList,
15
+ }: ScreenshotStateManagerProps) => {
16
+ useEffect(() => {
17
+ if (setUploadedFiles && setImageDataList) {
18
+ (window as any).__BOLT_SET_UPLOADED_FILES__ = setUploadedFiles;
19
+ (window as any).__BOLT_SET_IMAGE_DATA_LIST__ = setImageDataList;
20
+ (window as any).__BOLT_UPLOADED_FILES__ = uploadedFiles;
21
+ (window as any).__BOLT_IMAGE_DATA_LIST__ = imageDataList;
22
+ }
23
+
24
+ return () => {
25
+ delete (window as any).__BOLT_SET_UPLOADED_FILES__;
26
+ delete (window as any).__BOLT_SET_IMAGE_DATA_LIST__;
27
+ delete (window as any).__BOLT_UPLOADED_FILES__;
28
+ delete (window as any).__BOLT_IMAGE_DATA_LIST__;
29
+ };
30
+ }, [setUploadedFiles, setImageDataList, uploadedFiles, imageDataList]);
31
+
32
+ return null;
33
+ };
app/components/chat/UserMessage.tsx CHANGED
@@ -12,42 +12,36 @@ interface UserMessageProps {
12
  export function UserMessage({ content }: UserMessageProps) {
13
  if (Array.isArray(content)) {
14
  const textItem = content.find((item) => item.type === 'text');
15
- const textContent = sanitizeUserMessage(textItem?.text || '');
16
  const images = content.filter((item) => item.type === 'image' && item.image);
17
 
18
  return (
19
  <div className="overflow-hidden pt-[4px]">
20
- <div className="flex items-start gap-4">
21
- <div className="flex-1">
22
- <Markdown limitedMarkdown>{textContent}</Markdown>
23
- </div>
24
- {images.length > 0 && (
25
- <div className="flex-shrink-0 w-[160px]">
26
- {images.map((item, index) => (
27
- <div key={index} className="relative">
28
- <img
29
- src={item.image}
30
- alt={`Uploaded image ${index + 1}`}
31
- className="w-full h-[160px] rounded-lg object-cover border border-bolt-elements-borderColor"
32
- />
33
- </div>
34
- ))}
35
- </div>
36
- )}
37
  </div>
38
  </div>
39
  );
40
  }
41
 
42
- const textContent = sanitizeUserMessage(content);
43
 
44
  return (
45
  <div className="overflow-hidden pt-[4px]">
46
- <Markdown limitedMarkdown>{textContent}</Markdown>
47
  </div>
48
  );
49
  }
50
 
51
- function sanitizeUserMessage(content: string) {
52
  return content.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '');
53
  }
 
12
  export function UserMessage({ content }: UserMessageProps) {
13
  if (Array.isArray(content)) {
14
  const textItem = content.find((item) => item.type === 'text');
15
+ const textContent = stripMetadata(textItem?.text || '');
16
  const images = content.filter((item) => item.type === 'image' && item.image);
17
 
18
  return (
19
  <div className="overflow-hidden pt-[4px]">
20
+ <div className="flex flex-col gap-4">
21
+ {textContent && <Markdown html>{textContent}</Markdown>}
22
+ {images.map((item, index) => (
23
+ <img
24
+ key={index}
25
+ src={item.image}
26
+ alt={`Image ${index + 1}`}
27
+ className="max-w-full h-auto rounded-lg"
28
+ style={{ maxHeight: '512px', objectFit: 'contain' }}
29
+ />
30
+ ))}
 
 
 
 
 
 
31
  </div>
32
  </div>
33
  );
34
  }
35
 
36
+ const textContent = stripMetadata(content);
37
 
38
  return (
39
  <div className="overflow-hidden pt-[4px]">
40
+ <Markdown html>{textContent}</Markdown>
41
  </div>
42
  );
43
  }
44
 
45
+ function stripMetadata(content: string) {
46
  return content.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '');
47
  }
app/components/chat/chatExportAndImport/ImportButtons.tsx CHANGED
@@ -1,6 +1,5 @@
1
  import type { Message } from 'ai';
2
  import { toast } from 'react-toastify';
3
- import React from 'react';
4
  import { ImportFolderButton } from '~/components/chat/ImportFolderButton';
5
 
6
  export function ImportButtons(importChat: ((description: string, messages: Message[]) => Promise<void>) | undefined) {
 
1
  import type { Message } from 'ai';
2
  import { toast } from 'react-toastify';
 
3
  import { ImportFolderButton } from '~/components/chat/ImportFolderButton';
4
 
5
  export function ImportButtons(importChat: ((description: string, messages: Message[]) => Promise<void>) | undefined) {
app/components/settings/SettingsWindow.tsx CHANGED
@@ -27,8 +27,8 @@ export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
27
  const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
28
  { id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
29
  { id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
30
- { id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
31
  { id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
 
32
  ...(debug
33
  ? [
34
  {
 
27
  const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
28
  { id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
29
  { id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
 
30
  { id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
31
+ { id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
32
  ...(debug
33
  ? [
34
  {
app/components/settings/chat-history/ChatHistoryTab.tsx CHANGED
@@ -22,6 +22,12 @@ export default function ChatHistoryTab() {
22
  };
23
 
24
  const handleDeleteAllChats = async () => {
 
 
 
 
 
 
25
  if (!db) {
26
  const error = new Error('Database is not available');
27
  logStore.logError('Failed to delete chats - DB unavailable', error);
 
22
  };
23
 
24
  const handleDeleteAllChats = async () => {
25
+ const confirmDelete = window.confirm('Are you sure you want to delete all chats? This action cannot be undone.');
26
+
27
+ if (!confirmDelete) {
28
+ return; // Exit if the user cancels
29
+ }
30
+
31
  if (!db) {
32
  const error = new Error('Database is not available');
33
  logStore.logError('Failed to delete chats - DB unavailable', error);
app/components/settings/connections/ConnectionsTab.tsx CHANGED
@@ -15,6 +15,7 @@ export default function ConnectionsTab() {
15
  hasToken: !!githubToken,
16
  });
17
  toast.success('GitHub credentials saved successfully!');
 
18
  };
19
 
20
  return (
 
15
  hasToken: !!githubToken,
16
  });
17
  toast.success('GitHub credentials saved successfully!');
18
+ Cookies.set('git:github.com', JSON.stringify({ username: githubToken, password: 'x-oauth-basic' }));
19
  };
20
 
21
  return (
app/components/settings/debug/DebugTab.tsx CHANGED
@@ -1,6 +1,7 @@
1
  import React, { useCallback, useEffect, useState } from 'react';
2
  import { useSettings } from '~/lib/hooks/useSettings';
3
  import commit from '~/commit.json';
 
4
 
5
  interface ProviderStatus {
6
  name: string;
@@ -33,14 +34,25 @@ interface IProviderConfig {
33
  name: string;
34
  settings: {
35
  enabled: boolean;
 
36
  };
37
  }
38
 
 
 
 
 
 
 
 
39
  const LOCAL_PROVIDERS = ['Ollama', 'LMStudio', 'OpenAILike'];
40
- const versionHash = commit.commit;
 
41
  const GITHUB_URLS = {
42
  original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
43
  fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
 
 
44
  };
45
 
46
  function getSystemInfo(): SystemInfo {
@@ -291,7 +303,7 @@ const checkProviderStatus = async (url: string | null, providerName: string): Pr
291
  };
292
 
293
  export default function DebugTab() {
294
- const { providers } = useSettings();
295
  const [activeProviders, setActiveProviders] = useState<ProviderStatus[]>([]);
296
  const [updateMessage, setUpdateMessage] = useState<string>('');
297
  const [systemInfo] = useState<SystemInfo>(getSystemInfo());
@@ -304,29 +316,31 @@ export default function DebugTab() {
304
 
305
  try {
306
  const entries = Object.entries(providers) as [string, IProviderConfig][];
307
- const statuses = entries
308
- .filter(([, provider]) => LOCAL_PROVIDERS.includes(provider.name))
309
- .map(async ([, provider]) => {
310
- const envVarName =
311
- provider.name.toLowerCase() === 'ollama'
312
- ? 'OLLAMA_API_BASE_URL'
313
- : provider.name.toLowerCase() === 'lmstudio'
314
- ? 'LMSTUDIO_API_BASE_URL'
315
- : `REACT_APP_${provider.name.toUpperCase()}_URL`;
316
-
317
- // Access environment variables through import.meta.env
318
- const url = import.meta.env[envVarName] || null;
319
- console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
320
-
321
- const status = await checkProviderStatus(url, provider.name);
322
-
323
- return {
324
- ...status,
325
- enabled: provider.settings.enabled ?? false,
326
- };
327
- });
328
-
329
- Promise.all(statuses).then(setActiveProviders);
 
 
330
  } catch (error) {
331
  console.error('[Debug] Failed to update provider statuses:', error);
332
  }
@@ -349,32 +363,27 @@ export default function DebugTab() {
349
  setIsCheckingUpdate(true);
350
  setUpdateMessage('Checking for updates...');
351
 
352
- const [originalResponse, forkResponse] = await Promise.all([
353
- fetch(GITHUB_URLS.original),
354
- fetch(GITHUB_URLS.fork),
355
- ]);
356
 
357
- if (!originalResponse.ok || !forkResponse.ok) {
358
- throw new Error('Failed to fetch repository information');
359
- }
360
 
361
- const [originalData, forkData] = await Promise.all([
362
- originalResponse.json() as Promise<{ sha: string }>,
363
- forkResponse.json() as Promise<{ sha: string }>,
364
- ]);
365
 
366
- const originalCommitHash = originalData.sha;
367
- const forkCommitHash = forkData.sha;
368
- const isForked = versionHash === forkCommitHash && forkCommitHash !== originalCommitHash;
369
 
370
- if (originalCommitHash !== versionHash) {
371
  setUpdateMessage(
372
- `Update available from original repository!\n` +
373
- `Current: ${versionHash.slice(0, 7)}${isForked ? ' (forked)' : ''}\n` +
374
- `Latest: ${originalCommitHash.slice(0, 7)}`,
375
  );
376
  } else {
377
- setUpdateMessage('You are on the latest version from the original repository');
378
  }
379
  } catch (error) {
380
  setUpdateMessage('Failed to check for updates');
@@ -382,7 +391,7 @@ export default function DebugTab() {
382
  } finally {
383
  setIsCheckingUpdate(false);
384
  }
385
- }, [isCheckingUpdate]);
386
 
387
  const handleCopyToClipboard = useCallback(() => {
388
  const debugInfo = {
@@ -397,13 +406,17 @@ export default function DebugTab() {
397
  responseTime: provider.responseTime,
398
  url: provider.url,
399
  })),
400
- Version: versionHash,
 
 
 
401
  Timestamp: new Date().toISOString(),
402
  };
 
403
  navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
404
- alert('Debug information copied to clipboard!');
405
  });
406
- }, [activeProviders, systemInfo]);
407
 
408
  return (
409
  <div className="p-4 space-y-6">
@@ -510,7 +523,7 @@ export default function DebugTab() {
510
  <p className="text-sm font-medium text-bolt-elements-textPrimary font-mono">
511
  {versionHash.slice(0, 7)}
512
  <span className="ml-2 text-xs text-bolt-elements-textSecondary">
513
- ({new Date().toLocaleDateString()})
514
  </span>
515
  </p>
516
  </div>
 
1
  import React, { useCallback, useEffect, useState } from 'react';
2
  import { useSettings } from '~/lib/hooks/useSettings';
3
  import commit from '~/commit.json';
4
+ import { toast } from 'react-toastify';
5
 
6
  interface ProviderStatus {
7
  name: string;
 
34
  name: string;
35
  settings: {
36
  enabled: boolean;
37
+ baseUrl?: string;
38
  };
39
  }
40
 
41
+ interface CommitData {
42
+ commit: string;
43
+ version?: string;
44
+ }
45
+
46
+ const connitJson: CommitData = commit;
47
+
48
  const LOCAL_PROVIDERS = ['Ollama', 'LMStudio', 'OpenAILike'];
49
+ const versionHash = connitJson.commit;
50
+ const versionTag = connitJson.version;
51
  const GITHUB_URLS = {
52
  original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
53
  fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
54
+ commitJson: (branch: string) =>
55
+ `https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
56
  };
57
 
58
  function getSystemInfo(): SystemInfo {
 
303
  };
304
 
305
  export default function DebugTab() {
306
+ const { providers, latestBranch } = useSettings();
307
  const [activeProviders, setActiveProviders] = useState<ProviderStatus[]>([]);
308
  const [updateMessage, setUpdateMessage] = useState<string>('');
309
  const [systemInfo] = useState<SystemInfo>(getSystemInfo());
 
316
 
317
  try {
318
  const entries = Object.entries(providers) as [string, IProviderConfig][];
319
+ const statuses = await Promise.all(
320
+ entries
321
+ .filter(([, provider]) => LOCAL_PROVIDERS.includes(provider.name))
322
+ .map(async ([, provider]) => {
323
+ 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`;
329
+
330
+ // Access environment variables through import.meta.env
331
+ const url = import.meta.env[envVarName] || provider.settings.baseUrl || null; // Ensure baseUrl is used
332
+ console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
333
+
334
+ const status = await checkProviderStatus(url, provider.name);
335
+
336
+ return {
337
+ ...status,
338
+ enabled: provider.settings.enabled ?? false,
339
+ };
340
+ }),
341
+ );
342
+
343
+ setActiveProviders(statuses);
344
  } catch (error) {
345
  console.error('[Debug] Failed to update provider statuses:', error);
346
  }
 
363
  setIsCheckingUpdate(true);
364
  setUpdateMessage('Checking for updates...');
365
 
366
+ const branchToCheck = latestBranch ? 'main' : 'stable';
367
+ console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
 
 
368
 
369
+ const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
 
 
370
 
371
+ if (!localCommitResponse.ok) {
372
+ throw new Error('Failed to fetch local commit info');
373
+ }
 
374
 
375
+ const localCommitData = (await localCommitResponse.json()) as CommitData;
376
+ const remoteCommitHash = localCommitData.commit;
377
+ const currentCommitHash = versionHash;
378
 
379
+ if (remoteCommitHash !== currentCommitHash) {
380
  setUpdateMessage(
381
+ `Update available from ${branchToCheck} branch!\n` +
382
+ `Current: ${currentCommitHash.slice(0, 7)}\n` +
383
+ `Latest: ${remoteCommitHash.slice(0, 7)}`,
384
  );
385
  } else {
386
+ setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
387
  }
388
  } catch (error) {
389
  setUpdateMessage('Failed to check for updates');
 
391
  } finally {
392
  setIsCheckingUpdate(false);
393
  }
394
+ }, [isCheckingUpdate, latestBranch]);
395
 
396
  const handleCopyToClipboard = useCallback(() => {
397
  const debugInfo = {
 
406
  responseTime: provider.responseTime,
407
  url: provider.url,
408
  })),
409
+ Version: {
410
+ hash: versionHash.slice(0, 7),
411
+ branch: latestBranch ? 'main' : 'stable',
412
+ },
413
  Timestamp: new Date().toISOString(),
414
  };
415
+
416
  navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
417
+ toast.success('Debug information copied to clipboard!');
418
  });
419
+ }, [activeProviders, systemInfo, latestBranch]);
420
 
421
  return (
422
  <div className="p-4 space-y-6">
 
523
  <p className="text-sm font-medium text-bolt-elements-textPrimary font-mono">
524
  {versionHash.slice(0, 7)}
525
  <span className="ml-2 text-xs text-bolt-elements-textSecondary">
526
+ (v{versionTag || '0.0.1'}) - {latestBranch ? 'nightly' : 'stable'}
527
  </span>
528
  </p>
529
  </div>
app/components/settings/features/FeaturesTab.tsx CHANGED
@@ -3,18 +3,32 @@ import { Switch } from '~/components/ui/Switch';
3
  import { useSettings } from '~/lib/hooks/useSettings';
4
 
5
  export default function FeaturesTab() {
6
- const { debug, enableDebugMode, isLocalModel, enableLocalModels, eventLogs, enableEventLogs } = useSettings();
 
 
 
 
 
 
 
7
  return (
8
  <div className="p-4 bg-bolt-elements-bg-depth-2 border border-bolt-elements-borderColor rounded-lg mb-4">
9
  <div className="mb-6">
10
  <h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Optional Features</h3>
11
- <div className="flex items-center justify-between mb-2">
12
- <span className="text-bolt-elements-textPrimary">Debug Info</span>
13
- <Switch className="ml-auto" checked={debug} onCheckedChange={enableDebugMode} />
14
- </div>
15
- <div className="flex items-center justify-between mb-2">
16
- <span className="text-bolt-elements-textPrimary">Event Logs</span>
17
- <Switch className="ml-auto" checked={eventLogs} onCheckedChange={enableEventLogs} />
 
 
 
 
 
 
 
18
  </div>
19
  </div>
20
 
@@ -24,7 +38,7 @@ export default function FeaturesTab() {
24
  Disclaimer: Experimental features may be unstable and are subject to change.
25
  </p>
26
  <div className="flex items-center justify-between mb-2">
27
- <span className="text-bolt-elements-textPrimary">Enable Local Models</span>
28
  <Switch className="ml-auto" checked={isLocalModel} onCheckedChange={enableLocalModels} />
29
  </div>
30
  </div>
 
3
  import { useSettings } from '~/lib/hooks/useSettings';
4
 
5
  export default function FeaturesTab() {
6
+
7
+ const { debug, enableDebugMode, isLocalModel, enableLocalModels, enableEventLogs, latestBranch, enableLatestBranch } = useSettings();
8
+
9
+ const handleToggle = (enabled: boolean) => {
10
+ enableDebugMode(enabled);
11
+ enableEventLogs(enabled);
12
+ };
13
+
14
  return (
15
  <div className="p-4 bg-bolt-elements-bg-depth-2 border border-bolt-elements-borderColor rounded-lg mb-4">
16
  <div className="mb-6">
17
  <h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Optional Features</h3>
18
+ <div className="space-y-4">
19
+ <div className="flex items-center justify-between">
20
+ <span className="text-bolt-elements-textPrimary">Debug Features</span>
21
+ <Switch className="ml-auto" checked={debug} onCheckedChange={handleToggle} />
22
+ </div>
23
+ <div className="flex items-center justify-between">
24
+ <div>
25
+ <span className="text-bolt-elements-textPrimary">Use Main Branch</span>
26
+ <p className="text-sm text-bolt-elements-textSecondary">
27
+ Check for updates against the main branch instead of stable
28
+ </p>
29
+ </div>
30
+ <Switch className="ml-auto" checked={latestBranch} onCheckedChange={enableLatestBranch} />
31
+ </div>
32
  </div>
33
  </div>
34
 
 
38
  Disclaimer: Experimental features may be unstable and are subject to change.
39
  </p>
40
  <div className="flex items-center justify-between mb-2">
41
+ <span className="text-bolt-elements-textPrimary">Experimental Providers</span>
42
  <Switch className="ml-auto" checked={isLocalModel} onCheckedChange={enableLocalModels} />
43
  </div>
44
  </div>
app/components/settings/providers/ProvidersTab.tsx CHANGED
@@ -5,6 +5,9 @@ import { LOCAL_PROVIDERS, URL_CONFIGURABLE_PROVIDERS } from '~/lib/stores/settin
5
  import type { IProviderConfig } from '~/types/model';
6
  import { logStore } from '~/lib/stores/logs';
7
 
 
 
 
8
  export default function ProvidersTab() {
9
  const { providers, updateProviderSettings, isLocalModel } = useSettings();
10
  const [filteredProviders, setFilteredProviders] = useState<IProviderConfig[]>([]);
@@ -51,7 +54,15 @@ export default function ProvidersTab() {
51
  >
52
  <div className="flex items-center justify-between mb-2">
53
  <div className="flex items-center gap-2">
54
- <img src={`/icons/${provider.name}.svg`} alt={`${provider.name} icon`} className="w-6 h-6 dark:invert" />
 
 
 
 
 
 
 
 
55
  <span className="text-bolt-elements-textPrimary">{provider.name}</span>
56
  </div>
57
  <Switch
 
5
  import type { IProviderConfig } from '~/types/model';
6
  import { logStore } from '~/lib/stores/logs';
7
 
8
+ // Import a default fallback icon
9
+ import DefaultIcon from '/icons/Default.svg'; // Adjust the path as necessary
10
+
11
  export default function ProvidersTab() {
12
  const { providers, updateProviderSettings, isLocalModel } = useSettings();
13
  const [filteredProviders, setFilteredProviders] = useState<IProviderConfig[]>([]);
 
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;
62
+ }}
63
+ alt={`${provider.name} icon`}
64
+ className="w-6 h-6 dark:invert"
65
+ />
66
  <span className="text-bolt-elements-textPrimary">{provider.name}</span>
67
  </div>
68
  <Switch
app/components/workbench/FileTree.tsx CHANGED
@@ -2,6 +2,7 @@ import { memo, useEffect, useMemo, useState, type ReactNode } from 'react';
2
  import type { FileMap } from '~/lib/stores/files';
3
  import { classNames } from '~/utils/classNames';
4
  import { createScopedLogger, renderLogger } from '~/utils/logger';
 
5
 
6
  const logger = createScopedLogger('FileTree');
7
 
@@ -110,6 +111,22 @@ export const FileTree = memo(
110
  });
111
  };
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  return (
114
  <div className={classNames('text-sm', className, 'overflow-y-auto')}>
115
  {filteredFileList.map((fileOrFolder) => {
@@ -121,6 +138,12 @@ export const FileTree = memo(
121
  selected={selectedFile === fileOrFolder.fullPath}
122
  file={fileOrFolder}
123
  unsavedChanges={unsavedFiles?.has(fileOrFolder.fullPath)}
 
 
 
 
 
 
124
  onClick={() => {
125
  onFileSelect?.(fileOrFolder.fullPath);
126
  }}
@@ -134,6 +157,12 @@ export const FileTree = memo(
134
  folder={fileOrFolder}
135
  selected={allowFolderSelection && selectedFile === fileOrFolder.fullPath}
136
  collapsed={collapsedFolders.has(fileOrFolder.fullPath)}
 
 
 
 
 
 
137
  onClick={() => {
138
  toggleCollapseState(fileOrFolder.fullPath);
139
  }}
@@ -156,26 +185,67 @@ interface FolderProps {
156
  folder: FolderNode;
157
  collapsed: boolean;
158
  selected?: boolean;
 
 
159
  onClick: () => void;
160
  }
161
 
162
- function Folder({ folder: { depth, name }, collapsed, selected = false, onClick }: FolderProps) {
 
 
 
 
 
 
163
  return (
164
- <NodeButton
165
- className={classNames('group', {
166
- 'bg-transparent text-bolt-elements-item-contentDefault hover:text-bolt-elements-item-contentActive hover:bg-bolt-elements-item-backgroundActive':
167
- !selected,
168
- 'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
169
- })}
170
- depth={depth}
171
- iconClasses={classNames({
172
- 'i-ph:caret-right scale-98': collapsed,
173
- 'i-ph:caret-down scale-98': !collapsed,
174
- })}
175
- onClick={onClick}
176
  >
177
- {name}
178
- </NodeButton>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  );
180
  }
181
 
@@ -183,31 +253,43 @@ interface FileProps {
183
  file: FileNode;
184
  selected: boolean;
185
  unsavedChanges?: boolean;
 
 
186
  onClick: () => void;
187
  }
188
 
189
- function File({ file: { depth, name }, onClick, selected, unsavedChanges = false }: FileProps) {
 
 
 
 
 
 
 
190
  return (
191
- <NodeButton
192
- className={classNames('group', {
193
- 'bg-transparent hover:bg-bolt-elements-item-backgroundActive text-bolt-elements-item-contentDefault': !selected,
194
- 'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
195
- })}
196
- depth={depth}
197
- iconClasses={classNames('i-ph:file-duotone scale-98', {
198
- 'group-hover:text-bolt-elements-item-contentActive': !selected,
199
- })}
200
- onClick={onClick}
201
- >
202
- <div
203
- className={classNames('flex items-center', {
204
  'group-hover:text-bolt-elements-item-contentActive': !selected,
205
  })}
 
206
  >
207
- <div className="flex-1 truncate pr-2">{name}</div>
208
- {unsavedChanges && <span className="i-ph:circle-fill scale-68 shrink-0 text-orange-500" />}
209
- </div>
210
- </NodeButton>
 
 
 
 
 
 
211
  );
212
  }
213
 
 
2
  import type { FileMap } from '~/lib/stores/files';
3
  import { classNames } from '~/utils/classNames';
4
  import { createScopedLogger, renderLogger } from '~/utils/logger';
5
+ import * as ContextMenu from '@radix-ui/react-context-menu';
6
 
7
  const logger = createScopedLogger('FileTree');
8
 
 
111
  });
112
  };
113
 
114
+ const onCopyPath = (fileOrFolder: FileNode | FolderNode) => {
115
+ try {
116
+ navigator.clipboard.writeText(fileOrFolder.fullPath);
117
+ } catch (error) {
118
+ logger.error(error);
119
+ }
120
+ };
121
+
122
+ const onCopyRelativePath = (fileOrFolder: FileNode | FolderNode) => {
123
+ try {
124
+ navigator.clipboard.writeText(fileOrFolder.fullPath.substring((rootFolder || '').length));
125
+ } catch (error) {
126
+ logger.error(error);
127
+ }
128
+ };
129
+
130
  return (
131
  <div className={classNames('text-sm', className, 'overflow-y-auto')}>
132
  {filteredFileList.map((fileOrFolder) => {
 
138
  selected={selectedFile === fileOrFolder.fullPath}
139
  file={fileOrFolder}
140
  unsavedChanges={unsavedFiles?.has(fileOrFolder.fullPath)}
141
+ onCopyPath={() => {
142
+ onCopyPath(fileOrFolder);
143
+ }}
144
+ onCopyRelativePath={() => {
145
+ onCopyRelativePath(fileOrFolder);
146
+ }}
147
  onClick={() => {
148
  onFileSelect?.(fileOrFolder.fullPath);
149
  }}
 
157
  folder={fileOrFolder}
158
  selected={allowFolderSelection && selectedFile === fileOrFolder.fullPath}
159
  collapsed={collapsedFolders.has(fileOrFolder.fullPath)}
160
+ onCopyPath={() => {
161
+ onCopyPath(fileOrFolder);
162
+ }}
163
+ onCopyRelativePath={() => {
164
+ onCopyRelativePath(fileOrFolder);
165
+ }}
166
  onClick={() => {
167
  toggleCollapseState(fileOrFolder.fullPath);
168
  }}
 
185
  folder: FolderNode;
186
  collapsed: boolean;
187
  selected?: boolean;
188
+ onCopyPath: () => void;
189
+ onCopyRelativePath: () => void;
190
  onClick: () => void;
191
  }
192
 
193
+ interface FolderContextMenuProps {
194
+ onCopyPath?: () => void;
195
+ onCopyRelativePath?: () => void;
196
+ children: ReactNode;
197
+ }
198
+
199
+ function ContextMenuItem({ onSelect, children }: { onSelect?: () => void; children: ReactNode }) {
200
  return (
201
+ <ContextMenu.Item
202
+ onSelect={onSelect}
203
+ className="flex items-center gap-2 px-2 py-1.5 outline-0 text-sm text-bolt-elements-textPrimary cursor-pointer ws-nowrap text-bolt-elements-item-contentDefault hover:text-bolt-elements-item-contentActive hover:bg-bolt-elements-item-backgroundActive rounded-md"
 
 
 
 
 
 
 
 
 
204
  >
205
+ <span className="size-4 shrink-0"></span>
206
+ <span>{children}</span>
207
+ </ContextMenu.Item>
208
+ );
209
+ }
210
+
211
+ function FileContextMenu({ onCopyPath, onCopyRelativePath, children }: FolderContextMenuProps) {
212
+ return (
213
+ <ContextMenu.Root>
214
+ <ContextMenu.Trigger>{children}</ContextMenu.Trigger>
215
+ <ContextMenu.Portal>
216
+ <ContextMenu.Content
217
+ style={{ zIndex: 998 }}
218
+ className="border border-bolt-elements-borderColor rounded-md z-context-menu bg-bolt-elements-background-depth-1 dark:bg-bolt-elements-background-depth-2 data-[state=open]:animate-in animate-duration-100 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-98 w-56"
219
+ >
220
+ <ContextMenu.Group className="p-1 border-b-px border-solid border-bolt-elements-borderColor">
221
+ <ContextMenuItem onSelect={onCopyPath}>Copy path</ContextMenuItem>
222
+ <ContextMenuItem onSelect={onCopyRelativePath}>Copy relative path</ContextMenuItem>
223
+ </ContextMenu.Group>
224
+ </ContextMenu.Content>
225
+ </ContextMenu.Portal>
226
+ </ContextMenu.Root>
227
+ );
228
+ }
229
+
230
+ function Folder({ folder, collapsed, selected = false, onCopyPath, onCopyRelativePath, onClick }: FolderProps) {
231
+ return (
232
+ <FileContextMenu onCopyPath={onCopyPath} onCopyRelativePath={onCopyRelativePath}>
233
+ <NodeButton
234
+ className={classNames('group', {
235
+ 'bg-transparent text-bolt-elements-item-contentDefault hover:text-bolt-elements-item-contentActive hover:bg-bolt-elements-item-backgroundActive':
236
+ !selected,
237
+ 'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
238
+ })}
239
+ depth={folder.depth}
240
+ iconClasses={classNames({
241
+ 'i-ph:caret-right scale-98': collapsed,
242
+ 'i-ph:caret-down scale-98': !collapsed,
243
+ })}
244
+ onClick={onClick}
245
+ >
246
+ {folder.name}
247
+ </NodeButton>
248
+ </FileContextMenu>
249
  );
250
  }
251
 
 
253
  file: FileNode;
254
  selected: boolean;
255
  unsavedChanges?: boolean;
256
+ onCopyPath: () => void;
257
+ onCopyRelativePath: () => void;
258
  onClick: () => void;
259
  }
260
 
261
+ function File({
262
+ file: { depth, name },
263
+ onClick,
264
+ onCopyPath,
265
+ onCopyRelativePath,
266
+ selected,
267
+ unsavedChanges = false,
268
+ }: FileProps) {
269
  return (
270
+ <FileContextMenu onCopyPath={onCopyPath} onCopyRelativePath={onCopyRelativePath}>
271
+ <NodeButton
272
+ className={classNames('group', {
273
+ 'bg-transparent hover:bg-bolt-elements-item-backgroundActive text-bolt-elements-item-contentDefault':
274
+ !selected,
275
+ 'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
276
+ })}
277
+ depth={depth}
278
+ iconClasses={classNames('i-ph:file-duotone scale-98', {
 
 
 
 
279
  'group-hover:text-bolt-elements-item-contentActive': !selected,
280
  })}
281
+ onClick={onClick}
282
  >
283
+ <div
284
+ className={classNames('flex items-center', {
285
+ 'group-hover:text-bolt-elements-item-contentActive': !selected,
286
+ })}
287
+ >
288
+ <div className="flex-1 truncate pr-2">{name}</div>
289
+ {unsavedChanges && <span className="i-ph:circle-fill scale-68 shrink-0 text-orange-500" />}
290
+ </div>
291
+ </NodeButton>
292
+ </FileContextMenu>
293
  );
294
  }
295
 
app/components/workbench/Preview.tsx CHANGED
@@ -3,6 +3,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
3
  import { IconButton } from '~/components/ui/IconButton';
4
  import { workbenchStore } from '~/lib/stores/workbench';
5
  import { PortDropdown } from './PortDropdown';
 
6
 
7
  type ResizeSide = 'left' | 'right' | null;
8
 
@@ -20,6 +21,7 @@ export const Preview = memo(() => {
20
 
21
  const [url, setUrl] = useState('');
22
  const [iframeUrl, setIframeUrl] = useState<string | undefined>();
 
23
 
24
  // Toggle between responsive mode and device mode
25
  const [isDeviceModeOn, setIsDeviceModeOn] = useState(false);
@@ -218,12 +220,17 @@ export const Preview = memo(() => {
218
  )}
219
  <div className="bg-bolt-elements-background-depth-2 p-2 flex items-center gap-1.5">
220
  <IconButton icon="i-ph:arrow-clockwise" onClick={reloadPreview} />
221
-
 
 
 
 
222
  <div
223
  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
224
  focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive"
225
  >
226
  <input
 
227
  ref={inputRef}
228
  className="w-full bg-transparent outline-none"
229
  type="text"
@@ -281,7 +288,20 @@ export const Preview = memo(() => {
281
  }}
282
  >
283
  {activePreview ? (
284
- <iframe ref={iframeRef} className="border-none w-full h-full bg-white" src={iframeUrl} allowFullScreen />
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  ) : (
286
  <div className="flex w-full h-full justify-center items-center bg-white">No preview available</div>
287
  )}
 
3
  import { IconButton } from '~/components/ui/IconButton';
4
  import { workbenchStore } from '~/lib/stores/workbench';
5
  import { PortDropdown } from './PortDropdown';
6
+ import { ScreenshotSelector } from './ScreenshotSelector';
7
 
8
  type ResizeSide = 'left' | 'right' | null;
9
 
 
21
 
22
  const [url, setUrl] = useState('');
23
  const [iframeUrl, setIframeUrl] = useState<string | undefined>();
24
+ const [isSelectionMode, setIsSelectionMode] = useState(false);
25
 
26
  // Toggle between responsive mode and device mode
27
  const [isDeviceModeOn, setIsDeviceModeOn] = useState(false);
 
220
  )}
221
  <div className="bg-bolt-elements-background-depth-2 p-2 flex items-center gap-1.5">
222
  <IconButton icon="i-ph:arrow-clockwise" onClick={reloadPreview} />
223
+ <IconButton
224
+ icon="i-ph:selection"
225
+ onClick={() => setIsSelectionMode(!isSelectionMode)}
226
+ className={isSelectionMode ? 'bg-bolt-elements-background-depth-3' : ''}
227
+ />
228
  <div
229
  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
230
  focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive"
231
  >
232
  <input
233
+ title="URL"
234
  ref={inputRef}
235
  className="w-full bg-transparent outline-none"
236
  type="text"
 
288
  }}
289
  >
290
  {activePreview ? (
291
+ <>
292
+ <iframe
293
+ ref={iframeRef}
294
+ title="preview"
295
+ className="border-none w-full h-full bg-white"
296
+ src={iframeUrl}
297
+ allowFullScreen
298
+ />
299
+ <ScreenshotSelector
300
+ isSelectionMode={isSelectionMode}
301
+ setIsSelectionMode={setIsSelectionMode}
302
+ containerRef={iframeRef}
303
+ />
304
+ </>
305
  ) : (
306
  <div className="flex w-full h-full justify-center items-center bg-white">No preview available</div>
307
  )}
app/components/workbench/ScreenshotSelector.tsx ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { memo, useCallback, useEffect, useRef, useState } from 'react';
2
+ import { toast } from 'react-toastify';
3
+
4
+ interface ScreenshotSelectorProps {
5
+ isSelectionMode: boolean;
6
+ setIsSelectionMode: (mode: boolean) => void;
7
+ containerRef: React.RefObject<HTMLElement>;
8
+ }
9
+
10
+ export const ScreenshotSelector = memo(
11
+ ({ isSelectionMode, setIsSelectionMode, containerRef }: ScreenshotSelectorProps) => {
12
+ const [isCapturing, setIsCapturing] = useState(false);
13
+ const [selectionStart, setSelectionStart] = useState<{ x: number; y: number } | null>(null);
14
+ const [selectionEnd, setSelectionEnd] = useState<{ x: number; y: number } | null>(null);
15
+ const mediaStreamRef = useRef<MediaStream | null>(null);
16
+ const videoRef = useRef<HTMLVideoElement | null>(null);
17
+
18
+ useEffect(() => {
19
+ // Cleanup function to stop all tracks when component unmounts
20
+ return () => {
21
+ if (videoRef.current) {
22
+ videoRef.current.pause();
23
+ videoRef.current.srcObject = null;
24
+ videoRef.current.remove();
25
+ videoRef.current = null;
26
+ }
27
+
28
+ if (mediaStreamRef.current) {
29
+ mediaStreamRef.current.getTracks().forEach((track) => track.stop());
30
+ mediaStreamRef.current = null;
31
+ }
32
+ };
33
+ }, []);
34
+
35
+ const initializeStream = async () => {
36
+ if (!mediaStreamRef.current) {
37
+ try {
38
+ const stream = await navigator.mediaDevices.getDisplayMedia({
39
+ audio: false,
40
+ video: {
41
+ displaySurface: 'window',
42
+ preferCurrentTab: true,
43
+ surfaceSwitching: 'include',
44
+ systemAudio: 'exclude',
45
+ },
46
+ } as MediaStreamConstraints);
47
+
48
+ // Add handler for when sharing stops
49
+ stream.addEventListener('inactive', () => {
50
+ if (videoRef.current) {
51
+ videoRef.current.pause();
52
+ videoRef.current.srcObject = null;
53
+ videoRef.current.remove();
54
+ videoRef.current = null;
55
+ }
56
+
57
+ if (mediaStreamRef.current) {
58
+ mediaStreamRef.current.getTracks().forEach((track) => track.stop());
59
+ mediaStreamRef.current = null;
60
+ }
61
+
62
+ setIsSelectionMode(false);
63
+ setSelectionStart(null);
64
+ setSelectionEnd(null);
65
+ setIsCapturing(false);
66
+ });
67
+
68
+ mediaStreamRef.current = stream;
69
+
70
+ // Initialize video element if needed
71
+ if (!videoRef.current) {
72
+ const video = document.createElement('video');
73
+ video.style.opacity = '0';
74
+ video.style.position = 'fixed';
75
+ video.style.pointerEvents = 'none';
76
+ video.style.zIndex = '-1';
77
+ document.body.appendChild(video);
78
+ videoRef.current = video;
79
+ }
80
+
81
+ // Set up video with the stream
82
+ videoRef.current.srcObject = stream;
83
+ await videoRef.current.play();
84
+ } catch (error) {
85
+ console.error('Failed to initialize stream:', error);
86
+ setIsSelectionMode(false);
87
+ toast.error('Failed to initialize screen capture');
88
+ }
89
+ }
90
+
91
+ return mediaStreamRef.current;
92
+ };
93
+
94
+ const handleCopySelection = useCallback(async () => {
95
+ if (!isSelectionMode || !selectionStart || !selectionEnd || !containerRef.current) {
96
+ return;
97
+ }
98
+
99
+ setIsCapturing(true);
100
+
101
+ try {
102
+ const stream = await initializeStream();
103
+
104
+ if (!stream || !videoRef.current) {
105
+ return;
106
+ }
107
+
108
+ // Wait for video to be ready
109
+ await new Promise((resolve) => setTimeout(resolve, 300));
110
+
111
+ // Create temporary canvas for full screenshot
112
+ const tempCanvas = document.createElement('canvas');
113
+ tempCanvas.width = videoRef.current.videoWidth;
114
+ tempCanvas.height = videoRef.current.videoHeight;
115
+
116
+ const tempCtx = tempCanvas.getContext('2d');
117
+
118
+ if (!tempCtx) {
119
+ throw new Error('Failed to get temporary canvas context');
120
+ }
121
+
122
+ // Draw the full video frame
123
+ tempCtx.drawImage(videoRef.current, 0, 0);
124
+
125
+ // Calculate scale factor between video and screen
126
+ const scaleX = videoRef.current.videoWidth / window.innerWidth;
127
+ const scaleY = videoRef.current.videoHeight / window.innerHeight;
128
+
129
+ // Get window scroll position
130
+ const scrollX = window.scrollX;
131
+ const scrollY = window.scrollY + 40;
132
+
133
+ // Get the container's position in the page
134
+ const containerRect = containerRef.current.getBoundingClientRect();
135
+
136
+ // Offset adjustments for more accurate clipping
137
+ const leftOffset = -9; // Adjust left position
138
+ const bottomOffset = -14; // Adjust bottom position
139
+
140
+ // Calculate the scaled coordinates with scroll offset and adjustments
141
+ const scaledX = Math.round(
142
+ (containerRect.left + Math.min(selectionStart.x, selectionEnd.x) + scrollX + leftOffset) * scaleX,
143
+ );
144
+ const scaledY = Math.round(
145
+ (containerRect.top + Math.min(selectionStart.y, selectionEnd.y) + scrollY + bottomOffset) * scaleY,
146
+ );
147
+ const scaledWidth = Math.round(Math.abs(selectionEnd.x - selectionStart.x) * scaleX);
148
+ const scaledHeight = Math.round(Math.abs(selectionEnd.y - selectionStart.y) * scaleY);
149
+
150
+ // Create final canvas for the cropped area
151
+ const canvas = document.createElement('canvas');
152
+ canvas.width = Math.round(Math.abs(selectionEnd.x - selectionStart.x));
153
+ canvas.height = Math.round(Math.abs(selectionEnd.y - selectionStart.y));
154
+
155
+ const ctx = canvas.getContext('2d');
156
+
157
+ if (!ctx) {
158
+ throw new Error('Failed to get canvas context');
159
+ }
160
+
161
+ // Draw the cropped area
162
+ ctx.drawImage(tempCanvas, scaledX, scaledY, scaledWidth, scaledHeight, 0, 0, canvas.width, canvas.height);
163
+
164
+ // Convert to blob
165
+ const blob = await new Promise<Blob>((resolve, reject) => {
166
+ canvas.toBlob((blob) => {
167
+ if (blob) {
168
+ resolve(blob);
169
+ } else {
170
+ reject(new Error('Failed to create blob'));
171
+ }
172
+ }, 'image/png');
173
+ });
174
+
175
+ // Create a FileReader to convert blob to base64
176
+ const reader = new FileReader();
177
+
178
+ reader.onload = (e) => {
179
+ const base64Image = e.target?.result as string;
180
+
181
+ // Find the textarea element
182
+ const textarea = document.querySelector('textarea');
183
+
184
+ if (textarea) {
185
+ // Get the setters from the BaseChat component
186
+ const setUploadedFiles = (window as any).__BOLT_SET_UPLOADED_FILES__;
187
+ const setImageDataList = (window as any).__BOLT_SET_IMAGE_DATA_LIST__;
188
+ const uploadedFiles = (window as any).__BOLT_UPLOADED_FILES__ || [];
189
+ const imageDataList = (window as any).__BOLT_IMAGE_DATA_LIST__ || [];
190
+
191
+ if (setUploadedFiles && setImageDataList) {
192
+ // Update the files and image data
193
+ const file = new File([blob], 'screenshot.png', { type: 'image/png' });
194
+ setUploadedFiles([...uploadedFiles, file]);
195
+ setImageDataList([...imageDataList, base64Image]);
196
+ toast.success('Screenshot captured and added to chat');
197
+ } else {
198
+ toast.error('Could not add screenshot to chat');
199
+ }
200
+ }
201
+ };
202
+ reader.readAsDataURL(blob);
203
+ } catch (error) {
204
+ console.error('Failed to capture screenshot:', error);
205
+ toast.error('Failed to capture screenshot');
206
+
207
+ if (mediaStreamRef.current) {
208
+ mediaStreamRef.current.getTracks().forEach((track) => track.stop());
209
+ mediaStreamRef.current = null;
210
+ }
211
+ } finally {
212
+ setIsCapturing(false);
213
+ setSelectionStart(null);
214
+ setSelectionEnd(null);
215
+ setIsSelectionMode(false); // Turn off selection mode after capture
216
+ }
217
+ }, [isSelectionMode, selectionStart, selectionEnd, containerRef, setIsSelectionMode]);
218
+
219
+ const handleSelectionStart = useCallback(
220
+ (e: React.MouseEvent) => {
221
+ e.preventDefault();
222
+ e.stopPropagation();
223
+
224
+ if (!isSelectionMode) {
225
+ return;
226
+ }
227
+
228
+ const rect = e.currentTarget.getBoundingClientRect();
229
+ const x = e.clientX - rect.left;
230
+ const y = e.clientY - rect.top;
231
+ setSelectionStart({ x, y });
232
+ setSelectionEnd({ x, y });
233
+ },
234
+ [isSelectionMode],
235
+ );
236
+
237
+ const handleSelectionMove = useCallback(
238
+ (e: React.MouseEvent) => {
239
+ e.preventDefault();
240
+ e.stopPropagation();
241
+
242
+ if (!isSelectionMode || !selectionStart) {
243
+ return;
244
+ }
245
+
246
+ const rect = e.currentTarget.getBoundingClientRect();
247
+ const x = e.clientX - rect.left;
248
+ const y = e.clientY - rect.top;
249
+ setSelectionEnd({ x, y });
250
+ },
251
+ [isSelectionMode, selectionStart],
252
+ );
253
+
254
+ if (!isSelectionMode) {
255
+ return null;
256
+ }
257
+
258
+ return (
259
+ <div
260
+ className="absolute inset-0 cursor-crosshair"
261
+ onMouseDown={handleSelectionStart}
262
+ onMouseMove={handleSelectionMove}
263
+ onMouseUp={handleCopySelection}
264
+ onMouseLeave={() => {
265
+ if (selectionStart) {
266
+ setSelectionStart(null);
267
+ }
268
+ }}
269
+ style={{
270
+ backgroundColor: isCapturing ? 'transparent' : 'rgba(0, 0, 0, 0.1)',
271
+ userSelect: 'none',
272
+ WebkitUserSelect: 'none',
273
+ pointerEvents: 'all',
274
+ opacity: isCapturing ? 0 : 1,
275
+ zIndex: 50,
276
+ transition: 'opacity 0.1s ease-in-out',
277
+ }}
278
+ >
279
+ {selectionStart && selectionEnd && !isCapturing && (
280
+ <div
281
+ className="absolute border-2 border-blue-500 bg-blue-200 bg-opacity-20"
282
+ style={{
283
+ left: Math.min(selectionStart.x, selectionEnd.x),
284
+ top: Math.min(selectionStart.y, selectionEnd.y),
285
+ width: Math.abs(selectionEnd.x - selectionStart.x),
286
+ height: Math.abs(selectionEnd.y - selectionStart.y),
287
+ }}
288
+ />
289
+ )}
290
+ </div>
291
+ );
292
+ },
293
+ );
app/lib/.server/llm/api-key.ts CHANGED
@@ -39,6 +39,8 @@ export function getAPIKey(cloudflareEnv: Env, provider: string, userApiKeys?: Re
39
  return env.TOGETHER_API_KEY || cloudflareEnv.TOGETHER_API_KEY;
40
  case 'xAI':
41
  return env.XAI_API_KEY || cloudflareEnv.XAI_API_KEY;
 
 
42
  case 'Cohere':
43
  return env.COHERE_API_KEY;
44
  case 'AzureOpenAI':
 
39
  return env.TOGETHER_API_KEY || cloudflareEnv.TOGETHER_API_KEY;
40
  case 'xAI':
41
  return env.XAI_API_KEY || cloudflareEnv.XAI_API_KEY;
42
+ case 'Perplexity':
43
+ return env.PERPLEXITY_API_KEY || cloudflareEnv.PERPLEXITY_API_KEY;
44
  case 'Cohere':
45
  return env.COHERE_API_KEY;
46
  case 'AzureOpenAI':
app/lib/.server/llm/model.ts CHANGED
@@ -128,6 +128,15 @@ export function getXAIModel(apiKey: OptionalApiKey, model: string) {
128
  return openai(model);
129
  }
130
 
 
 
 
 
 
 
 
 
 
131
  export function getModel(
132
  provider: string,
133
  model: string,
@@ -170,6 +179,8 @@ export function getModel(
170
  return getXAIModel(apiKey, model);
171
  case 'Cohere':
172
  return getCohereAIModel(apiKey, model);
 
 
173
  default:
174
  return getOllamaModel(baseURL, model);
175
  }
 
128
  return openai(model);
129
  }
130
 
131
+ export function getPerplexityModel(apiKey: OptionalApiKey, model: string) {
132
+ const perplexity = createOpenAI({
133
+ baseURL: 'https://api.perplexity.ai/',
134
+ apiKey,
135
+ });
136
+
137
+ return perplexity(model);
138
+ }
139
+
140
  export function getModel(
141
  provider: string,
142
  model: string,
 
179
  return getXAIModel(apiKey, model);
180
  case 'Cohere':
181
  return getCohereAIModel(apiKey, model);
182
+ case 'Perplexity':
183
+ return getPerplexityModel(apiKey, model);
184
  default:
185
  return getOllamaModel(baseURL, model);
186
  }
app/lib/.server/llm/stream-text.ts CHANGED
@@ -3,6 +3,7 @@ import { getModel } from '~/lib/.server/llm/model';
3
  import { MAX_TOKENS } from './constants';
4
  import { getSystemPrompt } from './prompts';
5
  import { DEFAULT_MODEL, DEFAULT_PROVIDER, getModelList, MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
 
6
  import type { IProviderSetting } from '~/types/model';
7
 
8
  interface ToolResult<Name extends string, Args, Result> {
@@ -23,6 +24,78 @@ export type Messages = Message[];
23
 
24
  export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
27
  const textContent = Array.isArray(message.content)
28
  ? message.content.find((item) => item.type === 'text')?.text || ''
@@ -64,9 +137,10 @@ export async function streamText(props: {
64
  env: Env;
65
  options?: StreamingOptions;
66
  apiKeys?: Record<string, string>;
 
67
  providerSettings?: Record<string, IProviderSetting>;
68
  }) {
69
- const { messages, env, options, apiKeys, providerSettings } = props;
70
  let currentModel = DEFAULT_MODEL;
71
  let currentProvider = DEFAULT_PROVIDER.name;
72
  const MODEL_LIST = await getModelList(apiKeys || {}, providerSettings);
@@ -80,6 +154,12 @@ export async function streamText(props: {
80
 
81
  currentProvider = provider;
82
 
 
 
 
 
 
 
83
  return { ...message, content };
84
  }
85
 
@@ -90,9 +170,17 @@ export async function streamText(props: {
90
 
91
  const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS;
92
 
 
 
 
 
 
 
 
 
93
  return _streamText({
94
  model: getModel(currentProvider, currentModel, env, apiKeys, providerSettings) as any,
95
- system: getSystemPrompt(),
96
  maxTokens: dynamicMaxTokens,
97
  messages: convertToCoreMessages(processedMessages as any),
98
  ...options,
 
3
  import { MAX_TOKENS } from './constants';
4
  import { getSystemPrompt } from './prompts';
5
  import { DEFAULT_MODEL, DEFAULT_PROVIDER, getModelList, MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
6
+ import ignore from 'ignore';
7
  import type { IProviderSetting } from '~/types/model';
8
 
9
  interface ToolResult<Name extends string, Args, Result> {
 
24
 
25
  export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;
26
 
27
+ export interface File {
28
+ type: 'file';
29
+ content: string;
30
+ isBinary: boolean;
31
+ }
32
+
33
+ export interface Folder {
34
+ type: 'folder';
35
+ }
36
+
37
+ type Dirent = File | Folder;
38
+
39
+ export type FileMap = Record<string, Dirent | undefined>;
40
+
41
+ export function simplifyBoltActions(input: string): string {
42
+ // Using regex to match boltAction tags that have type="file"
43
+ const regex = /(<boltAction[^>]*type="file"[^>]*>)([\s\S]*?)(<\/boltAction>)/g;
44
+
45
+ // Replace each matching occurrence
46
+ return input.replace(regex, (_0, openingTag, _2, closingTag) => {
47
+ return `${openingTag}\n ...\n ${closingTag}`;
48
+ });
49
+ }
50
+
51
+ // Common patterns to ignore, similar to .gitignore
52
+ const IGNORE_PATTERNS = [
53
+ 'node_modules/**',
54
+ '.git/**',
55
+ 'dist/**',
56
+ 'build/**',
57
+ '.next/**',
58
+ 'coverage/**',
59
+ '.cache/**',
60
+ '.vscode/**',
61
+ '.idea/**',
62
+ '**/*.log',
63
+ '**/.DS_Store',
64
+ '**/npm-debug.log*',
65
+ '**/yarn-debug.log*',
66
+ '**/yarn-error.log*',
67
+ '**/*lock.json',
68
+ '**/*lock.yml',
69
+ ];
70
+ const ig = ignore().add(IGNORE_PATTERNS);
71
+
72
+ function createFilesContext(files: FileMap) {
73
+ let filePaths = Object.keys(files);
74
+ filePaths = filePaths.filter((x) => {
75
+ const relPath = x.replace('/home/project/', '');
76
+ return !ig.ignores(relPath);
77
+ });
78
+
79
+ const fileContexts = filePaths
80
+ .filter((x) => files[x] && files[x].type == 'file')
81
+ .map((path) => {
82
+ const dirent = files[path];
83
+
84
+ if (!dirent || dirent.type == 'folder') {
85
+ return '';
86
+ }
87
+
88
+ const codeWithLinesNumbers = dirent.content
89
+ .split('\n')
90
+ .map((v, i) => `${i + 1}|${v}`)
91
+ .join('\n');
92
+
93
+ return `<file path="${path}">\n${codeWithLinesNumbers}\n</file>`;
94
+ });
95
+
96
+ return `Below are the code files present in the webcontainer:\ncode format:\n<line number>|<line content>\n <codebase>${fileContexts.join('\n\n')}\n\n</codebase>`;
97
+ }
98
+
99
  function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
100
  const textContent = Array.isArray(message.content)
101
  ? message.content.find((item) => item.type === 'text')?.text || ''
 
137
  env: Env;
138
  options?: StreamingOptions;
139
  apiKeys?: Record<string, string>;
140
+ files?: FileMap;
141
  providerSettings?: Record<string, IProviderSetting>;
142
  }) {
143
+ const { messages, env, options, apiKeys, files, providerSettings } = props;
144
  let currentModel = DEFAULT_MODEL;
145
  let currentProvider = DEFAULT_PROVIDER.name;
146
  const MODEL_LIST = await getModelList(apiKeys || {}, providerSettings);
 
154
 
155
  currentProvider = provider;
156
 
157
+ return { ...message, content };
158
+ } else if (message.role == 'assistant') {
159
+ const content = message.content;
160
+
161
+ // content = simplifyBoltActions(content);
162
+
163
  return { ...message, content };
164
  }
165
 
 
170
 
171
  const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS;
172
 
173
+ let systemPrompt = getSystemPrompt();
174
+ let codeContext = '';
175
+
176
+ if (files) {
177
+ codeContext = createFilesContext(files);
178
+ systemPrompt = `${systemPrompt}\n\n ${codeContext}`;
179
+ }
180
+
181
  return _streamText({
182
  model: getModel(currentProvider, currentModel, env, apiKeys, providerSettings) as any,
183
+ system: systemPrompt,
184
  maxTokens: dynamicMaxTokens,
185
  messages: convertToCoreMessages(processedMessages as any),
186
  ...options,
app/lib/hooks/useMessageParser.ts CHANGED
@@ -23,14 +23,14 @@ const messageParser = new StreamingMessageParser({
23
  logger.trace('onActionOpen', data.action);
24
 
25
  // we only add shell actions when when the close tag got parsed because only then we have the content
26
- if (data.action.type !== 'shell') {
27
  workbenchStore.addAction(data);
28
  }
29
  },
30
  onActionClose: (data) => {
31
  logger.trace('onActionClose', data.action);
32
 
33
- if (data.action.type === 'shell') {
34
  workbenchStore.addAction(data);
35
  }
36
 
 
23
  logger.trace('onActionOpen', data.action);
24
 
25
  // we only add shell actions when when the close tag got parsed because only then we have the content
26
+ if (data.action.type === 'file') {
27
  workbenchStore.addAction(data);
28
  }
29
  },
30
  onActionClose: (data) => {
31
  logger.trace('onActionClose', data.action);
32
 
33
+ if (data.action.type !== 'file') {
34
  workbenchStore.addAction(data);
35
  }
36
 
app/lib/hooks/useSettings.tsx CHANGED
@@ -5,19 +5,50 @@ import {
5
  isLocalModelsEnabled,
6
  LOCAL_PROVIDERS,
7
  providersStore,
 
8
  } from '~/lib/stores/settings';
9
  import { useCallback, useEffect, useState } from 'react';
10
  import Cookies from 'js-cookie';
11
  import type { IProviderSetting, ProviderInfo } from '~/types/model';
12
  import { logStore } from '~/lib/stores/logs'; // assuming logStore is imported from this location
 
 
 
 
 
 
 
 
13
 
14
  export function useSettings() {
15
  const providers = useStore(providersStore);
16
  const debug = useStore(isDebugMode);
17
  const eventLogs = useStore(isEventLogsEnabled);
18
  const isLocalModel = useStore(isLocalModelsEnabled);
 
19
  const [activeProviders, setActiveProviders] = useState<ProviderInfo[]>([]);
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  // reading values from cookies on mount
22
  useEffect(() => {
23
  const savedProviders = Cookies.get('providers');
@@ -60,6 +91,25 @@ export function useSettings() {
60
  if (savedLocalModels) {
61
  isLocalModelsEnabled.set(savedLocalModels === 'true');
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }, []);
64
 
65
  // writing values to cookies on change
@@ -111,6 +161,12 @@ export function useSettings() {
111
  Cookies.set('isLocalModelsEnabled', String(enabled));
112
  }, []);
113
 
 
 
 
 
 
 
114
  return {
115
  providers,
116
  activeProviders,
@@ -121,5 +177,7 @@ export function useSettings() {
121
  enableEventLogs,
122
  isLocalModel,
123
  enableLocalModels,
 
 
124
  };
125
  }
 
5
  isLocalModelsEnabled,
6
  LOCAL_PROVIDERS,
7
  providersStore,
8
+ latestBranchStore,
9
  } from '~/lib/stores/settings';
10
  import { useCallback, useEffect, useState } from 'react';
11
  import Cookies from 'js-cookie';
12
  import type { IProviderSetting, ProviderInfo } from '~/types/model';
13
  import { logStore } from '~/lib/stores/logs'; // assuming logStore is imported from this location
14
+ import commit from '~/commit.json';
15
+
16
+ interface CommitData {
17
+ commit: string;
18
+ version?: string;
19
+ }
20
+
21
+ const commitJson: CommitData = commit;
22
 
23
  export function useSettings() {
24
  const providers = useStore(providersStore);
25
  const debug = useStore(isDebugMode);
26
  const eventLogs = useStore(isEventLogsEnabled);
27
  const isLocalModel = useStore(isLocalModelsEnabled);
28
+ const latestBranch = useStore(latestBranchStore);
29
  const [activeProviders, setActiveProviders] = useState<ProviderInfo[]>([]);
30
 
31
+ // Function to check if we're on stable version
32
+ const checkIsStableVersion = async () => {
33
+ try {
34
+ const stableResponse = await fetch(
35
+ `https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/refs/tags/v${commitJson.version}/app/commit.json`,
36
+ );
37
+
38
+ if (!stableResponse.ok) {
39
+ console.warn('Failed to fetch stable commit info');
40
+ return false;
41
+ }
42
+
43
+ const stableData = (await stableResponse.json()) as CommitData;
44
+
45
+ return commit.commit === stableData.commit;
46
+ } catch (error) {
47
+ console.warn('Error checking stable version:', error);
48
+ return false;
49
+ }
50
+ };
51
+
52
  // reading values from cookies on mount
53
  useEffect(() => {
54
  const savedProviders = Cookies.get('providers');
 
91
  if (savedLocalModels) {
92
  isLocalModelsEnabled.set(savedLocalModels === 'true');
93
  }
94
+
95
+ // load latest branch setting from cookies or determine based on version
96
+ const savedLatestBranch = Cookies.get('latestBranch');
97
+ let checkCommit = Cookies.get('commitHash');
98
+
99
+ if (checkCommit === undefined) {
100
+ checkCommit = commit.commit;
101
+ }
102
+ if (savedLatestBranch === undefined || checkCommit !== commit.commit) {
103
+ // If setting hasn't been set by user, check version
104
+ checkIsStableVersion().then((isStable) => {
105
+ const shouldUseLatest = !isStable;
106
+ latestBranchStore.set(shouldUseLatest);
107
+ Cookies.set('latestBranch', String(shouldUseLatest));
108
+ Cookies.set('commitHash', String(commit.commit));
109
+ });
110
+ } else {
111
+ latestBranchStore.set(savedLatestBranch === 'true');
112
+ }
113
  }, []);
114
 
115
  // writing values to cookies on change
 
161
  Cookies.set('isLocalModelsEnabled', String(enabled));
162
  }, []);
163
 
164
+ const enableLatestBranch = useCallback((enabled: boolean) => {
165
+ latestBranchStore.set(enabled);
166
+ logStore.logSystem(`Main branch updates ${enabled ? 'enabled' : 'disabled'}`);
167
+ Cookies.set('latestBranch', String(enabled));
168
+ }, []);
169
+
170
  return {
171
  providers,
172
  activeProviders,
 
177
  enableEventLogs,
178
  isLocalModel,
179
  enableLocalModels,
180
+ latestBranch,
181
+ enableLatestBranch,
182
  };
183
  }
app/lib/stores/settings.ts CHANGED
@@ -46,3 +46,5 @@ export const isDebugMode = atom(false);
46
  export const isEventLogsEnabled = atom(false);
47
 
48
  export const isLocalModelsEnabled = atom(true);
 
 
 
46
  export const isEventLogsEnabled = atom(false);
47
 
48
  export const isLocalModelsEnabled = atom(true);
49
+
50
+ export const latestBranchStore = atom(false);
app/lib/stores/workbench.ts CHANGED
@@ -16,6 +16,7 @@ import * as nodePath from 'node:path';
16
  import { extractRelativePath } from '~/utils/diff';
17
  import { description } from '~/lib/persistence';
18
  import Cookies from 'js-cookie';
 
19
 
20
  export interface ArtifactState {
21
  id: string;
@@ -262,9 +263,9 @@ export class WorkbenchStore {
262
  this.artifacts.setKey(messageId, { ...artifact, ...state });
263
  }
264
  addAction(data: ActionCallbackData) {
265
- this._addAction(data);
266
 
267
- // this.addToExecutionQueue(()=>this._addAction(data))
268
  }
269
  async _addAction(data: ActionCallbackData) {
270
  const { messageId } = data;
@@ -280,7 +281,7 @@ export class WorkbenchStore {
280
 
281
  runAction(data: ActionCallbackData, isStreaming: boolean = false) {
282
  if (isStreaming) {
283
- this._runAction(data, isStreaming);
284
  } else {
285
  this.addToExecutionQueue(() => this._runAction(data, isStreaming));
286
  }
@@ -294,6 +295,12 @@ export class WorkbenchStore {
294
  unreachable('Artifact not found');
295
  }
296
 
 
 
 
 
 
 
297
  if (data.action.type === 'file') {
298
  const wc = await webcontainer;
299
  const fullPath = nodePath.join(wc.workdir, data.action.filePath);
@@ -323,6 +330,10 @@ export class WorkbenchStore {
323
  }
324
  }
325
 
 
 
 
 
326
  #getArtifact(id: string) {
327
  const artifacts = this.artifacts.get();
328
  return artifacts[id];
 
16
  import { extractRelativePath } from '~/utils/diff';
17
  import { description } from '~/lib/persistence';
18
  import Cookies from 'js-cookie';
19
+ import { createSampler } from '~/utils/sampler';
20
 
21
  export interface ArtifactState {
22
  id: string;
 
263
  this.artifacts.setKey(messageId, { ...artifact, ...state });
264
  }
265
  addAction(data: ActionCallbackData) {
266
+ // this._addAction(data);
267
 
268
+ this.addToExecutionQueue(() => this._addAction(data));
269
  }
270
  async _addAction(data: ActionCallbackData) {
271
  const { messageId } = data;
 
281
 
282
  runAction(data: ActionCallbackData, isStreaming: boolean = false) {
283
  if (isStreaming) {
284
+ this.actionStreamSampler(data, isStreaming);
285
  } else {
286
  this.addToExecutionQueue(() => this._runAction(data, isStreaming));
287
  }
 
295
  unreachable('Artifact not found');
296
  }
297
 
298
+ const action = artifact.runner.actions.get()[data.actionId];
299
+
300
+ if (!action || action.executed) {
301
+ return;
302
+ }
303
+
304
  if (data.action.type === 'file') {
305
  const wc = await webcontainer;
306
  const fullPath = nodePath.join(wc.workdir, data.action.filePath);
 
330
  }
331
  }
332
 
333
+ actionStreamSampler = createSampler(async (data: ActionCallbackData, isStreaming: boolean = false) => {
334
+ return await this._runAction(data, isStreaming);
335
+ }, 100); // TODO: remove this magic number to have it configurable
336
+
337
  #getArtifact(id: string) {
338
  const artifacts = this.artifacts.get();
339
  return artifacts[id];
app/routes/api.chat.ts CHANGED
@@ -1,4 +1,5 @@
1
  import { type ActionFunctionArgs } from '@remix-run/cloudflare';
 
2
  import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS } from '~/lib/.server/llm/constants';
3
  import { CONTINUE_PROMPT } from '~/lib/.server/llm/prompts';
4
  import { streamText, type Messages, type StreamingOptions } from '~/lib/.server/llm/stream-text';
@@ -9,17 +10,15 @@ export async function action(args: ActionFunctionArgs) {
9
  return chatAction(args);
10
  }
11
 
12
- function parseCookies(cookieHeader: string) {
13
- const cookies: any = {};
14
 
15
- // Split the cookie string by semicolons and spaces
16
  const items = cookieHeader.split(';').map((cookie) => cookie.trim());
17
 
18
  items.forEach((item) => {
19
  const [name, ...rest] = item.split('=');
20
 
21
  if (name && rest) {
22
- // Decode the name and value, and join value parts in case it contains '='
23
  const decodedName = decodeURIComponent(name.trim());
24
  const decodedValue = decodeURIComponent(rest.join('=').trim());
25
  cookies[decodedName] = decodedValue;
@@ -30,14 +29,12 @@ function parseCookies(cookieHeader: string) {
30
  }
31
 
32
  async function chatAction({ context, request }: ActionFunctionArgs) {
33
- const { messages } = await request.json<{
34
  messages: Messages;
35
- model: string;
36
  }>();
37
 
38
  const cookieHeader = request.headers.get('Cookie');
39
-
40
- // Parse the cookie's value (returns an object or null if no cookie exists)
41
  const apiKeys = JSON.parse(parseCookies(cookieHeader || '').apiKeys || '{}');
42
  const providerSettings: Record<string, IProviderSetting> = JSON.parse(
43
  parseCookies(cookieHeader || '').providers || '{}',
@@ -45,12 +42,42 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
45
 
46
  const stream = new SwitchableStream();
47
 
 
 
 
 
 
 
48
  try {
49
  const options: StreamingOptions = {
50
  toolChoice: 'none',
51
- onFinish: async ({ text: content, finishReason }) => {
 
 
 
 
 
 
 
 
52
  if (finishReason !== 'length') {
53
- return stream.close();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
 
56
  if (stream.switches >= MAX_RESPONSE_SEGMENTS) {
@@ -64,15 +91,29 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
64
  messages.push({ role: 'assistant', content });
65
  messages.push({ role: 'user', content: CONTINUE_PROMPT });
66
 
67
- const result = await streamText({ messages, env: context.cloudflare.env, options, apiKeys, providerSettings });
 
 
 
 
 
 
 
68
 
69
- return stream.switchSource(result.toAIStream());
70
  },
71
  };
72
 
73
- const result = await streamText({ messages, env: context.cloudflare.env, options, apiKeys, providerSettings });
 
 
 
 
 
 
 
74
 
75
- stream.switchSource(result.toAIStream());
76
 
77
  return new Response(stream.readable, {
78
  status: 200,
@@ -81,7 +122,7 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
81
  },
82
  });
83
  } catch (error: any) {
84
- console.log(error);
85
 
86
  if (error.message?.includes('API key')) {
87
  throw new Response('Invalid or missing API key', {
 
1
  import { type ActionFunctionArgs } from '@remix-run/cloudflare';
2
+ import { createDataStream } from 'ai';
3
  import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS } from '~/lib/.server/llm/constants';
4
  import { CONTINUE_PROMPT } from '~/lib/.server/llm/prompts';
5
  import { streamText, type Messages, type StreamingOptions } from '~/lib/.server/llm/stream-text';
 
10
  return chatAction(args);
11
  }
12
 
13
+ function parseCookies(cookieHeader: string): Record<string, string> {
14
+ const cookies: Record<string, string> = {};
15
 
 
16
  const items = cookieHeader.split(';').map((cookie) => cookie.trim());
17
 
18
  items.forEach((item) => {
19
  const [name, ...rest] = item.split('=');
20
 
21
  if (name && rest) {
 
22
  const decodedName = decodeURIComponent(name.trim());
23
  const decodedValue = decodeURIComponent(rest.join('=').trim());
24
  cookies[decodedName] = decodedValue;
 
29
  }
30
 
31
  async function chatAction({ context, request }: ActionFunctionArgs) {
32
+ const { messages, files } = await request.json<{
33
  messages: Messages;
34
+ files: any;
35
  }>();
36
 
37
  const cookieHeader = request.headers.get('Cookie');
 
 
38
  const apiKeys = JSON.parse(parseCookies(cookieHeader || '').apiKeys || '{}');
39
  const providerSettings: Record<string, IProviderSetting> = JSON.parse(
40
  parseCookies(cookieHeader || '').providers || '{}',
 
42
 
43
  const stream = new SwitchableStream();
44
 
45
+ const cumulativeUsage = {
46
+ completionTokens: 0,
47
+ promptTokens: 0,
48
+ totalTokens: 0,
49
+ };
50
+
51
  try {
52
  const options: StreamingOptions = {
53
  toolChoice: 'none',
54
+ onFinish: async ({ text: content, finishReason, usage }) => {
55
+ console.log('usage', usage);
56
+
57
+ if (usage) {
58
+ cumulativeUsage.completionTokens += usage.completionTokens || 0;
59
+ cumulativeUsage.promptTokens += usage.promptTokens || 0;
60
+ cumulativeUsage.totalTokens += usage.totalTokens || 0;
61
+ }
62
+
63
  if (finishReason !== 'length') {
64
+ return stream
65
+ .switchSource(
66
+ createDataStream({
67
+ async execute(dataStream) {
68
+ dataStream.writeMessageAnnotation({
69
+ type: 'usage',
70
+ value: {
71
+ completionTokens: cumulativeUsage.completionTokens,
72
+ promptTokens: cumulativeUsage.promptTokens,
73
+ totalTokens: cumulativeUsage.totalTokens,
74
+ },
75
+ });
76
+ },
77
+ onError: (error: any) => `Custom error: ${error.message}`,
78
+ }),
79
+ )
80
+ .then(() => stream.close());
81
  }
82
 
83
  if (stream.switches >= MAX_RESPONSE_SEGMENTS) {
 
91
  messages.push({ role: 'assistant', content });
92
  messages.push({ role: 'user', content: CONTINUE_PROMPT });
93
 
94
+ const result = await streamText({
95
+ messages,
96
+ env: context.cloudflare.env,
97
+ options,
98
+ apiKeys,
99
+ files,
100
+ providerSettings,
101
+ });
102
 
103
+ return stream.switchSource(result.toDataStream());
104
  },
105
  };
106
 
107
+ const result = await streamText({
108
+ messages,
109
+ env: context.cloudflare.env,
110
+ options,
111
+ apiKeys,
112
+ files,
113
+ providerSettings,
114
+ });
115
 
116
+ stream.switchSource(result.toDataStream());
117
 
118
  return new Response(stream.readable, {
119
  status: 200,
 
122
  },
123
  });
124
  } catch (error: any) {
125
+ console.error(error);
126
 
127
  if (error.message?.includes('API key')) {
128
  throw new Response('Invalid or missing API key', {
app/routes/api.enhancer.ts CHANGED
@@ -1,5 +1,6 @@
1
  import { type ActionFunctionArgs } from '@remix-run/cloudflare';
2
- import { StreamingTextResponse, parseStreamPart } from 'ai';
 
3
  import { streamText } from '~/lib/.server/llm/stream-text';
4
  import { stripIndents } from '~/utils/stripIndent';
5
  import type { IProviderSetting, ProviderInfo } from '~/types/model';
@@ -73,32 +74,32 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
73
  `[Model: ${model}]\n\n[Provider: ${providerName}]\n\n` +
74
  stripIndents`
75
  You are a professional prompt engineer specializing in crafting precise, effective prompts.
76
- Your task is to enhance prompts by making them more specific, actionable, and effective.
77
-
78
- I want you to improve the user prompt that is wrapped in \`<original_prompt>\` tags.
79
-
80
- For valid prompts:
81
- - Make instructions explicit and unambiguous
82
- - Add relevant context and constraints
83
- - Remove redundant information
84
- - Maintain the core intent
85
- - Ensure the prompt is self-contained
86
- - Use professional language
87
-
88
- For invalid or unclear prompts:
89
- - Respond with a clear, professional guidance message
90
- - Keep responses concise and actionable
91
- - Maintain a helpful, constructive tone
92
- - Focus on what the user should provide
93
- - Use a standard template for consistency
94
-
95
- IMPORTANT: Your response must ONLY contain the enhanced prompt text.
96
- Do not include any explanations, metadata, or wrapper tags.
97
-
98
- <original_prompt>
99
- ${message}
100
- </original_prompt>
101
- `,
102
  },
103
  ],
104
  env: context.cloudflare.env,
@@ -113,7 +114,7 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
113
 
114
  for (const line of lines) {
115
  try {
116
- const parsed = parseStreamPart(line);
117
 
118
  if (parsed.type === 'text') {
119
  controller.enqueue(encoder.encode(parsed.value));
@@ -128,7 +129,12 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
128
 
129
  const transformedStream = result.toDataStream().pipeThrough(transformStream);
130
 
131
- return new StreamingTextResponse(transformedStream);
 
 
 
 
 
132
  } catch (error: unknown) {
133
  console.log(error);
134
 
 
1
  import { type ActionFunctionArgs } from '@remix-run/cloudflare';
2
+
3
+ //import { StreamingTextResponse, parseStreamPart } from 'ai';
4
  import { streamText } from '~/lib/.server/llm/stream-text';
5
  import { stripIndents } from '~/utils/stripIndent';
6
  import type { IProviderSetting, ProviderInfo } from '~/types/model';
 
74
  `[Model: ${model}]\n\n[Provider: ${providerName}]\n\n` +
75
  stripIndents`
76
  You are a professional prompt engineer specializing in crafting precise, effective prompts.
77
+ Your task is to enhance prompts by making them more specific, actionable, and effective.
78
+
79
+ I want you to improve the user prompt that is wrapped in \`<original_prompt>\` tags.
80
+
81
+ For valid prompts:
82
+ - Make instructions explicit and unambiguous
83
+ - Add relevant context and constraints
84
+ - Remove redundant information
85
+ - Maintain the core intent
86
+ - Ensure the prompt is self-contained
87
+ - Use professional language
88
+
89
+ For invalid or unclear prompts:
90
+ - Respond with clear, professional guidance
91
+ - Keep responses concise and actionable
92
+ - Maintain a helpful, constructive tone
93
+ - Focus on what the user should provide
94
+ - Use a standard template for consistency
95
+
96
+ IMPORTANT: Your response must ONLY contain the enhanced prompt text.
97
+ Do not include any explanations, metadata, or wrapper tags.
98
+
99
+ <original_prompt>
100
+ ${message}
101
+ </original_prompt>
102
+ `,
103
  },
104
  ],
105
  env: context.cloudflare.env,
 
114
 
115
  for (const line of lines) {
116
  try {
117
+ const parsed = JSON.parse(line);
118
 
119
  if (parsed.type === 'text') {
120
  controller.enqueue(encoder.encode(parsed.value));
 
129
 
130
  const transformedStream = result.toDataStream().pipeThrough(transformStream);
131
 
132
+ return new Response(transformedStream, {
133
+ status: 200,
134
+ headers: {
135
+ 'Content-Type': 'text/plain; charset=utf-8',
136
+ },
137
+ });
138
  } catch (error: unknown) {
139
  console.log(error);
140
 
app/utils/constants.ts CHANGED
@@ -139,11 +139,12 @@ const PROVIDER_LIST: ProviderInfo[] = [
139
  {
140
  name: 'Groq',
141
  staticModels: [
142
- { name: 'llama-3.1-70b-versatile', label: 'Llama 3.1 70b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
143
  { name: 'llama-3.1-8b-instant', label: 'Llama 3.1 8b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
144
  { name: 'llama-3.2-11b-vision-preview', label: 'Llama 3.2 11b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
 
145
  { name: 'llama-3.2-3b-preview', label: 'Llama 3.2 3b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
146
  { name: 'llama-3.2-1b-preview', label: 'Llama 3.2 1b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
 
147
  ],
148
  getApiKeyLink: 'https://console.groq.com/keys',
149
  },
@@ -292,6 +293,30 @@ const PROVIDER_LIST: ProviderInfo[] = [
292
  ],
293
  getApiKeyLink: 'https://api.together.xyz/settings/api-keys',
294
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  ];
296
 
297
  export const DEFAULT_PROVIDER = PROVIDER_LIST[0];
@@ -462,10 +487,6 @@ async function getOpenRouterModels(): Promise<ModelInfo[]> {
462
  }
463
 
464
  async function getLMStudioModels(_apiKeys?: Record<string, string>, settings?: IProviderSetting): Promise<ModelInfo[]> {
465
- if (typeof window === 'undefined') {
466
- return [];
467
- }
468
-
469
  try {
470
  const baseUrl = settings?.baseUrl || import.meta.env.LMSTUDIO_API_BASE_URL || 'http://localhost:1234';
471
  const response = await fetch(`${baseUrl}/v1/models`);
@@ -478,8 +499,6 @@ async function getLMStudioModels(_apiKeys?: Record<string, string>, settings?: I
478
  }));
479
  } catch (e: any) {
480
  logStore.logError('Failed to get LMStudio models', e, { baseUrl: settings?.baseUrl });
481
- logger.warn('Failed to get LMStudio models: ', e.message || '');
482
-
483
  return [];
484
  }
485
  }
 
139
  {
140
  name: 'Groq',
141
  staticModels: [
 
142
  { name: 'llama-3.1-8b-instant', label: 'Llama 3.1 8b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
143
  { name: 'llama-3.2-11b-vision-preview', label: 'Llama 3.2 11b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
144
+ { name: 'llama-3.2-90b-vision-preview', label: 'Llama 3.2 90b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
145
  { name: 'llama-3.2-3b-preview', label: 'Llama 3.2 3b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
146
  { name: 'llama-3.2-1b-preview', label: 'Llama 3.2 1b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
147
+ { name: 'llama-3.3-70b-versatile', label: 'Llama 3.3 70b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
148
  ],
149
  getApiKeyLink: 'https://console.groq.com/keys',
150
  },
 
293
  ],
294
  getApiKeyLink: 'https://api.together.xyz/settings/api-keys',
295
  },
296
+ {
297
+ name: 'Perplexity',
298
+ staticModels: [
299
+ {
300
+ name: 'llama-3.1-sonar-small-128k-online',
301
+ label: 'Sonar Small Online',
302
+ provider: 'Perplexity',
303
+ maxTokenAllowed: 8192,
304
+ },
305
+ {
306
+ name: 'llama-3.1-sonar-large-128k-online',
307
+ label: 'Sonar Large Online',
308
+ provider: 'Perplexity',
309
+ maxTokenAllowed: 8192,
310
+ },
311
+ {
312
+ name: 'llama-3.1-sonar-huge-128k-online',
313
+ label: 'Sonar Huge Online',
314
+ provider: 'Perplexity',
315
+ maxTokenAllowed: 8192,
316
+ },
317
+ ],
318
+ getApiKeyLink: 'https://www.perplexity.ai/settings/api',
319
+ },
320
  ];
321
 
322
  export const DEFAULT_PROVIDER = PROVIDER_LIST[0];
 
487
  }
488
 
489
  async function getLMStudioModels(_apiKeys?: Record<string, string>, settings?: IProviderSetting): Promise<ModelInfo[]> {
 
 
 
 
490
  try {
491
  const baseUrl = settings?.baseUrl || import.meta.env.LMSTUDIO_API_BASE_URL || 'http://localhost:1234';
492
  const response = await fetch(`${baseUrl}/v1/models`);
 
499
  }));
500
  } catch (e: any) {
501
  logStore.logError('Failed to get LMStudio models', e, { baseUrl: settings?.baseUrl });
 
 
502
  return [];
503
  }
504
  }
app/utils/sampler.ts ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Creates a function that samples calls at regular intervals and captures trailing calls.
3
+ * - Drops calls that occur between sampling intervals
4
+ * - Takes one call per sampling interval if available
5
+ * - Captures the last call if no call was made during the interval
6
+ *
7
+ * @param fn The function to sample
8
+ * @param sampleInterval How often to sample calls (in ms)
9
+ * @returns The sampled function
10
+ */
11
+ export function createSampler<T extends (...args: any[]) => any>(fn: T, sampleInterval: number): T {
12
+ let lastArgs: Parameters<T> | null = null;
13
+ let lastTime = 0;
14
+ let timeout: NodeJS.Timeout | null = null;
15
+
16
+ // Create a function with the same type as the input function
17
+ const sampled = function (this: any, ...args: Parameters<T>) {
18
+ const now = Date.now();
19
+ lastArgs = args;
20
+
21
+ // If we're within the sample interval, just store the args
22
+ if (now - lastTime < sampleInterval) {
23
+ // Set up trailing call if not already set
24
+ if (!timeout) {
25
+ timeout = setTimeout(
26
+ () => {
27
+ timeout = null;
28
+ lastTime = Date.now();
29
+
30
+ if (lastArgs) {
31
+ fn.apply(this, lastArgs);
32
+ lastArgs = null;
33
+ }
34
+ },
35
+ sampleInterval - (now - lastTime),
36
+ );
37
+ }
38
+
39
+ return;
40
+ }
41
+
42
+ // If we're outside the interval, execute immediately
43
+ lastTime = now;
44
+ fn.apply(this, args);
45
+ lastArgs = null;
46
+ } as T;
47
+
48
+ return sampled;
49
+ }
docs/docs/CONTRIBUTING.md CHANGED
@@ -1,11 +1,5 @@
1
  # Contribution Guidelines
2
 
3
- ## DEFAULT_NUM_CTX
4
-
5
- The `DEFAULT_NUM_CTX` environment variable can be used to limit the maximum number of context values used by the qwen2.5-coder model. For example, to limit the context to 24576 values (which uses 32GB of VRAM), set `DEFAULT_NUM_CTX=24576` in your `.env.local` file.
6
-
7
- First off, thank you for considering contributing to Bolt.diy! This fork aims to expand the capabilities of the original project by integrating multiple LLM providers and enhancing functionality. Every contribution helps make Bolt.diy a better tool for developers worldwide.
8
-
9
  ## 📋 Table of Contents
10
  - [Code of Conduct](#code-of-conduct)
11
  - [How Can I Contribute?](#how-can-i-contribute)
@@ -14,10 +8,14 @@ First off, thank you for considering contributing to Bolt.diy! This fork aims to
14
  - [Development Setup](#development-setup)
15
  - [Deploymnt with Docker](#docker-deployment-documentation)
16
 
 
 
17
  ## Code of Conduct
18
 
19
  This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
20
 
 
 
21
  ## How Can I Contribute?
22
 
23
  ### 🐞 Reporting Bugs and Feature Requests
@@ -35,6 +33,8 @@ This project and everyone participating in it is governed by our Code of Conduct
35
  ### ✨ Becoming a Core Contributor
36
  We're looking for dedicated contributors to help maintain and grow this project. If you're interested in becoming a core contributor, please fill out our [Contributor Application Form](https://forms.gle/TBSteXSDCtBDwr5m7).
37
 
 
 
38
  ## Pull Request Guidelines
39
 
40
  ### 📝 PR Checklist
@@ -49,6 +49,8 @@ We're looking for dedicated contributors to help maintain and grow this project.
49
  3. Address all review comments
50
  4. Maintain clean commit history
51
 
 
 
52
  ## Coding Standards
53
 
54
  ### 💻 General Guidelines
@@ -57,6 +59,8 @@ We're looking for dedicated contributors to help maintain and grow this project.
57
  - Keep functions focused and small
58
  - Use meaningful variable names
59
 
 
 
60
  ## Development Setup
61
 
62
  ### 🔄 Initial Setup
@@ -106,6 +110,8 @@ pnpm run dev
106
 
107
  **Note**: You will need Google Chrome Canary to run this locally if you use Chrome! It's an easy install and a good browser for web development anyway.
108
 
 
 
109
  ## Testing
110
 
111
  Run the test suite with:
@@ -114,6 +120,8 @@ Run the test suite with:
114
  pnpm test
115
  ```
116
 
 
 
117
  ## Deployment
118
 
119
  To deploy the application to Cloudflare Pages:
@@ -124,6 +132,8 @@ pnpm run deploy
124
 
125
  Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account.
126
 
 
 
127
  # Docker Deployment Documentation
128
 
129
  This guide outlines various methods for building and deploying the application using Docker.
@@ -166,6 +176,8 @@ docker-compose --profile development up
166
  docker-compose --profile production up
167
  ```
168
 
 
 
169
  ## Running the Application
170
 
171
  After building using any of the methods above, run the container with:
@@ -178,6 +190,8 @@ docker run -p 5173:5173 --env-file .env.local bolt-ai:development
178
  docker run -p 5173:5173 --env-file .env.local bolt-ai:production
179
  ```
180
 
 
 
181
  ## Deployment with Coolify
182
 
183
  [Coolify](https://github.com/coollabsio/coolify) provides a straightforward deployment process:
@@ -195,6 +209,8 @@ docker run -p 5173:5173 --env-file .env.local bolt-ai:production
195
  - Adjust other environment variables as needed
196
  7. Deploy the application
197
 
 
 
198
  ## VS Code Integration
199
 
200
  The `docker-compose.yaml` configuration is compatible with VS Code dev containers:
@@ -203,6 +219,8 @@ The `docker-compose.yaml` configuration is compatible with VS Code dev container
203
  2. Select the dev container configuration
204
  3. Choose the "development" profile from the context menu
205
 
 
 
206
  ## Environment Files
207
 
208
  Ensure you have the appropriate `.env.local` file configured before running the containers. This file should contain:
@@ -210,6 +228,16 @@ Ensure you have the appropriate `.env.local` file configured before running the
210
  - Environment-specific configurations
211
  - Other required environment variables
212
 
 
 
 
 
 
 
 
 
 
 
213
  ## Notes
214
 
215
  - Port 5173 is exposed and mapped for both development and production environments
 
1
  # Contribution Guidelines
2
 
 
 
 
 
 
 
3
  ## 📋 Table of Contents
4
  - [Code of Conduct](#code-of-conduct)
5
  - [How Can I Contribute?](#how-can-i-contribute)
 
8
  - [Development Setup](#development-setup)
9
  - [Deploymnt with Docker](#docker-deployment-documentation)
10
 
11
+ ---
12
+
13
  ## Code of Conduct
14
 
15
  This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
16
 
17
+ ---
18
+
19
  ## How Can I Contribute?
20
 
21
  ### 🐞 Reporting Bugs and Feature Requests
 
33
  ### ✨ Becoming a Core Contributor
34
  We're looking for dedicated contributors to help maintain and grow this project. If you're interested in becoming a core contributor, please fill out our [Contributor Application Form](https://forms.gle/TBSteXSDCtBDwr5m7).
35
 
36
+ ---
37
+
38
  ## Pull Request Guidelines
39
 
40
  ### 📝 PR Checklist
 
49
  3. Address all review comments
50
  4. Maintain clean commit history
51
 
52
+ ---
53
+
54
  ## Coding Standards
55
 
56
  ### 💻 General Guidelines
 
59
  - Keep functions focused and small
60
  - Use meaningful variable names
61
 
62
+ ---
63
+
64
  ## Development Setup
65
 
66
  ### 🔄 Initial Setup
 
110
 
111
  **Note**: You will need Google Chrome Canary to run this locally if you use Chrome! It's an easy install and a good browser for web development anyway.
112
 
113
+ ---
114
+
115
  ## Testing
116
 
117
  Run the test suite with:
 
120
  pnpm test
121
  ```
122
 
123
+ ---
124
+
125
  ## Deployment
126
 
127
  To deploy the application to Cloudflare Pages:
 
132
 
133
  Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account.
134
 
135
+ ---
136
+
137
  # Docker Deployment Documentation
138
 
139
  This guide outlines various methods for building and deploying the application using Docker.
 
176
  docker-compose --profile production up
177
  ```
178
 
179
+ ---
180
+
181
  ## Running the Application
182
 
183
  After building using any of the methods above, run the container with:
 
190
  docker run -p 5173:5173 --env-file .env.local bolt-ai:production
191
  ```
192
 
193
+ ---
194
+
195
  ## Deployment with Coolify
196
 
197
  [Coolify](https://github.com/coollabsio/coolify) provides a straightforward deployment process:
 
209
  - Adjust other environment variables as needed
210
  7. Deploy the application
211
 
212
+ ---
213
+
214
  ## VS Code Integration
215
 
216
  The `docker-compose.yaml` configuration is compatible with VS Code dev containers:
 
219
  2. Select the dev container configuration
220
  3. Choose the "development" profile from the context menu
221
 
222
+ ---
223
+
224
  ## Environment Files
225
 
226
  Ensure you have the appropriate `.env.local` file configured before running the containers. This file should contain:
 
228
  - Environment-specific configurations
229
  - Other required environment variables
230
 
231
+ ---
232
+
233
+ ## DEFAULT_NUM_CTX
234
+
235
+ The `DEFAULT_NUM_CTX` environment variable can be used to limit the maximum number of context values used by the qwen2.5-coder model. For example, to limit the context to 24576 values (which uses 32GB of VRAM), set `DEFAULT_NUM_CTX=24576` in your `.env.local` file.
236
+
237
+ First off, thank you for considering contributing to bolt.diy! This fork aims to expand the capabilities of the original project by integrating multiple LLM providers and enhancing functionality. Every contribution helps make bolt.diy a better tool for developers worldwide.
238
+
239
+ ---
240
+
241
  ## Notes
242
 
243
  - Port 5173 is exposed and mapped for both development and production environments
docs/docs/FAQ.md CHANGED
@@ -1,15 +1,15 @@
1
  # Frequently Asked Questions (FAQ)
2
 
3
- ## How do I get the best results with Bolt.diy?
4
 
5
  - **Be specific about your stack**:
6
- Mention the frameworks or libraries you want to use (e.g., Astro, Tailwind, ShadCN) in your initial prompt. This ensures that Bolt.diy scaffolds the project according to your preferences.
7
 
8
  - **Use the enhance prompt icon**:
9
  Before sending your prompt, click the *enhance* icon to let the AI refine your prompt. You can edit the suggested improvements before submitting.
10
 
11
  - **Scaffold the basics first, then add features**:
12
- Ensure the foundational structure of your application is in place before introducing advanced functionality. This helps Bolt.diy establish a solid base to build on.
13
 
14
  - **Batch simple instructions**:
15
  Combine simple tasks into a single prompt to save time and reduce API credit consumption. For example:
@@ -17,14 +17,13 @@
17
 
18
  ---
19
 
20
- ## How do I contribute to Bolt.diy?
21
 
22
  Check out our [Contribution Guide](CONTRIBUTING.md) for more details on how to get involved!
23
 
24
  ---
25
 
26
-
27
- ## What are the future plans for Bolt.diy?
28
 
29
  Visit our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo) for the latest updates.
30
  New features and improvements are on the way!
@@ -33,13 +32,13 @@ New features and improvements are on the way!
33
 
34
  ## Why are there so many open issues/pull requests?
35
 
36
- Bolt.diy began as a small showcase project on @ColeMedin's YouTube channel to explore editing open-source projects with local LLMs. However, it quickly grew into a massive community effort!
37
 
38
  We’re forming a team of maintainers to manage demand and streamline issue resolution. The maintainers are rockstars, and we’re also exploring partnerships to help the project thrive.
39
 
40
  ---
41
 
42
- ## How do local LLMs compare to larger models like Claude 3.5 Sonnet for Bolt.diy?
43
 
44
  While local LLMs are improving rapidly, larger models like GPT-4o, Claude 3.5 Sonnet, and DeepSeek Coder V2 236b still offer the best results for complex applications. Our ongoing focus is to improve prompts, agents, and the platform to better support smaller local LLMs.
45
 
@@ -73,4 +72,4 @@ Local LLMs like Qwen-2.5-Coder are powerful for small applications but still exp
73
 
74
  ---
75
 
76
- Got more questions? Feel free to reach out or open an issue in our GitHub repo!
 
1
  # Frequently Asked Questions (FAQ)
2
 
3
+ ## How do I get the best results with bolt.diy?
4
 
5
  - **Be specific about your stack**:
6
+ Mention the frameworks or libraries you want to use (e.g., Astro, Tailwind, ShadCN) in your initial prompt. This ensures that bolt.diy scaffolds the project according to your preferences.
7
 
8
  - **Use the enhance prompt icon**:
9
  Before sending your prompt, click the *enhance* icon to let the AI refine your prompt. You can edit the suggested improvements before submitting.
10
 
11
  - **Scaffold the basics first, then add features**:
12
+ Ensure the foundational structure of your application is in place before introducing advanced functionality. This helps bolt.diy establish a solid base to build on.
13
 
14
  - **Batch simple instructions**:
15
  Combine simple tasks into a single prompt to save time and reduce API credit consumption. For example:
 
17
 
18
  ---
19
 
20
+ ## How do I contribute to bolt.diy?
21
 
22
  Check out our [Contribution Guide](CONTRIBUTING.md) for more details on how to get involved!
23
 
24
  ---
25
 
26
+ ## What are the future plans for bolt.diy?
 
27
 
28
  Visit our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo) for the latest updates.
29
  New features and improvements are on the way!
 
32
 
33
  ## Why are there so many open issues/pull requests?
34
 
35
+ bolt.diy began as a small showcase project on @ColeMedin's YouTube channel to explore editing open-source projects with local LLMs. However, it quickly grew into a massive community effort!
36
 
37
  We’re forming a team of maintainers to manage demand and streamline issue resolution. The maintainers are rockstars, and we’re also exploring partnerships to help the project thrive.
38
 
39
  ---
40
 
41
+ ## How do local LLMs compare to larger models like Claude 3.5 Sonnet for bolt.diy?
42
 
43
  While local LLMs are improving rapidly, larger models like GPT-4o, Claude 3.5 Sonnet, and DeepSeek Coder V2 236b still offer the best results for complex applications. Our ongoing focus is to improve prompts, agents, and the platform to better support smaller local LLMs.
44
 
 
72
 
73
  ---
74
 
75
+ Got more questions? Feel free to reach out or open an issue in our GitHub repo!
docs/docs/index.md CHANGED
@@ -1,38 +1,46 @@
1
- # Welcome to Bolt DIY
2
- Bolt.diy 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.
3
 
4
- Join the community!
5
 
6
- https://thinktank.ottomator.ai
7
 
8
- ## Whats Bolt.diy
9
 
10
- Bolt.diy is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI-powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md)
11
 
12
- ## What Makes Bolt.diy Different
13
 
14
- Claude, v0, etc are incredible- but you can't install packages, run backends, or edit code. That’s where Bolt.diy stands out:
15
 
16
- - **Full-Stack in the Browser**: Bolt.diy integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to:
 
 
 
 
 
 
17
  - Install and run npm tools and libraries (like Vite, Next.js, and more)
18
  - Run Node.js servers
19
  - Interact with third-party APIs
20
  - Deploy to production from chat
21
  - Share your work via a URL
22
 
23
- - **AI with Environment Control**: Unlike traditional dev environments where the AI can only assist in code generation, Bolt.diy gives AI models **complete control** over the entire environment including the filesystem, node server, package manager, terminal, and browser console. This empowers AI agents to handle the whole app lifecycle—from creation to deployment.
24
 
25
- Whether you’re an experienced developer, a PM, or a designer, Bolt.diy allows you to easily build production-grade full-stack applications.
26
 
27
  For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo!
28
 
 
 
29
  ## Setup
30
 
31
  Many of you are new users to installing software from Github. If you have any installation troubles reach out and submit an "issue" using the links above, or feel free to enhance this documentation by forking, editing the instructions, and doing a pull request.
32
 
33
- 1. Install Git from https://git-scm.com/downloads
34
 
35
- 2. Install Node.js from https://nodejs.org/en/download/
36
 
37
  Pay attention to the installer notes after completion.
38
 
@@ -62,11 +70,11 @@ defaults write com.apple.finder AppleShowAllFiles YES
62
 
63
  **NOTE**: you only have to set the ones you want to use and Ollama doesn't need an API key because it runs locally on your computer:
64
 
65
- Get your GROQ API Key here: https://console.groq.com/keys
66
 
67
- Get your Open AI API Key by following these instructions: https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key
68
 
69
- Get your Anthropic API Key in your account settings: https://console.anthropic.com/settings/keys
70
 
71
  ```
72
  GROQ_API_KEY=XXX
@@ -128,6 +136,8 @@ When you run the Docker Compose command with the development profile, any change
128
  make on your machine to the code will automatically be reflected in the site running
129
  on the container (i.e. hot reloading still applies!).
130
 
 
 
131
  ## Run Without Docker
132
 
133
  1. Install dependencies using Terminal (or CMD in Windows with admin permissions):
@@ -148,14 +158,18 @@ sudo npm install -g pnpm
148
  pnpm run dev
149
  ```
150
 
 
 
151
  ## Adding New LLMs:
152
 
153
- To make new LLMs available to use in this version of Bolt.diy, 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.
154
 
155
  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!
156
 
157
  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!
158
 
 
 
159
  ## Available Scripts
160
 
161
  - `pnpm run dev`: Starts the development server.
@@ -167,6 +181,8 @@ When you add a new model to the MODEL_LIST array, it will immediately be availab
167
  - `pnpm run typegen`: Generates TypeScript types using Wrangler.
168
  - `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
169
 
 
 
170
  ## Development
171
 
172
  To start the development server:
@@ -177,9 +193,11 @@ pnpm run dev
177
 
178
  This will start the Remix Vite development server. You will need Google Chrome Canary to run this locally if you use Chrome! It's an easy install and a good browser for web development anyway.
179
 
 
 
180
  ## Tips and Tricks
181
 
182
- Here are some tips to get the most out of Bolt.diy:
183
 
184
  - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly.
185
 
 
1
+ # Welcome to bolt diy
2
+ bolt.diy 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.
3
 
4
+ ---
5
 
6
+ ## Join the community!
7
 
8
+ [Join the community!](https://thinktank.ottomator.ai)
9
 
10
+ ---
11
 
12
+ ## Whats bolt.diy
13
 
14
+ bolt.diy is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI-powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md)
15
 
16
+ ---
17
+
18
+ ## What Makes bolt.diy Different
19
+
20
+ Claude, v0, etc are incredible- but you can't install packages, run backends, or edit code. That’s where bolt.diy stands out:
21
+
22
+ - **Full-Stack in the Browser**: bolt.diy integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to:
23
  - Install and run npm tools and libraries (like Vite, Next.js, and more)
24
  - Run Node.js servers
25
  - Interact with third-party APIs
26
  - Deploy to production from chat
27
  - Share your work via a URL
28
 
29
+ - **AI with Environment Control**: Unlike traditional dev environments where the AI can only assist in code generation, bolt.diy gives AI models **complete control** over the entire environment including the filesystem, node server, package manager, terminal, and browser console. This empowers AI agents to handle the whole app lifecycle—from creation to deployment.
30
 
31
+ Whether you’re an experienced developer, a PM, or a designer, bolt.diy allows you to easily build production-grade full-stack applications.
32
 
33
  For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo!
34
 
35
+ ---
36
+
37
  ## Setup
38
 
39
  Many of you are new users to installing software from Github. If you have any installation troubles reach out and submit an "issue" using the links above, or feel free to enhance this documentation by forking, editing the instructions, and doing a pull request.
40
 
41
+ 1. [Install Git from](https://git-scm.com/downloads)
42
 
43
+ 2. [Install Node.js from](https://nodejs.org/en/download/)
44
 
45
  Pay attention to the installer notes after completion.
46
 
 
70
 
71
  **NOTE**: you only have to set the ones you want to use and Ollama doesn't need an API key because it runs locally on your computer:
72
 
73
+ [Get your GROQ API Key here](https://console.groq.com/keys)
74
 
75
+ [Get your Open AI API Key by following these instructions](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)
76
 
77
+ Get your Anthropic API Key in your [account settings](https://console.anthropic.com/settings/keys)
78
 
79
  ```
80
  GROQ_API_KEY=XXX
 
136
  make on your machine to the code will automatically be reflected in the site running
137
  on the container (i.e. hot reloading still applies!).
138
 
139
+ ---
140
+
141
  ## Run Without Docker
142
 
143
  1. Install dependencies using Terminal (or CMD in Windows with admin permissions):
 
158
  pnpm run dev
159
  ```
160
 
161
+ ---
162
+
163
  ## Adding New LLMs:
164
 
165
+ To make new LLMs available to use in this version of bolt.diy, 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.
166
 
167
  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!
168
 
169
  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!
170
 
171
+ ---
172
+
173
  ## Available Scripts
174
 
175
  - `pnpm run dev`: Starts the development server.
 
181
  - `pnpm run typegen`: Generates TypeScript types using Wrangler.
182
  - `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
183
 
184
+ ---
185
+
186
  ## Development
187
 
188
  To start the development server:
 
193
 
194
  This will start the Remix Vite development server. You will need Google Chrome Canary to run this locally if you use Chrome! It's an easy install and a good browser for web development anyway.
195
 
196
+ ---
197
+
198
  ## Tips and Tricks
199
 
200
+ Here are some tips to get the most out of bolt.diy:
201
 
202
  - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly.
203
 
docs/mkdocs.yml CHANGED
@@ -1,4 +1,4 @@
1
- site_name: Bolt.diy Docs
2
  site_dir: ../site
3
  theme:
4
  name: material
@@ -31,7 +31,7 @@ theme:
31
  repo: fontawesome/brands/github
32
  # logo: assets/logo.png
33
  # favicon: assets/logo.png
34
- repo_name: Bolt.diy
35
  repo_url: https://github.com/stackblitz-labs/bolt.diy
36
  edit_uri: ""
37
 
@@ -40,16 +40,16 @@ extra:
40
  social:
41
  - icon: fontawesome/brands/github
42
  link: https://github.com/stackblitz-labs/bolt.diy
43
- name: Bolt.diy
44
  - icon: fontawesome/brands/discourse
45
  link: https://thinktank.ottomator.ai/
46
- name: Bolt.diy Discourse
47
  - icon: fontawesome/brands/x-twitter
48
  link: https://x.com/bolt_diy
49
- name: Bolt.diy on X
50
  - icon: fontawesome/brands/bluesky
51
  link: https://bsky.app/profile/bolt.diy
52
- name: Bolt.diy on Bluesky
53
 
54
 
55
 
 
1
+ site_name: bolt.diy Docs
2
  site_dir: ../site
3
  theme:
4
  name: material
 
31
  repo: fontawesome/brands/github
32
  # logo: assets/logo.png
33
  # favicon: assets/logo.png
34
+ repo_name: bolt.diy
35
  repo_url: https://github.com/stackblitz-labs/bolt.diy
36
  edit_uri: ""
37
 
 
40
  social:
41
  - icon: fontawesome/brands/github
42
  link: https://github.com/stackblitz-labs/bolt.diy
43
+ name: bolt.diy
44
  - icon: fontawesome/brands/discourse
45
  link: https://thinktank.ottomator.ai/
46
+ name: bolt.diy Discourse
47
  - icon: fontawesome/brands/x-twitter
48
  link: https://x.com/bolt_diy
49
+ name: bolt.diy on X
50
  - icon: fontawesome/brands/bluesky
51
  link: https://bsky.app/profile/bolt.diy
52
+ name: bolt.diy on Bluesky
53
 
54
 
55
 
package.json CHANGED
@@ -58,6 +58,7 @@
58
  "@octokit/rest": "^21.0.2",
59
  "@octokit/types": "^13.6.2",
60
  "@openrouter/ai-sdk-provider": "^0.0.5",
 
61
  "@radix-ui/react-dialog": "^1.1.2",
62
  "@radix-ui/react-dropdown-menu": "^2.1.2",
63
  "@radix-ui/react-separator": "^1.1.0",
@@ -72,7 +73,7 @@
72
  "@xterm/addon-fit": "^0.10.0",
73
  "@xterm/addon-web-links": "^0.11.0",
74
  "@xterm/xterm": "^5.5.0",
75
- "ai": "^3.4.33",
76
  "date-fns": "^3.6.0",
77
  "diff": "^5.2.0",
78
  "file-saver": "^2.0.5",
 
58
  "@octokit/rest": "^21.0.2",
59
  "@octokit/types": "^13.6.2",
60
  "@openrouter/ai-sdk-provider": "^0.0.5",
61
+ "@radix-ui/react-context-menu": "^2.2.2",
62
  "@radix-ui/react-dialog": "^1.1.2",
63
  "@radix-ui/react-dropdown-menu": "^2.1.2",
64
  "@radix-ui/react-separator": "^1.1.0",
 
73
  "@xterm/addon-fit": "^0.10.0",
74
  "@xterm/addon-web-links": "^0.11.0",
75
  "@xterm/xterm": "^5.5.0",
76
+ "ai": "^4.0.13",
77
  "date-fns": "^3.6.0",
78
  "diff": "^5.2.0",
79
  "file-saver": "^2.0.5",
pnpm-lock.yaml CHANGED
@@ -95,6 +95,9 @@ importers:
95
  '@openrouter/ai-sdk-provider':
96
  specifier: ^0.0.5
97
  version: 0.0.5([email protected])
 
 
 
98
  '@radix-ui/react-dialog':
99
  specifier: ^1.1.2
100
@@ -138,8 +141,8 @@ importers:
138
  specifier: ^5.5.0
139
  version: 5.5.0
140
  ai:
141
- specifier: ^3.4.33
142
143
  date-fns:
144
  specifier: ^3.6.0
145
  version: 3.6.0
@@ -348,8 +351,8 @@ packages:
348
  zod:
349
  optional: true
350
 
351
- '@ai-sdk/[email protected].22':
352
- resolution: {integrity: sha512-YHK2rpj++wnLVc9vPGzGFP3Pjeld2MwhKinetA0zKXOoHAT/Jit5O8kZsxcSlJPu9wvcGT1UGZEjZrtO7PfFOQ==}
353
  engines: {node: '>=18'}
354
  peerDependencies:
355
  zod: ^3.0.0
@@ -357,8 +360,8 @@ packages:
357
  zod:
358
  optional: true
359
 
360
- '@ai-sdk/provider-utils@1.0.9':
361
- resolution: {integrity: sha512-yfdanjUiCJbtGoRGXrcrmXn0pTyDfRIeY6ozDG96D66f2wupZaZvAgKptUa3zDYXtUCQQvcNJ+tipBBfQD/UYA==}
362
  engines: {node: '>=18'}
363
  peerDependencies:
364
  zod: ^3.0.0
@@ -366,8 +369,8 @@ packages:
366
  zod:
367
  optional: true
368
 
369
- '@ai-sdk/[email protected].2':
370
- resolution: {integrity: sha512-IAvhKhdlXqiSmvx/D4uNlFYCl8dWT+M9K+IuEcSgnE2Aj27GWu8sDIpAf4r4Voc+wOUkOECVKQhFo8g9pozdjA==}
371
  engines: {node: '>=18'}
372
  peerDependencies:
373
  zod: ^3.0.0
@@ -387,16 +390,16 @@ packages:
387
  resolution: {integrity: sha512-XMsNGJdGO+L0cxhhegtqZ8+T6nn4EoShS819OvCgI2kLbYTIvk0GWFGD0AXJmxkxs3DrpsJxKAFukFR7bvTkgQ==}
388
  engines: {node: '>=18'}
389
 
390
- '@ai-sdk/[email protected]':
391
- resolution: {integrity: sha512-dQkfBDs2lTYpKM8389oopPdQgIU007GQyCbuPPrV+K6MtSII3HBfE0stUIMXUb44L+LK1t6GXPP7wjSzjO6uKg==}
392
- engines: {node: '>=18'}
393
-
394
  '@ai-sdk/[email protected]':
395
  resolution: {integrity: sha512-mV+3iNDkzUsZ0pR2jG0sVzU6xtQY5DtSCBy3JFycLp6PwjyLw/iodfL3MwdmMCRJWgs3dadcHejRnMvF9nGTBg==}
396
  engines: {node: '>=18'}
397
 
398
- '@ai-sdk/react@0.0.70':
399
- resolution: {integrity: sha512-GnwbtjW4/4z7MleLiW+TOZC2M29eCg1tOUpuEiYFMmFNZK8mkrqM0PFZMo6UsYeUYMWqEOOcPOU9OQVJMJh7IQ==}
 
 
 
 
400
  engines: {node: '>=18'}
401
  peerDependencies:
402
  react: ^18 || ^19 || ^19.0.0-rc
@@ -407,26 +410,8 @@ packages:
407
  zod:
408
  optional: true
409
 
410
- '@ai-sdk/solid@0.0.54':
411
- resolution: {integrity: sha512-96KWTVK+opdFeRubqrgaJXoNiDP89gNxFRWUp0PJOotZW816AbhUf4EnDjBjXTLjXL1n0h8tGSE9sZsRkj9wQQ==}
412
- engines: {node: '>=18'}
413
- peerDependencies:
414
- solid-js: ^1.7.7
415
- peerDependenciesMeta:
416
- solid-js:
417
- optional: true
418
-
419
- '@ai-sdk/[email protected]':
420
- resolution: {integrity: sha512-SyF9ItIR9ALP9yDNAD+2/5Vl1IT6kchgyDH8xkmhysfJI6WrvJbtO1wdQ0nylvPLcsPoYu+cAlz1krU4lFHcYw==}
421
- engines: {node: '>=18'}
422
- peerDependencies:
423
- svelte: ^3.0.0 || ^4.0.0 || ^5.0.0
424
- peerDependenciesMeta:
425
- svelte:
426
- optional: true
427
-
428
- '@ai-sdk/[email protected]':
429
- resolution: {integrity: sha512-Z5QYJVW+5XpSaJ4jYCCAVG7zIAuKOOdikhgpksneNmKvx61ACFaf98pmOd+xnjahl0pIlc/QIe6O4yVaJ1sEaw==}
430
  engines: {node: '>=18'}
431
  peerDependencies:
432
  zod: ^3.0.0
@@ -434,15 +419,6 @@ packages:
434
  zod:
435
  optional: true
436
 
437
- '@ai-sdk/[email protected]':
438
- resolution: {integrity: sha512-+ofYlnqdc8c4F6tM0IKF0+7NagZRAiqBJpGDJ+6EYhDW8FHLUP/JFBgu32SjxSxC6IKFZxEnl68ZoP/Z38EMlw==}
439
- engines: {node: '>=18'}
440
- peerDependencies:
441
- vue: ^3.3.4
442
- peerDependenciesMeta:
443
- vue:
444
- optional: true
445
-
446
  '@ampproject/[email protected]':
447
  resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
448
  engines: {node: '>=6.0.0'}
@@ -1557,6 +1533,19 @@ packages:
1557
  '@types/react':
1558
  optional: true
1559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1560
  '@radix-ui/[email protected]':
1561
  resolution: {integrity: sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==}
1562
  peerDependencies:
@@ -2354,35 +2343,6 @@ packages:
2354
  '@vitest/[email protected]':
2355
  resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==}
2356
 
2357
- '@vue/[email protected]':
2358
- resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==}
2359
-
2360
- '@vue/[email protected]':
2361
- resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==}
2362
-
2363
- '@vue/[email protected]':
2364
- resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==}
2365
-
2366
- '@vue/[email protected]':
2367
- resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==}
2368
-
2369
- '@vue/[email protected]':
2370
- resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==}
2371
-
2372
- '@vue/[email protected]':
2373
- resolution: {integrity: sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==}
2374
-
2375
- '@vue/[email protected]':
2376
- resolution: {integrity: sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==}
2377
-
2378
- '@vue/[email protected]':
2379
- resolution: {integrity: sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==}
2380
- peerDependencies:
2381
- vue: 3.5.13
2382
-
2383
- '@vue/[email protected]':
2384
- resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
2385
-
2386
  '@web3-storage/[email protected]':
2387
  resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==}
2388
 
@@ -2418,11 +2378,6 @@ packages:
2418
  peerDependencies:
2419
  acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
2420
 
2421
2422
- resolution: {integrity: sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==}
2423
- peerDependencies:
2424
- acorn: '>=8.9.0'
2425
-
2426
2427
  resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==}
2428
  engines: {node: '>=0.4.0'}
@@ -2436,24 +2391,15 @@ packages:
2436
  resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
2437
  engines: {node: '>=8'}
2438
 
2439
- ai@3.4.33:
2440
- resolution: {integrity: sha512-plBlrVZKwPoRTmM8+D1sJac9Bq8eaa2jiZlHLZIWekKWI1yMWYZvCCEezY9ASPwRhULYDJB2VhKOBUUeg3S5JQ==}
2441
  engines: {node: '>=18'}
2442
  peerDependencies:
2443
- openai: ^4.42.0
2444
  react: ^18 || ^19 || ^19.0.0-rc
2445
- sswr: ^2.1.0
2446
- svelte: ^3.0.0 || ^4.0.0 || ^5.0.0
2447
  zod: ^3.0.0
2448
  peerDependenciesMeta:
2449
- openai:
2450
- optional: true
2451
  react:
2452
  optional: true
2453
- sswr:
2454
- optional: true
2455
- svelte:
2456
- optional: true
2457
  zod:
2458
  optional: true
2459
 
@@ -2490,10 +2436,6 @@ packages:
2490
  resolution: {integrity: sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==}
2491
  engines: {node: '>=10'}
2492
 
2493
2494
- resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==}
2495
- engines: {node: '>= 0.4'}
2496
-
2497
2498
  resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}
2499
 
@@ -2521,10 +2463,6 @@ packages:
2521
  resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
2522
  engines: {node: '>= 0.4'}
2523
 
2524
2525
- resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
2526
- engines: {node: '>= 0.4'}
2527
-
2528
2529
  resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
2530
 
@@ -3133,9 +3071,6 @@ packages:
3133
  jiti:
3134
  optional: true
3135
 
3136
3137
- resolution: {integrity: sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==}
3138
-
3139
3140
  resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==}
3141
  engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -3148,9 +3083,6 @@ packages:
3148
  resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
3149
  engines: {node: '>=0.10'}
3150
 
3151
3152
- resolution: {integrity: sha512-ZlQmCCK+n7SGoqo7DnfKaP1sJZa49P01/dXzmjCASSo04p72w8EksT2NMK8CEX8DhKsfJXANioIw8VyHNsBfvQ==}
3153
-
3154
3155
  resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
3156
  engines: {node: '>=4.0'}
@@ -3804,9 +3736,6 @@ packages:
3804
  resolution: {integrity: sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==}
3805
  engines: {node: '>=14'}
3806
 
3807
3808
- resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==}
3809
-
3810
3811
  resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
3812
  engines: {node: '>=10'}
@@ -5174,11 +5103,6 @@ packages:
5174
  resolution: {integrity: sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==}
5175
  engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
5176
 
5177
5178
- resolution: {integrity: sha512-Cqc355SYlTAaUt8iDPaC/4DPPXK925PePLMxyBKuWd5kKc5mwsG3nT9+Mq2tyguL5s7b4Jg+IRMpTRsNTAfpSQ==}
5179
- peerDependencies:
5180
- svelte: ^4.0.0 || ^5.0.0-next.0
5181
-
5182
5183
  resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
5184
 
@@ -5269,23 +5193,11 @@ packages:
5269
  resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
5270
  engines: {node: '>= 0.4'}
5271
 
5272
5273
- resolution: {integrity: sha512-2I/mjD8cXDpKfdfUK+T6yo/OzugMXIm8lhyJUFM5F/gICMYnkl3C/+4cOSpia8TqpDsi6Qfm5+fdmBNMNmaf2g==}
5274
- engines: {node: '>=18'}
5275
-
5276
5277
  resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==}
5278
  peerDependencies:
5279
  react: ^16.11.0 || ^17.0.0 || ^18.0.0
5280
 
5281
5282
- resolution: {integrity: sha512-LqVcOHSB4cPGgitD1riJ1Hh4vdmITOp+BkmfmXRh4hSF/t7EnS4iD+SOTmq7w5pPm/SiPeto4ADbKS6dHUDWFA==}
5283
-
5284
5285
- resolution: {integrity: sha512-zjEkcP8Ywmj+xOJW3lIT65ciY/4AL4e/Or7Gj0MzU3zBJNMdJiT8geVZhINavnlHRMMCcJLHhraLTAiDOTmQ9g==}
5286
- peerDependencies:
5287
- vue: '>=3.2.26 < 4'
5288
-
5289
5290
  resolution: {integrity: sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==}
5291
  engines: {node: '>=16.0.0'}
@@ -5705,14 +5617,6 @@ packages:
5705
5706
  resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==}
5707
 
5708
5709
- resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==}
5710
- peerDependencies:
5711
- typescript: '*'
5712
- peerDependenciesMeta:
5713
- typescript:
5714
- optional: true
5715
-
5716
5717
  resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
5718
 
@@ -5827,9 +5731,6 @@ packages:
5827
5828
  resolution: {integrity: sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==}
5829
 
5830
5831
- resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==}
5832
-
5833
5834
  resolution: {integrity: sha512-5wlSS0bXfF/BrL4jPAbz9da5hDlDptdEppYfe+x4eIJ7jioqKG9uUxOwPzqof09u/XeVdrgFu29lZi+8XNDJtA==}
5835
  peerDependencies:
@@ -5892,15 +5793,6 @@ snapshots:
5892
  optionalDependencies:
5893
  zod: 3.23.8
5894
 
5895
5896
- dependencies:
5897
- '@ai-sdk/provider': 0.0.26
5898
- eventsource-parser: 1.1.2
5899
- nanoid: 3.3.8
5900
- secure-json-parse: 2.7.0
5901
- optionalDependencies:
5902
- zod: 3.23.8
5903
-
5904
5905
  dependencies:
5906
  '@ai-sdk/provider': 0.0.17
@@ -5919,6 +5811,15 @@ snapshots:
5919
  optionalDependencies:
5920
  zod: 3.23.8
5921
 
 
 
 
 
 
 
 
 
 
5922
  '@ai-sdk/[email protected]':
5923
  dependencies:
5924
  json-schema: 0.4.0
@@ -5931,61 +5832,32 @@ snapshots:
5931
  dependencies:
5932
  json-schema: 0.4.0
5933
 
5934
- '@ai-sdk/provider@0.0.26':
5935
  dependencies:
5936
  json-schema: 0.4.0
5937
 
5938
- '@ai-sdk/[email protected].1':
5939
  dependencies:
5940
  json-schema: 0.4.0
5941
 
5942
- '@ai-sdk/react@0.0.70([email protected])([email protected])':
5943
  dependencies:
5944
- '@ai-sdk/provider-utils': 1.0.22([email protected])
5945
- '@ai-sdk/ui-utils': 0.0.50([email protected])
5946
  swr: 2.2.5([email protected])
5947
  throttleit: 2.1.0
5948
  optionalDependencies:
5949
  react: 18.3.1
5950
  zod: 3.23.8
5951
 
5952
- '@ai-sdk/solid@0.0.54([email protected])':
5953
- dependencies:
5954
- '@ai-sdk/provider-utils': 1.0.22([email protected])
5955
- '@ai-sdk/ui-utils': 0.0.50([email protected])
5956
- transitivePeerDependencies:
5957
- - zod
5958
-
5959
5960
  dependencies:
5961
- '@ai-sdk/provider-utils': 1.0.22([email protected])
5962
- '@ai-sdk/ui-utils': 0.0.50([email protected])
5963
- sswr: 2.1.0([email protected])
5964
- optionalDependencies:
5965
- svelte: 5.4.0
5966
- transitivePeerDependencies:
5967
- - zod
5968
-
5969
5970
- dependencies:
5971
- '@ai-sdk/provider': 0.0.26
5972
- '@ai-sdk/provider-utils': 1.0.22([email protected])
5973
- json-schema: 0.4.0
5974
- secure-json-parse: 2.7.0
5975
  zod-to-json-schema: 3.23.5([email protected])
5976
  optionalDependencies:
5977
  zod: 3.23.8
5978
 
5979
5980
- dependencies:
5981
- '@ai-sdk/provider-utils': 1.0.22([email protected])
5982
- '@ai-sdk/ui-utils': 0.0.50([email protected])
5983
5984
- optionalDependencies:
5985
- vue: 3.5.13([email protected])
5986
- transitivePeerDependencies:
5987
- - zod
5988
-
5989
  '@ampproject/[email protected]':
5990
  dependencies:
5991
  '@jridgewell/gen-mapping': 0.3.5
@@ -7032,6 +6904,20 @@ snapshots:
7032
  optionalDependencies:
7033
  '@types/react': 18.3.12
7034
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7035
7036
  dependencies:
7037
  react: 18.3.1
@@ -8015,60 +7901,6 @@ snapshots:
8015
  loupe: 3.1.2
8016
  tinyrainbow: 1.2.0
8017
 
8018
- '@vue/[email protected]':
8019
- dependencies:
8020
- '@babel/parser': 7.26.2
8021
- '@vue/shared': 3.5.13
8022
- entities: 4.5.0
8023
- estree-walker: 2.0.2
8024
- source-map-js: 1.2.1
8025
-
8026
- '@vue/[email protected]':
8027
- dependencies:
8028
- '@vue/compiler-core': 3.5.13
8029
- '@vue/shared': 3.5.13
8030
-
8031
- '@vue/[email protected]':
8032
- dependencies:
8033
- '@babel/parser': 7.26.2
8034
- '@vue/compiler-core': 3.5.13
8035
- '@vue/compiler-dom': 3.5.13
8036
- '@vue/compiler-ssr': 3.5.13
8037
- '@vue/shared': 3.5.13
8038
- estree-walker: 2.0.2
8039
- magic-string: 0.30.14
8040
- postcss: 8.4.49
8041
- source-map-js: 1.2.1
8042
-
8043
- '@vue/[email protected]':
8044
- dependencies:
8045
- '@vue/compiler-dom': 3.5.13
8046
- '@vue/shared': 3.5.13
8047
-
8048
- '@vue/[email protected]':
8049
- dependencies:
8050
- '@vue/shared': 3.5.13
8051
-
8052
- '@vue/[email protected]':
8053
- dependencies:
8054
- '@vue/reactivity': 3.5.13
8055
- '@vue/shared': 3.5.13
8056
-
8057
- '@vue/[email protected]':
8058
- dependencies:
8059
- '@vue/reactivity': 3.5.13
8060
- '@vue/runtime-core': 3.5.13
8061
- '@vue/shared': 3.5.13
8062
- csstype: 3.1.3
8063
-
8064
8065
- dependencies:
8066
- '@vue/compiler-ssr': 3.5.13
8067
- '@vue/shared': 3.5.13
8068
- vue: 3.5.13([email protected])
8069
-
8070
- '@vue/[email protected]': {}
8071
-
8072
  '@web3-storage/[email protected]': {}
8073
 
8074
  '@webcontainer/[email protected]': {}
@@ -8099,10 +7931,6 @@ snapshots:
8099
  dependencies:
8100
  acorn: 8.14.0
8101
 
8102
8103
- dependencies:
8104
- acorn: 8.14.0
8105
-
8106
8107
  dependencies:
8108
  acorn: 8.14.0
@@ -8114,29 +7942,18 @@ snapshots:
8114
  clean-stack: 2.2.0
8115
  indent-string: 4.0.0
8116
 
8117
8118
  dependencies:
8119
- '@ai-sdk/provider': 0.0.26
8120
- '@ai-sdk/provider-utils': 1.0.22([email protected])
8121
- '@ai-sdk/react': 0.0.70([email protected])([email protected])
8122
- '@ai-sdk/solid': 0.0.54([email protected])
8123
- '@ai-sdk/svelte': 0.0.57([email protected])([email protected])
8124
- '@ai-sdk/ui-utils': 0.0.50([email protected])
8125
8126
  '@opentelemetry/api': 1.9.0
8127
- eventsource-parser: 1.1.2
8128
- json-schema: 0.4.0
8129
  jsondiffpatch: 0.6.0
8130
- secure-json-parse: 2.7.0
8131
  zod-to-json-schema: 3.23.5([email protected])
8132
  optionalDependencies:
8133
  react: 18.3.1
8134
- sswr: 2.1.0([email protected])
8135
- svelte: 5.4.0
8136
  zod: 3.23.8
8137
- transitivePeerDependencies:
8138
- - solid-js
8139
- - vue
8140
 
8141
8142
  dependencies:
@@ -8168,8 +7985,6 @@ snapshots:
8168
  dependencies:
8169
  tslib: 2.8.1
8170
 
8171
8172
-
8173
8174
 
8175
@@ -8200,8 +8015,6 @@ snapshots:
8200
  dependencies:
8201
  possible-typed-array-names: 1.0.0
8202
 
8203
8204
-
8205
8206
 
8207
@@ -8901,8 +8714,6 @@ snapshots:
8901
  transitivePeerDependencies:
8902
  - supports-color
8903
 
8904
8905
-
8906
8907
  dependencies:
8908
  acorn: 8.14.0
@@ -8919,11 +8730,6 @@ snapshots:
8919
  dependencies:
8920
  estraverse: 5.3.0
8921
 
8922
8923
- dependencies:
8924
- '@jridgewell/sourcemap-codec': 1.5.0
8925
- '@types/estree': 1.0.6
8926
-
8927
8928
  dependencies:
8929
  estraverse: 5.3.0
@@ -9650,8 +9456,6 @@ snapshots:
9650
  mlly: 1.7.3
9651
  pkg-types: 1.2.1
9652
 
9653
9654
-
9655
9656
  dependencies:
9657
  p-locate: 5.0.0
@@ -11462,11 +11266,6 @@ snapshots:
11462
  dependencies:
11463
  minipass: 7.1.2
11464
 
11465
11466
- dependencies:
11467
- svelte: 5.4.0
11468
- swrev: 4.0.0
11469
-
11470
11471
 
11472
@@ -11557,34 +11356,12 @@ snapshots:
11557
 
11558
11559
 
11560
11561
- dependencies:
11562
- '@ampproject/remapping': 2.3.0
11563
- '@jridgewell/sourcemap-codec': 1.5.0
11564
- '@types/estree': 1.0.6
11565
- acorn: 8.14.0
11566
- acorn-typescript: 1.4.13([email protected])
11567
- aria-query: 5.3.2
11568
- axobject-query: 4.1.0
11569
- esm-env: 1.2.1
11570
- esrap: 1.2.3
11571
- is-reference: 3.0.3
11572
- locate-character: 3.0.0
11573
- magic-string: 0.30.14
11574
- zimmerframe: 1.1.2
11575
-
11576
11577
  dependencies:
11578
  client-only: 0.0.1
11579
  react: 18.3.1
11580
  use-sync-external-store: 1.2.2([email protected])
11581
 
11582
11583
-
11584
11585
- dependencies:
11586
- vue: 3.5.13([email protected])
11587
-
11588
11589
  dependencies:
11590
  sync-message-port: 1.1.3
@@ -12062,16 +11839,6 @@ snapshots:
12062
 
12063
12064
 
12065
12066
- dependencies:
12067
- '@vue/compiler-dom': 3.5.13
12068
- '@vue/compiler-sfc': 3.5.13
12069
- '@vue/runtime-dom': 3.5.13
12070
- '@vue/server-renderer': 3.5.13([email protected]([email protected]))
12071
- '@vue/shared': 3.5.13
12072
- optionalDependencies:
12073
- typescript: 5.7.2
12074
-
12075
12076
 
12077
@@ -12184,8 +11951,6 @@ snapshots:
12184
  mustache: 4.2.0
12185
  stacktracey: 2.1.8
12186
 
12187
12188
-
12189
12190
  dependencies:
12191
  zod: 3.23.8
 
95
  '@openrouter/ai-sdk-provider':
96
  specifier: ^0.0.5
97
  version: 0.0.5([email protected])
98
+ '@radix-ui/react-context-menu':
99
+ specifier: ^2.2.2
100
101
  '@radix-ui/react-dialog':
102
  specifier: ^1.1.2
103
 
141
  specifier: ^5.5.0
142
  version: 5.5.0
143
  ai:
144
+ specifier: ^4.0.13
145
146
  date-fns:
147
  specifier: ^3.6.0
148
  version: 3.6.0
 
351
  zod:
352
  optional: true
353
 
354
+ '@ai-sdk/[email protected].9':
355
+ resolution: {integrity: sha512-yfdanjUiCJbtGoRGXrcrmXn0pTyDfRIeY6ozDG96D66f2wupZaZvAgKptUa3zDYXtUCQQvcNJ+tipBBfQD/UYA==}
356
  engines: {node: '>=18'}
357
  peerDependencies:
358
  zod: ^3.0.0
 
360
  zod:
361
  optional: true
362
 
363
+ '@ai-sdk/provider-utils@2.0.2':
364
+ resolution: {integrity: sha512-IAvhKhdlXqiSmvx/D4uNlFYCl8dWT+M9K+IuEcSgnE2Aj27GWu8sDIpAf4r4Voc+wOUkOECVKQhFo8g9pozdjA==}
365
  engines: {node: '>=18'}
366
  peerDependencies:
367
  zod: ^3.0.0
 
369
  zod:
370
  optional: true
371
 
372
+ '@ai-sdk/[email protected].4':
373
+ resolution: {integrity: sha512-GMhcQCZbwM6RoZCri0MWeEWXRt/T+uCxsmHEsTwNvEH3GDjNzchfX25C8ftry2MeEOOn6KfqCLSKomcgK6RoOg==}
374
  engines: {node: '>=18'}
375
  peerDependencies:
376
  zod: ^3.0.0
 
390
  resolution: {integrity: sha512-XMsNGJdGO+L0cxhhegtqZ8+T6nn4EoShS819OvCgI2kLbYTIvk0GWFGD0AXJmxkxs3DrpsJxKAFukFR7bvTkgQ==}
391
  engines: {node: '>=18'}
392
 
 
 
 
 
393
  '@ai-sdk/[email protected]':
394
  resolution: {integrity: sha512-mV+3iNDkzUsZ0pR2jG0sVzU6xtQY5DtSCBy3JFycLp6PwjyLw/iodfL3MwdmMCRJWgs3dadcHejRnMvF9nGTBg==}
395
  engines: {node: '>=18'}
396
 
397
+ '@ai-sdk/provider@1.0.2':
398
+ resolution: {integrity: sha512-YYtP6xWQyaAf5LiWLJ+ycGTOeBLWrED7LUrvc+SQIWhGaneylqbaGsyQL7VouQUeQ4JZ1qKYZuhmi3W56HADPA==}
399
+ engines: {node: '>=18'}
400
+
401
+ '@ai-sdk/[email protected]':
402
+ resolution: {integrity: sha512-8Hkserq0Ge6AEi7N4hlv2FkfglAGbkoAXEZ8YSp255c3PbnZz6+/5fppw+aROmZMOfNwallSRuy1i/iPa2rBpQ==}
403
  engines: {node: '>=18'}
404
  peerDependencies:
405
  react: ^18 || ^19 || ^19.0.0-rc
 
410
  zod:
411
  optional: true
412
 
413
+ '@ai-sdk/ui-utils@1.0.5':
414
+ resolution: {integrity: sha512-DGJSbDf+vJyWmFNexSPUsS1AAy7gtsmFmoSyNbNbJjwl9hRIf2dknfA1V0ahx6pg3NNklNYFm53L8Nphjovfvg==}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  engines: {node: '>=18'}
416
  peerDependencies:
417
  zod: ^3.0.0
 
419
  zod:
420
  optional: true
421
 
 
 
 
 
 
 
 
 
 
422
  '@ampproject/[email protected]':
423
  resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
424
  engines: {node: '>=6.0.0'}
 
1533
  '@types/react':
1534
  optional: true
1535
 
1536
+ '@radix-ui/[email protected]':
1537
+ resolution: {integrity: sha512-99EatSTpW+hRYHt7m8wdDlLtkmTovEe8Z/hnxUPV+SKuuNL5HWNhQI4QSdjZqNSgXHay2z4M3Dym73j9p2Gx5Q==}
1538
+ peerDependencies:
1539
+ '@types/react': '*'
1540
+ '@types/react-dom': '*'
1541
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
1542
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
1543
+ peerDependenciesMeta:
1544
+ '@types/react':
1545
+ optional: true
1546
+ '@types/react-dom':
1547
+ optional: true
1548
+
1549
  '@radix-ui/[email protected]':
1550
  resolution: {integrity: sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==}
1551
  peerDependencies:
 
2343
  '@vitest/[email protected]':
2344
  resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==}
2345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2346
  '@web3-storage/[email protected]':
2347
  resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==}
2348
 
 
2378
  peerDependencies:
2379
  acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
2380
 
 
 
 
 
 
2381
2382
  resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==}
2383
  engines: {node: '>=0.4.0'}
 
2391
  resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
2392
  engines: {node: '>=8'}
2393
 
2394
+ ai@4.0.18:
2395
+ resolution: {integrity: sha512-BTWzalLNE1LQphEka5xzJXDs5v4xXy1Uzr7dAVk+C/CnO3WNpuMBgrCymwUv0VrWaWc8xMQuh+OqsT7P7JyekQ==}
2396
  engines: {node: '>=18'}
2397
  peerDependencies:
 
2398
  react: ^18 || ^19 || ^19.0.0-rc
 
 
2399
  zod: ^3.0.0
2400
  peerDependenciesMeta:
 
 
2401
  react:
2402
  optional: true
 
 
 
 
2403
  zod:
2404
  optional: true
2405
 
 
2436
  resolution: {integrity: sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==}
2437
  engines: {node: '>=10'}
2438
 
 
 
 
 
2439
2440
  resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}
2441
 
 
2463
  resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
2464
  engines: {node: '>= 0.4'}
2465
 
 
 
 
 
2466
2467
  resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
2468
 
 
3071
  jiti:
3072
  optional: true
3073
 
 
 
 
3074
3075
  resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==}
3076
  engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
 
3083
  resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
3084
  engines: {node: '>=0.10'}
3085
 
 
 
 
3086
3087
  resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
3088
  engines: {node: '>=4.0'}
 
3736
  resolution: {integrity: sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==}
3737
  engines: {node: '>=14'}
3738
 
 
 
 
3739
3740
  resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
3741
  engines: {node: '>=10'}
 
5103
  resolution: {integrity: sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==}
5104
  engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
5105
 
 
 
 
 
 
5106
5107
  resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
5108
 
 
5193
  resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
5194
  engines: {node: '>= 0.4'}
5195
 
 
 
 
 
5196
5197
  resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==}
5198
  peerDependencies:
5199
  react: ^16.11.0 || ^17.0.0 || ^18.0.0
5200
 
 
 
 
 
 
 
 
 
5201
5202
  resolution: {integrity: sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==}
5203
  engines: {node: '>=16.0.0'}
 
5617
5618
  resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==}
5619
 
 
 
 
 
 
 
 
 
5620
5621
  resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
5622
 
 
5731
5732
  resolution: {integrity: sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==}
5733
 
 
 
 
5734
5735
  resolution: {integrity: sha512-5wlSS0bXfF/BrL4jPAbz9da5hDlDptdEppYfe+x4eIJ7jioqKG9uUxOwPzqof09u/XeVdrgFu29lZi+8XNDJtA==}
5736
  peerDependencies:
 
5793
  optionalDependencies:
5794
  zod: 3.23.8
5795
 
 
 
 
 
 
 
 
 
 
5796
5797
  dependencies:
5798
  '@ai-sdk/provider': 0.0.17
 
5811
  optionalDependencies:
5812
  zod: 3.23.8
5813
 
5814
5815
+ dependencies:
5816
+ '@ai-sdk/provider': 1.0.2
5817
+ eventsource-parser: 3.0.0
5818
+ nanoid: 3.3.8
5819
+ secure-json-parse: 2.7.0
5820
+ optionalDependencies:
5821
+ zod: 3.23.8
5822
+
5823
  '@ai-sdk/[email protected]':
5824
  dependencies:
5825
  json-schema: 0.4.0
 
5832
  dependencies:
5833
  json-schema: 0.4.0
5834
 
5835
+ '@ai-sdk/provider@1.0.1':
5836
  dependencies:
5837
  json-schema: 0.4.0
5838
 
5839
+ '@ai-sdk/[email protected].2':
5840
  dependencies:
5841
  json-schema: 0.4.0
5842
 
5843
+ '@ai-sdk/react@1.0.6([email protected])([email protected])':
5844
  dependencies:
5845
+ '@ai-sdk/provider-utils': 2.0.4([email protected])
5846
+ '@ai-sdk/ui-utils': 1.0.5([email protected])
5847
  swr: 2.2.5([email protected])
5848
  throttleit: 2.1.0
5849
  optionalDependencies:
5850
  react: 18.3.1
5851
  zod: 3.23.8
5852
 
5853
+ '@ai-sdk/ui-utils@1.0.5([email protected])':
 
 
 
 
 
 
 
5854
  dependencies:
5855
+ '@ai-sdk/provider': 1.0.2
5856
+ '@ai-sdk/provider-utils': 2.0.4([email protected])
 
 
 
 
 
 
 
 
 
 
 
 
5857
  zod-to-json-schema: 3.23.5([email protected])
5858
  optionalDependencies:
5859
  zod: 3.23.8
5860
 
 
 
 
 
 
 
 
 
 
 
5861
  '@ampproject/[email protected]':
5862
  dependencies:
5863
  '@jridgewell/gen-mapping': 0.3.5
 
6904
  optionalDependencies:
6905
  '@types/react': 18.3.12
6906
 
6907
6908
+ dependencies:
6909
+ '@radix-ui/primitive': 1.1.0
6910
+ '@radix-ui/react-context': 1.1.1(@types/[email protected])([email protected])
6911
6912
+ '@radix-ui/react-primitive': 2.0.0(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])
6913
+ '@radix-ui/react-use-callback-ref': 1.1.0(@types/[email protected])([email protected])
6914
+ '@radix-ui/react-use-controllable-state': 1.1.0(@types/[email protected])([email protected])
6915
+ react: 18.3.1
6916
+ react-dom: 18.3.1([email protected])
6917
+ optionalDependencies:
6918
+ '@types/react': 18.3.12
6919
+ '@types/react-dom': 18.3.1
6920
+
6921
6922
  dependencies:
6923
  react: 18.3.1
 
7901
  loupe: 3.1.2
7902
  tinyrainbow: 1.2.0
7903
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7904
  '@web3-storage/[email protected]': {}
7905
 
7906
  '@webcontainer/[email protected]': {}
 
7931
  dependencies:
7932
  acorn: 8.14.0
7933
 
 
 
 
 
7934
7935
  dependencies:
7936
  acorn: 8.14.0
 
7942
  clean-stack: 2.2.0
7943
  indent-string: 4.0.0
7944
 
7945
7946
  dependencies:
7947
+ '@ai-sdk/provider': 1.0.2
7948
+ '@ai-sdk/provider-utils': 2.0.4([email protected])
7949
+ '@ai-sdk/react': 1.0.6([email protected])([email protected])
7950
+ '@ai-sdk/ui-utils': 1.0.5([email protected])
 
 
 
7951
  '@opentelemetry/api': 1.9.0
 
 
7952
  jsondiffpatch: 0.6.0
 
7953
  zod-to-json-schema: 3.23.5([email protected])
7954
  optionalDependencies:
7955
  react: 18.3.1
 
 
7956
  zod: 3.23.8
 
 
 
7957
 
7958
7959
  dependencies:
 
7985
  dependencies:
7986
  tslib: 2.8.1
7987
 
 
 
7988
7989
 
7990
 
8015
  dependencies:
8016
  possible-typed-array-names: 1.0.0
8017
 
 
 
8018
8019
 
8020
 
8714
  transitivePeerDependencies:
8715
  - supports-color
8716
 
 
 
8717
8718
  dependencies:
8719
  acorn: 8.14.0
 
8730
  dependencies:
8731
  estraverse: 5.3.0
8732
 
 
 
 
 
 
8733
8734
  dependencies:
8735
  estraverse: 5.3.0
 
9456
  mlly: 1.7.3
9457
  pkg-types: 1.2.1
9458
 
 
 
9459
9460
  dependencies:
9461
  p-locate: 5.0.0
 
11266
  dependencies:
11267
  minipass: 7.1.2
11268
 
 
 
 
 
 
11269
11270
 
11271
 
11356
 
11357
11358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11359
11360
  dependencies:
11361
  client-only: 0.0.1
11362
  react: 18.3.1
11363
  use-sync-external-store: 1.2.2([email protected])
11364
 
 
 
 
 
 
 
11365
11366
  dependencies:
11367
  sync-message-port: 1.1.3
 
11839
 
11840
11841
 
 
 
 
 
 
 
 
 
 
 
11842
11843
 
11844
 
11951
  mustache: 4.2.0
11952
  stacktracey: 2.1.8
11953
 
 
 
11954
11955
  dependencies:
11956
  zod: 3.23.8
public/favicon.ico ADDED
public/icons/Default.svg ADDED
public/icons/Perplexity.svg ADDED
uno.config.ts CHANGED
@@ -241,6 +241,7 @@ export default defineConfig({
241
  collections: {
242
  ...customIconCollection,
243
  },
 
244
  }),
245
  ],
246
  });
 
241
  collections: {
242
  ...customIconCollection,
243
  },
244
+ unit: 'em',
245
  }),
246
  ],
247
  });
vite.config.ts CHANGED
@@ -19,7 +19,8 @@ export default defineConfig((config) => {
19
  future: {
20
  v3_fetcherPersist: true,
21
  v3_relativeSplatPath: true,
22
- v3_throwAbortReason: true
 
23
  },
24
  }),
25
  UnoCSS(),
 
19
  future: {
20
  v3_fetcherPersist: true,
21
  v3_relativeSplatPath: true,
22
+ v3_throwAbortReason: true,
23
+ v3_lazyRouteDiscovery: true
24
  },
25
  }),
26
  UnoCSS(),
worker-configuration.d.ts CHANGED
@@ -14,4 +14,5 @@ interface Env {
14
  GOOGLE_GENERATIVE_AI_API_KEY: string;
15
  MISTRAL_API_KEY: string;
16
  XAI_API_KEY: string;
 
17
  }
 
14
  GOOGLE_GENERATIVE_AI_API_KEY: string;
15
  MISTRAL_API_KEY: string;
16
  XAI_API_KEY: string;
17
+ PERPLEXITY_API_KEY: string;
18
  }