Compare commits
248 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e44cb8ff7 | ||
|
|
89eac1ba8b | ||
|
|
5567d6deac | ||
|
|
f511a273de | ||
|
|
e61459eb9e | ||
|
|
c257129a61 | ||
|
|
016488998d | ||
|
|
e4866eb75e | ||
|
|
0b47365846 | ||
|
|
25b80ab267 | ||
|
|
ad19d3f8f4 | ||
|
|
7a0223d21a | ||
|
|
0a4ef117ae | ||
|
|
bf7e500452 | ||
|
|
bf76a0b2e7 | ||
|
|
7e650af569 | ||
|
|
0a2e0f2f3a | ||
|
|
43e1f436f5 | ||
|
|
208830151e | ||
|
|
8110c69eda | ||
|
|
356715ccd7 | ||
|
|
25e6bb3e84 | ||
|
|
329152f56d | ||
|
|
5f144e6994 | ||
|
|
92476dd2d7 | ||
|
|
49b02dd885 | ||
|
|
e601da9612 | ||
|
|
47a1def877 | ||
|
|
00d871bace | ||
|
|
de2cb43d17 | ||
|
|
d473b2b713 | ||
|
|
7158ad6237 | ||
|
|
412f290e81 | ||
|
|
eb1d5417e7 | ||
|
|
647d2dc0cb | ||
|
|
f15dbd2a4e | ||
|
|
9f6ce6ab70 | ||
|
|
6987ceae9e | ||
|
|
15ce03598f | ||
|
|
8aee6ebf47 | ||
|
|
8deed62546 | ||
|
|
278322d544 | ||
|
|
995fb81ac7 | ||
|
|
951b11005f | ||
|
|
c2766cb5fc | ||
|
|
f752bf7da5 | ||
|
|
bb94180209 | ||
|
|
2553814416 | ||
|
|
976676399e | ||
|
|
78505ed2f3 | ||
|
|
a15544749a | ||
|
|
dd24ccc298 | ||
|
|
77073a5e7f | ||
|
|
c3c9e43935 | ||
|
|
3b8d251a55 | ||
|
|
070e911be1 | ||
|
|
1b76d3c28f | ||
|
|
225b553876 | ||
|
|
66cb2af6df | ||
|
|
960f532f82 | ||
|
|
6ba93974a0 | ||
|
|
d0d0fcd88f | ||
|
|
039e616bf5 | ||
|
|
9e1c44a8c9 | ||
|
|
810cc81a16 | ||
|
|
a69cda5123 | ||
|
|
66a445d548 | ||
|
|
a6fa133321 | ||
|
|
0157fddc76 | ||
|
|
2119a92031 | ||
|
|
f34c173aaa | ||
|
|
d9b2801434 | ||
|
|
21bfcfcec4 | ||
|
|
90847e7cb6 | ||
|
|
19a3a03d45 | ||
|
|
a053bfc96f | ||
|
|
02621e3545 | ||
|
|
d22b32ae63 | ||
|
|
a340611310 | ||
|
|
b5867835f5 | ||
|
|
e9376db705 | ||
|
|
d75899d737 | ||
|
|
bc6b84851f | ||
|
|
1c3582c440 | ||
|
|
1e7c3a4ff8 | ||
|
|
15f624e0ee | ||
|
|
d3727459aa | ||
|
|
2819911b96 | ||
|
|
885e104f27 | ||
|
|
fb8191ebb0 | ||
|
|
316c210e86 | ||
|
|
c4f94aa517 | ||
|
|
4016f54933 | ||
|
|
4caae9cec3 | ||
|
|
e223e9b6af | ||
|
|
b5c8d43d9e | ||
|
|
aab917eb7e | ||
|
|
30728ae5bd | ||
|
|
51347edd28 | ||
|
|
c5c3eee267 | ||
|
|
69b1dc4c9a | ||
|
|
fe24f3c011 | ||
|
|
348f396d32 | ||
|
|
253e37f901 | ||
|
|
1f513accc9 | ||
|
|
31706183b4 | ||
|
|
4d9ecbe201 | ||
|
|
b160d23b48 | ||
|
|
a698fba1c7 | ||
|
|
9f5c01f5dd | ||
|
|
ed6433e8cd | ||
|
|
87a90718d3 | ||
|
|
825137a447 | ||
|
|
9cd9ee9088 | ||
|
|
2bb9f609dc | ||
|
|
6467995ac3 | ||
|
|
2b8236f988 | ||
|
|
c54e6e588e | ||
|
|
c7cdbdfc3d | ||
|
|
23346f6271 | ||
|
|
558d4b2e10 | ||
|
|
fc13754788 | ||
|
|
b3f7a5c378 | ||
|
|
61ac8f9808 | ||
|
|
d936c012bd | ||
|
|
4541a3e9dd | ||
|
|
7c3a3bbde6 | ||
|
|
ecbf2f3bcd | ||
|
|
a87cfd7950 | ||
|
|
70f88f981a | ||
|
|
4ea38e8766 | ||
|
|
25fe15232f | ||
|
|
b8e457eeb7 | ||
|
|
b06f6e3a3e | ||
|
|
86f37fcaca | ||
|
|
2cb8c825d0 | ||
|
|
aa3559149f | ||
|
|
e0d0c4b697 | ||
|
|
a976a25094 | ||
|
|
bb03c30ddd | ||
|
|
5893629306 | ||
|
|
d4aa189cee | ||
|
|
1e73e8863a | ||
|
|
2e05270bab | ||
|
|
9efc709782 | ||
|
|
ece0213500 | ||
|
|
3aab6c7b68 | ||
|
|
43370f515d | ||
|
|
9408ae4dd9 | ||
|
|
483189ab46 | ||
|
|
5cb693c415 | ||
|
|
09881a478c | ||
|
|
4f10fb1294 | ||
|
|
9b98670ccb | ||
|
|
54c7e3d8f9 | ||
|
|
eb53146937 | ||
|
|
4db916928c | ||
|
|
7a31db904d | ||
|
|
f87522f106 | ||
|
|
f27f7bba51 | ||
|
|
4f02887565 | ||
|
|
3db4004642 | ||
|
|
79ce87ee5d | ||
|
|
a71cfba660 | ||
|
|
4af18c069f | ||
|
|
02d0be5feb | ||
|
|
81d2c01442 | ||
|
|
6a5ed21c0f | ||
|
|
8bcd82c9d4 | ||
|
|
6ffcdd8b3c | ||
|
|
a936c5a990 | ||
|
|
bbda3a1db4 | ||
|
|
4cfabd94ee | ||
|
|
9666b2ab67 | ||
|
|
55094392cf | ||
|
|
456c89429a | ||
|
|
77425d61d9 | ||
|
|
8c4397a19f | ||
|
|
32409047ff | ||
|
|
301675e30c | ||
|
|
1e04ab38b0 | ||
|
|
d1fa70fc97 | ||
|
|
fe3889be81 | ||
|
|
461cf27fc7 | ||
|
|
4980a9a33c | ||
|
|
c4a94d6595 | ||
|
|
1d64a15ed0 | ||
|
|
b6df84b56a | ||
|
|
0c899e430a | ||
|
|
da07c667af | ||
|
|
bc44e6fa3a | ||
|
|
69ec309f81 | ||
|
|
ddb920df7c | ||
|
|
56944de633 | ||
|
|
ff2726fd2f | ||
|
|
1764145ba4 | ||
|
|
ba1b5543db | ||
|
|
4321007e4f | ||
|
|
5f34051510 | ||
|
|
85b0322fd6 | ||
|
|
5773b1e271 | ||
|
|
d479daa578 | ||
|
|
78cd04a541 | ||
|
|
eeafc12522 | ||
|
|
a568421cef | ||
|
|
dd296ab00d | ||
|
|
77b47c1ce6 | ||
|
|
ec4b43d7a3 | ||
|
|
bbf36b23f4 | ||
|
|
d13da30bda | ||
|
|
4329e77664 | ||
|
|
8f15c81f37 | ||
|
|
4ba5d37fcd | ||
|
|
e5ecb0b7d5 | ||
|
|
a6d6fef7d6 | ||
|
|
f8e090b9d4 | ||
|
|
a9f8c2bb6a | ||
|
|
7bafd2a5d6 | ||
|
|
c0c1275226 | ||
|
|
b1a3e3993e | ||
|
|
b16aab1f16 | ||
|
|
a404a35d0e | ||
|
|
49e6c8034d | ||
|
|
b0ca49d65e | ||
|
|
87057f8137 | ||
|
|
e39f16e436 | ||
|
|
e716ca55f0 | ||
|
|
3bc8c5f856 | ||
|
|
e3bdd6944b | ||
|
|
97b886abf0 | ||
|
|
da37d9456f | ||
|
|
3c7b125828 | ||
|
|
74b6d27283 | ||
|
|
9b48f2471e | ||
|
|
9a8dcce906 | ||
|
|
b1e54a493f | ||
|
|
dfbbea110e | ||
|
|
fcb61ba499 | ||
|
|
6eb2d84dff | ||
|
|
13a15e9a3d | ||
|
|
eb36ec6170 | ||
|
|
b304749b21 | ||
|
|
ea5c6244a6 | ||
|
|
0e86bf7709 | ||
|
|
a2da05e9cb | ||
|
|
7fdab0ad6a | ||
|
|
8b7e18e627 | ||
|
|
44bda1500a |
@@ -70,6 +70,11 @@ LMSTUDIO_API_BASE_URL=
|
|||||||
# You only need this environment variable set if you want to use xAI models
|
# You only need this environment variable set if you want to use xAI models
|
||||||
XAI_API_KEY=
|
XAI_API_KEY=
|
||||||
|
|
||||||
|
# Get your Perplexity API Key here -
|
||||||
|
# https://www.perplexity.ai/settings/api
|
||||||
|
# You only need this environment variable set if you want to use Perplexity models
|
||||||
|
PERPLEXITY_API_KEY=
|
||||||
|
|
||||||
# Include this environment variable if you want more logging for debugging locally
|
# Include this environment variable if you want more logging for debugging locally
|
||||||
VITE_LOG_LEVEL=debug
|
VITE_LOG_LEVEL=debug
|
||||||
|
|
||||||
|
|||||||
10
.github/workflows/commit.yaml
vendored
@@ -17,12 +17,18 @@ jobs:
|
|||||||
- name: Checkout the code
|
- name: Checkout the code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
- name: Get the latest commit hash
|
- name: Get the latest commit hash
|
||||||
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
run: |
|
||||||
|
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
||||||
|
echo "CURRENT_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Update commit file
|
- name: Update commit file
|
||||||
run: |
|
run: |
|
||||||
echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json
|
echo "{ \"commit\": \"$COMMIT_HASH\", \"version\": \"$CURRENT_VERSION\" }" > app/commit.json
|
||||||
|
|
||||||
- name: Commit and push the update
|
- name: Commit and push the update
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
31
.github/workflows/update-stable.yml
vendored
@@ -9,30 +9,7 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-commit:
|
|
||||||
if: contains(github.event.head_commit.message, '#release')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout the code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Get the latest commit hash
|
|
||||||
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Update commit file
|
|
||||||
run: |
|
|
||||||
echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json
|
|
||||||
|
|
||||||
- name: Commit and push the update
|
|
||||||
run: |
|
|
||||||
git config --global user.name "github-actions[bot]"
|
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add app/commit.json
|
|
||||||
git commit -m "chore: update commit hash to $COMMIT_HASH"
|
|
||||||
git push
|
|
||||||
prepare-release:
|
prepare-release:
|
||||||
needs: update-commit
|
|
||||||
if: contains(github.event.head_commit.message, '#release')
|
if: contains(github.event.head_commit.message, '#release')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -181,10 +158,16 @@ jobs:
|
|||||||
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
|
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
|
||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Get the latest commit hash and version tag
|
||||||
|
run: |
|
||||||
|
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
||||||
|
echo "NEW_VERSION=${{ steps.bump_version.outputs.new_version }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Commit and Tag Release
|
- name: Commit and Tag Release
|
||||||
run: |
|
run: |
|
||||||
git pull
|
git pull
|
||||||
git add package.json pnpm-lock.yaml changelog.md
|
echo "{ \"commit\": \"$COMMIT_HASH\", \"version\": \"$NEW_VERSION\" }" > app/commit.json
|
||||||
|
git add package.json pnpm-lock.yaml changelog.md app/commit.json
|
||||||
git commit -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
|
git commit -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
|
||||||
git tag "v${{ steps.bump_version.outputs.new_version }}"
|
git tag "v${{ steps.bump_version.outputs.new_version }}"
|
||||||
git push
|
git push
|
||||||
|
|||||||
3
.gitignore
vendored
@@ -37,3 +37,6 @@ modelfiles
|
|||||||
|
|
||||||
# docs ignore
|
# docs ignore
|
||||||
site
|
site
|
||||||
|
|
||||||
|
# commit file ignore
|
||||||
|
app/commit.json
|
||||||
@@ -2,25 +2,42 @@
|
|||||||
|
|
||||||
echo "🔍 Running pre-commit hook to check the code looks good... 🔍"
|
echo "🔍 Running pre-commit hook to check the code looks good... 🔍"
|
||||||
|
|
||||||
|
# Load NVM if available (useful for managing Node.js versions)
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # Load nvm if you're using i
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
|
||||||
|
# Ensure `pnpm` is available
|
||||||
|
echo "Checking if pnpm is available..."
|
||||||
|
if ! command -v pnpm >/dev/null 2>&1; then
|
||||||
|
echo "❌ pnpm not found! Please ensure pnpm is installed and available in PATH."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run typecheck
|
||||||
echo "Running typecheck..."
|
echo "Running typecheck..."
|
||||||
which pnpm
|
|
||||||
|
|
||||||
if ! pnpm typecheck; then
|
if ! pnpm typecheck; then
|
||||||
echo "❌ Type checking failed! Please review TypeScript types."
|
echo "❌ Type checking failed! Please review TypeScript types."
|
||||||
echo "Once you're done, don't forget to add your changes to the commit! 🚀"
|
echo "Once you're done, don't forget to add your changes to the commit! 🚀"
|
||||||
echo "Typecheck exit code: $?"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run lint
|
||||||
echo "Running lint..."
|
echo "Running lint..."
|
||||||
if ! pnpm lint; then
|
if ! pnpm lint; then
|
||||||
echo "❌ Linting failed! 'pnpm lint:fix' will help you fix the easy ones."
|
echo "❌ Linting failed! Run 'pnpm lint:fix' to fix the easy issues."
|
||||||
echo "Once you're done, don't forget to add your beautification to the commit! 🤩"
|
echo "Once you're done, don't forget to add your beautification to the commit! 🤩"
|
||||||
echo "lint exit code: $?"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "👍 All good! Committing changes..."
|
# Update commit.json with the latest commit hash
|
||||||
|
echo "Updating commit.json with the latest commit hash..."
|
||||||
|
COMMIT_HASH=$(git rev-parse HEAD)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "❌ Failed to get commit hash. Ensure you are in a git repository."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json
|
||||||
|
git add app/commit.json
|
||||||
|
|
||||||
|
echo "👍 All checks passed! Committing changes..."
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Contributing to oTToDev
|
# Contributing to bolt.diy
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
## 📋 Table of Contents
|
## 📋 Table of Contents
|
||||||
- [Code of Conduct](#code-of-conduct)
|
- [Code of Conduct](#code-of-conduct)
|
||||||
|
|||||||
29
FAQ.md
@@ -1,12 +1,12 @@
|
|||||||
[](https://bolt.new)
|
[](https://bolt.diy)
|
||||||
|
|
||||||
# Bolt.new Fork by Cole Medin - Bolt.diy
|
# bolt.diy
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### How do I get the best results with Bolt.diy?
|
### How do I get the best results with bolt.diy?
|
||||||
|
|
||||||
- **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.
|
- **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.
|
||||||
|
|
||||||
- **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.
|
- **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.
|
||||||
|
|
||||||
@@ -14,36 +14,29 @@
|
|||||||
|
|
||||||
- **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.
|
- **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.
|
||||||
|
|
||||||
### Do you plan on merging Bolt.diy back into the official Bolt.new repo?
|
|
||||||
|
|
||||||
More news coming on this coming early next month - stay tuned!
|
|
||||||
|
|
||||||
### Why are there so many open issues/pull requests?
|
### Why are there so many open issues/pull requests?
|
||||||
|
|
||||||
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
|
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!
|
||||||
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!
|
|
||||||
|
|
||||||
### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for Bolt.diy/Bolt.new?
|
### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for bolt.diy/bolt.new?
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
### I'm getting the error: "There was an error processing this request"
|
### I'm getting the error: "There was an error processing this request"
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### I'm getting the error: "x-api-key header missing"
|
### I'm getting the error: "x-api-key header missing"
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
### I'm getting a blank preview when Bolt.diy runs my app!
|
### I'm getting a blank preview when bolt.diy runs my app!
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### How to add a LLM:
|
### How to add a LLM:
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
|
|||||||
297
README.md
@@ -1,14 +1,14 @@
|
|||||||
[](https://bolt.new)
|
[](https://bolt.diy)
|
||||||
|
|
||||||
# Bolt.diy (Previously oTToDev)
|
# bolt.diy (Previously oTToDev)
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Check the [Bolt.diy Docs](https://stackblitz-labs.github.io/bolt.diy/) for more information. This documentation is still being updated after the transfer.
|
Check the [bolt.diy Docs](https://stackblitz-labs.github.io/bolt.diy/) for more information. This documentation is still being updated after the transfer.
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
## Join the community for Bolt.diy!
|
## Join the community for bolt.diy!
|
||||||
|
|
||||||
https://thinktank.ottomator.ai
|
https://thinktank.ottomator.ai
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ https://thinktank.ottomator.ai
|
|||||||
- ✅ Autogenerate Ollama models from what is downloaded (@yunatamos)
|
- ✅ Autogenerate Ollama models from what is downloaded (@yunatamos)
|
||||||
- ✅ Filter models by provider (@jasonm23)
|
- ✅ Filter models by provider (@jasonm23)
|
||||||
- ✅ Download project as ZIP (@fabwaseem)
|
- ✅ Download project as ZIP (@fabwaseem)
|
||||||
- ✅ Improvements to the main Bolt.new prompt in `app\lib\.server\llm\prompts.ts` (@kofi-bhr)
|
- ✅ Improvements to the main bolt.new prompt in `app\lib\.server\llm\prompts.ts` (@kofi-bhr)
|
||||||
- ✅ DeepSeek API Integration (@zenith110)
|
- ✅ DeepSeek API Integration (@zenith110)
|
||||||
- ✅ Mistral API Integration (@ArulGandhi)
|
- ✅ Mistral API Integration (@ArulGandhi)
|
||||||
- ✅ "Open AI Like" API Integration (@ZerxZ)
|
- ✅ "Open AI Like" API Integration (@ZerxZ)
|
||||||
@@ -43,8 +43,12 @@ https://thinktank.ottomator.ai
|
|||||||
- ✅ Mobile friendly (@qwikode)
|
- ✅ Mobile friendly (@qwikode)
|
||||||
- ✅ Better prompt enhancing (@SujalXplores)
|
- ✅ Better prompt enhancing (@SujalXplores)
|
||||||
- ✅ Attach images to prompts (@atrokhym)
|
- ✅ Attach images to prompts (@atrokhym)
|
||||||
- ✅ Detect package.json and commands to auto install and run preview for folder and git import (@wonderwhy-er)
|
- ✅ Added Git Clone button (@thecodacus)
|
||||||
- ⬜ **HIGH PRIORITY** - Prevent Bolt from rewriting files as often (file locking and diffs)
|
- ✅ Git Import from url (@thecodacus)
|
||||||
|
- ✅ PromptLibrary to have different variations of prompts for different use cases (@thecodacus)
|
||||||
|
- ✅ Detect package.json and commands to auto install & run preview for folder and git import (@wonderwhy-er)
|
||||||
|
- ✅ Selection tool to target changes visually (@emcconnell)
|
||||||
|
- ⬜ **HIGH PRIORITY** - Prevent bolt from rewriting files as often (file locking and diffs)
|
||||||
- ⬜ **HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
|
- ⬜ **HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
|
||||||
- ⬜ **HIGH PRIORITY** - Run agents in the backend as opposed to a single model call
|
- ⬜ **HIGH PRIORITY** - Run agents in the backend as opposed to a single model call
|
||||||
- ⬜ Deploy directly to Vercel/Netlify/other similar platforms
|
- ⬜ Deploy directly to Vercel/Netlify/other similar platforms
|
||||||
@@ -56,187 +60,180 @@ https://thinktank.ottomator.ai
|
|||||||
- ⬜ Perplexity Integration
|
- ⬜ Perplexity Integration
|
||||||
- ⬜ Vertex AI Integration
|
- ⬜ Vertex AI Integration
|
||||||
|
|
||||||
## Bolt.new: AI-Powered Full-Stack Web Development in the Browser
|
## bolt.diy Features
|
||||||
|
|
||||||
Bolt.new (and by extension 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)
|
- **AI-powered full-stack web development** directly in your browser.
|
||||||
|
- **Support for multiple LLMs** with an extensible architecture to integrate additional models.
|
||||||
|
- **Attach images to prompts** for better contextual understanding.
|
||||||
|
- **Integrated terminal** to view output of LLM-run commands.
|
||||||
|
- **Revert code to earlier versions** for easier debugging and quicker changes.
|
||||||
|
- **Download projects as ZIP** for easy portability.
|
||||||
|
- **Integration-ready Docker support** for a hassle-free setup.
|
||||||
|
|
||||||
## What Makes Bolt.new Different
|
## Setup bolt.diy
|
||||||
|
|
||||||
Claude, v0, etc are incredible- but you can't install packages, run backends, or edit code. That’s where Bolt.new stands out:
|
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.
|
||||||
|
|
||||||
- **Full-Stack in the Browser**: Bolt.new integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to:
|
### Prerequisites
|
||||||
- Install and run npm tools and libraries (like Vite, Next.js, and more)
|
|
||||||
- Run Node.js servers
|
|
||||||
- Interact with third-party APIs
|
|
||||||
- Deploy to production from chat
|
|
||||||
- Share your work via a URL
|
|
||||||
|
|
||||||
- **AI with Environment Control**: Unlike traditional dev environments where the AI can only assist in code generation, Bolt.new 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.
|
1. **Install Git**: [Download Git](https://git-scm.com/downloads)
|
||||||
|
2. **Install Node.js**: [Download Node.js](https://nodejs.org/en/download/)
|
||||||
Whether you’re an experienced developer, a PM, or a designer, Bolt.new allows you to easily build production-grade full-stack applications.
|
|
||||||
|
|
||||||
For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo!
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
1. Install Git from https://git-scm.com/downloads
|
|
||||||
|
|
||||||
2. Install Node.js from https://nodejs.org/en/download/
|
|
||||||
|
|
||||||
Pay attention to the installer notes after completion.
|
|
||||||
|
|
||||||
On all operating systems, the path to Node.js should automatically be added to your system path. But you can check your path if you want to be sure. On Windows, you can search for "edit the system environment variables" in your system, select "Environment Variables..." once you are in the system properties, and then check for a path to Node in your "Path" system variable. On a Mac or Linux machine, it will tell you to check if /usr/local/bin is in your $PATH. To determine if usr/local/bin is included in $PATH open your Terminal and run:
|
|
||||||
|
|
||||||
|
- After installation, the Node.js path is usually added to your system automatically. To verify:
|
||||||
|
- **Windows**: Search for "Edit the system environment variables," click "Environment Variables," and check if `Node.js` is in the `Path` variable.
|
||||||
|
- **Mac/Linux**: Open a terminal and run:
|
||||||
|
```bash
|
||||||
|
echo $PATH
|
||||||
```
|
```
|
||||||
echo $PATH .
|
Look for `/usr/local/bin` in the output.
|
||||||
|
|
||||||
|
### Clone the Repository
|
||||||
|
|
||||||
|
Clone the repository using Git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone -b stable https://github.com/stackblitz-labs/bolt.diy
|
||||||
```
|
```
|
||||||
|
|
||||||
If you see usr/local/bin in the output then you're good to go.
|
### (Optional) Configure Environment Variables
|
||||||
|
|
||||||
3. Clone the repository (if you haven't already) by opening a Terminal window (or CMD with admin permissions) and then typing in this:
|
Most environment variables can be configured directly through the settings menu of the application. However, if you need to manually configure them:
|
||||||
|
|
||||||
```
|
1. Rename `.env.example` to `.env.local`.
|
||||||
git clone https://github.com/stackblitz-labs/bolt.diy.git
|
2. Add your LLM API keys. For example:
|
||||||
|
|
||||||
|
```env
|
||||||
|
GROQ_API_KEY=YOUR_GROQ_API_KEY
|
||||||
|
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
|
||||||
|
ANTHROPIC_API_KEY=YOUR_ANTHROPIC_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Rename .env.example to .env.local and add your LLM API keys. You will find this file on a Mac at "[your name]/bold.new-any-llm/.env.example". For Windows and Linux the path will be similar.
|
**Note**: Ollama does not require an API key as it runs locally.
|
||||||
|
|
||||||

|
3. Optionally, set additional configurations:
|
||||||
|
|
||||||
If you can't see the file indicated above, its likely you can't view hidden files. On Mac, open a Terminal window and enter this command below. On Windows, you will see the hidden files option in File Explorer Settings. A quick Google search will help you if you are stuck here.
|
```env
|
||||||
|
# Debugging
|
||||||
```
|
|
||||||
defaults write com.apple.finder AppleShowAllFiles YES
|
|
||||||
```
|
|
||||||
|
|
||||||
**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:
|
|
||||||
|
|
||||||
Get your GROQ API Key here: https://console.groq.com/keys
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
Get your Anthropic API Key in your account settings: https://console.anthropic.com/settings/keys
|
|
||||||
|
|
||||||
```
|
|
||||||
GROQ_API_KEY=XXX
|
|
||||||
OPENAI_API_KEY=XXX
|
|
||||||
ANTHROPIC_API_KEY=XXX
|
|
||||||
```
|
|
||||||
|
|
||||||
Optionally, you can set the debug level:
|
|
||||||
|
|
||||||
```
|
|
||||||
VITE_LOG_LEVEL=debug
|
VITE_LOG_LEVEL=debug
|
||||||
```
|
|
||||||
|
|
||||||
And if using Ollama set the DEFAULT_NUM_CTX, the example below uses 8K context and ollama running on localhost port 11434:
|
# Ollama settings (example: 8K context, localhost port 11434)
|
||||||
|
|
||||||
```
|
|
||||||
OLLAMA_API_BASE_URL=http://localhost:11434
|
OLLAMA_API_BASE_URL=http://localhost:11434
|
||||||
DEFAULT_NUM_CTX=8192
|
DEFAULT_NUM_CTX=8192
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore.
|
**Important**: Do not commit your `.env.local` file to version control. This file is already included in `.gitignore`.
|
||||||
|
|
||||||
## Run with Docker
|
---
|
||||||
|
|
||||||
Prerequisites:
|
## Run the Application
|
||||||
|
|
||||||
Git and Node.js as mentioned above, as well as Docker: https://www.docker.com/
|
### Option 1: Without Docker
|
||||||
|
|
||||||
### 1a. Using Helper Scripts
|
|
||||||
|
|
||||||
NPM scripts are provided for convenient building:
|
|
||||||
|
|
||||||
|
1. **Install Dependencies**:
|
||||||
```bash
|
```bash
|
||||||
# Development build
|
|
||||||
npm run dockerbuild
|
|
||||||
|
|
||||||
# Production build
|
|
||||||
npm run dockerbuild:prod
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1b. Direct Docker Build Commands (alternative to using NPM scripts)
|
|
||||||
|
|
||||||
You can use Docker's target feature to specify the build environment instead of using NPM scripts if you wish:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Development build
|
|
||||||
docker build . --target bolt-ai-development
|
|
||||||
|
|
||||||
# Production build
|
|
||||||
docker build . --target bolt-ai-production
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Docker Compose with Profiles to Run the Container
|
|
||||||
|
|
||||||
Use Docker Compose profiles to manage different environments:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Development environment
|
|
||||||
docker-compose --profile development up
|
|
||||||
|
|
||||||
# Production environment
|
|
||||||
docker-compose --profile production up
|
|
||||||
```
|
|
||||||
|
|
||||||
When you run the Docker Compose command with the development profile, any changes you
|
|
||||||
make on your machine to the code will automatically be reflected in the site running
|
|
||||||
on the container (i.e. hot reloading still applies!).
|
|
||||||
|
|
||||||
## Run Without Docker
|
|
||||||
|
|
||||||
1. Install dependencies using Terminal (or CMD in Windows with admin permissions):
|
|
||||||
|
|
||||||
```
|
|
||||||
pnpm install
|
pnpm install
|
||||||
```
|
```
|
||||||
|
If `pnpm` is not installed, install it using:
|
||||||
If you get an error saying "command not found: pnpm" or similar, then that means pnpm isn't installed. You can install it via this:
|
```bash
|
||||||
|
|
||||||
```
|
|
||||||
sudo npm install -g pnpm
|
sudo npm install -g pnpm
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Start the application with the command:
|
2. **Start the Application**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm run dev
|
pnpm run dev
|
||||||
```
|
```
|
||||||
## Available Scripts
|
|
||||||
|
|
||||||
- `pnpm run dev`: Starts the development server.
|
|
||||||
- `pnpm run build`: Builds the project.
|
|
||||||
- `pnpm run start`: Runs the built application locally using Wrangler Pages. This script uses `bindings.sh` to set up necessary bindings so you don't have to duplicate environment variables.
|
|
||||||
- `pnpm run preview`: Builds the project and then starts it locally, useful for testing the production build. Note, HTTP streaming currently doesn't work as expected with `wrangler pages dev`.
|
|
||||||
- `pnpm test`: Runs the test suite using Vitest.
|
|
||||||
- `pnpm run typecheck`: Runs TypeScript type checking.
|
|
||||||
- `pnpm run typegen`: Generates TypeScript types using Wrangler.
|
|
||||||
- `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
|
|
||||||
- `pnpm run lint:fix`: Runs the linter and automatically fixes issues according to your ESLint configuration.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
To start the development server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pnpm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
## How do I contribute to Bolt.diy?
|
### Option 2: With Docker
|
||||||
|
|
||||||
[Please check out our dedicated page for contributing to Bolt.diy here!](CONTRIBUTING.md)
|
#### Prerequisites
|
||||||
|
- Ensure Git, Node.js, and Docker are installed: [Download Docker](https://www.docker.com/)
|
||||||
|
|
||||||
## What are the future plans for Bolt.diy?
|
#### Steps
|
||||||
|
|
||||||
[Check out our Roadmap here!](https://roadmap.sh/r/ottodev-roadmap-2ovzo)
|
1. **Build the Docker Image**:
|
||||||
|
|
||||||
Lot more updates to this roadmap coming soon!
|
Use the provided NPM scripts:
|
||||||
|
```bash
|
||||||
|
npm run dockerbuild # Development build
|
||||||
|
npm run dockerbuild:prod # Production build
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, use Docker commands directly:
|
||||||
|
```bash
|
||||||
|
docker build . --target bolt-ai-development # Development build
|
||||||
|
docker build . --target bolt-ai-production # Production build
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Run the Container**:
|
||||||
|
Use Docker Compose profiles to manage environments:
|
||||||
|
```bash
|
||||||
|
docker-compose --profile development up # Development
|
||||||
|
docker-compose --profile production up # Production
|
||||||
|
```
|
||||||
|
|
||||||
|
- With the development profile, changes to your code will automatically reflect in the running container (hot reloading).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Update Your Local Version to the Latest
|
||||||
|
|
||||||
|
To keep your local version of bolt.diy up to date with the latest changes, follow these steps for your operating system:
|
||||||
|
|
||||||
|
#### 1. **Navigate to your project folder**
|
||||||
|
Navigate to the directory where you cloned the repository and open a terminal:
|
||||||
|
|
||||||
|
#### 2. **Fetch the Latest Changes**
|
||||||
|
Use Git to pull the latest changes from the main repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git pull origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. **Update Dependencies**
|
||||||
|
After pulling the latest changes, update the project dependencies by running the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm install
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 4. **Run the Application**
|
||||||
|
Once the updates are complete, you can start the application again with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
This ensures that you're running the latest version of bolt.diy and can take advantage of all the newest features and bug fixes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Available Scripts
|
||||||
|
|
||||||
|
- **`pnpm run dev`**: Starts the development server.
|
||||||
|
- **`pnpm run build`**: Builds the project.
|
||||||
|
- **`pnpm run start`**: Runs the built application locally using Wrangler Pages.
|
||||||
|
- **`pnpm run preview`**: Builds and runs the production build locally.
|
||||||
|
- **`pnpm test`**: Runs the test suite using Vitest.
|
||||||
|
- **`pnpm run typecheck`**: Runs TypeScript type checking.
|
||||||
|
- **`pnpm run typegen`**: Generates TypeScript types using Wrangler.
|
||||||
|
- **`pnpm run deploy`**: Deploys the project to Cloudflare Pages.
|
||||||
|
- **`pnpm run lint:fix`**: Automatically fixes linting issues.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
We welcome contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Roadmap
|
||||||
|
|
||||||
|
Explore upcoming features and priorities on our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
[Please check out our dedicated page for FAQ's related to Bolt.diy here!](FAQ.md)
|
For answers to common questions, visit our [FAQ Page](FAQ.md).
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{ "commit": "27fcd03db6e7d42d36ffb409e263857f4b05e063" }
|
{ "commit": "89eac1ba8b2ada92dd76da9671d17e08de61a8bf", "version": "0.0.2" }
|
||||||
|
|||||||
@@ -1,13 +1,30 @@
|
|||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { Markdown } from './Markdown';
|
import { Markdown } from './Markdown';
|
||||||
|
import type { JSONValue } from 'ai';
|
||||||
|
|
||||||
interface AssistantMessageProps {
|
interface AssistantMessageProps {
|
||||||
content: string;
|
content: string;
|
||||||
|
annotations?: JSONValue[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AssistantMessage = memo(({ content }: AssistantMessageProps) => {
|
export const AssistantMessage = memo(({ content, annotations }: AssistantMessageProps) => {
|
||||||
|
const filteredAnnotations = (annotations?.filter(
|
||||||
|
(annotation: JSONValue) => annotation && typeof annotation === 'object' && Object.keys(annotation).includes('type'),
|
||||||
|
) || []) as { type: string; value: any }[];
|
||||||
|
|
||||||
|
const usage: {
|
||||||
|
completionTokens: number;
|
||||||
|
promptTokens: number;
|
||||||
|
totalTokens: number;
|
||||||
|
} = filteredAnnotations.find((annotation) => annotation.type === 'usage')?.value;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden w-full">
|
<div className="overflow-hidden w-full">
|
||||||
|
{usage && (
|
||||||
|
<div className="text-sm text-bolt-elements-textSecondary mb-2">
|
||||||
|
Tokens: {usage.totalTokens} (prompt: {usage.promptTokens}, completion: {usage.completionTokens})
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<Markdown html>{content}</Markdown>
|
<Markdown html>{content}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import FilePreview from './FilePreview';
|
|||||||
import { ModelSelector } from '~/components/chat/ModelSelector';
|
import { ModelSelector } from '~/components/chat/ModelSelector';
|
||||||
import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition';
|
import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition';
|
||||||
import type { IProviderSetting, ProviderInfo } from '~/types/model';
|
import type { IProviderSetting, ProviderInfo } from '~/types/model';
|
||||||
|
import { ScreenshotStateManager } from './ScreenshotStateManager';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
const TEXTAREA_MIN_HEIGHT = 76;
|
const TEXTAREA_MIN_HEIGHT = 76;
|
||||||
|
|
||||||
@@ -75,7 +77,8 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
input = '',
|
input = '',
|
||||||
enhancingPrompt,
|
enhancingPrompt,
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
promptEnhanced,
|
|
||||||
|
// promptEnhanced,
|
||||||
enhancePrompt,
|
enhancePrompt,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
handleStop,
|
handleStop,
|
||||||
@@ -283,7 +286,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
<div ref={scrollRef} className="flex flex-col lg:flex-row overflow-y-auto w-full h-full">
|
<div ref={scrollRef} className="flex flex-col lg:flex-row overflow-y-auto w-full h-full">
|
||||||
<div className={classNames(styles.Chat, 'flex flex-col flex-grow lg:min-w-[var(--chat-min-width)] h-full')}>
|
<div className={classNames(styles.Chat, 'flex flex-col flex-grow lg:min-w-[var(--chat-min-width)] h-full')}>
|
||||||
{!chatStarted && (
|
{!chatStarted && (
|
||||||
<div id="intro" className="mt-[26vh] max-w-chat mx-auto text-center px-4 lg:px-0">
|
<div id="intro" className="mt-[16vh] max-w-chat mx-auto text-center px-4 lg:px-0">
|
||||||
<h1 className="text-3xl lg:text-6xl font-bold text-bolt-elements-textPrimary mb-4 animate-fade-in">
|
<h1 className="text-3xl lg:text-6xl font-bold text-bolt-elements-textPrimary mb-4 animate-fade-in">
|
||||||
Where ideas begin
|
Where ideas begin
|
||||||
</h1>
|
</h1>
|
||||||
@@ -376,6 +379,16 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
setImageDataList?.(imageDataList.filter((_, i) => i !== index));
|
setImageDataList?.(imageDataList.filter((_, i) => i !== index));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<ClientOnly>
|
||||||
|
{() => (
|
||||||
|
<ScreenshotStateManager
|
||||||
|
setUploadedFiles={setUploadedFiles}
|
||||||
|
setImageDataList={setImageDataList}
|
||||||
|
uploadedFiles={uploadedFiles}
|
||||||
|
imageDataList={imageDataList}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ClientOnly>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'relative shadow-xs border border-bolt-elements-borderColor backdrop-blur rounded-lg',
|
'relative shadow-xs border border-bolt-elements-borderColor backdrop-blur rounded-lg',
|
||||||
@@ -384,7 +397,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
<textarea
|
<textarea
|
||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'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',
|
'w-full pl-4 pt-4 pr-16 outline-none resize-none text-bolt-elements-textPrimary placeholder-bolt-elements-textTertiary bg-transparent text-sm',
|
||||||
'transition-all duration-200',
|
'transition-all duration-200',
|
||||||
'hover:border-bolt-elements-focus',
|
'hover:border-bolt-elements-focus',
|
||||||
)}
|
)}
|
||||||
@@ -431,6 +444,11 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore if using input method engine
|
||||||
|
if (event.nativeEvent.isComposing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
handleSendMessage?.(event);
|
handleSendMessage?.(event);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -473,25 +491,16 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
<IconButton
|
<IconButton
|
||||||
title="Enhance prompt"
|
title="Enhance prompt"
|
||||||
disabled={input.length === 0 || enhancingPrompt}
|
disabled={input.length === 0 || enhancingPrompt}
|
||||||
className={classNames(
|
className={classNames('transition-all', enhancingPrompt ? 'opacity-100' : '')}
|
||||||
'transition-all',
|
onClick={() => {
|
||||||
enhancingPrompt ? 'opacity-100' : '',
|
enhancePrompt?.();
|
||||||
promptEnhanced ? 'text-bolt-elements-item-contentAccent' : '',
|
toast.success('Prompt enhanced!');
|
||||||
promptEnhanced ? 'pr-1.5' : '',
|
}}
|
||||||
promptEnhanced ? 'enabled:hover:bg-bolt-elements-item-backgroundAccent' : '',
|
|
||||||
)}
|
|
||||||
onClick={() => enhancePrompt?.()}
|
|
||||||
>
|
>
|
||||||
{enhancingPrompt ? (
|
{enhancingPrompt ? (
|
||||||
<>
|
|
||||||
<div className="i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress text-xl animate-spin"></div>
|
<div className="i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress text-xl animate-spin"></div>
|
||||||
<div className="ml-1.5">Enhancing prompt...</div>
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
|
||||||
<div className="i-bolt:stars text-xl"></div>
|
<div className="i-bolt:stars text-xl"></div>
|
||||||
{promptEnhanced && <div className="ml-1.5">Prompt enhanced</div>}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import Cookies from 'js-cookie';
|
|||||||
import { debounce } from '~/utils/debounce';
|
import { debounce } from '~/utils/debounce';
|
||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
import type { ProviderInfo } from '~/types/model';
|
import type { ProviderInfo } from '~/types/model';
|
||||||
|
import { useSearchParams } from '@remix-run/react';
|
||||||
|
|
||||||
const toastAnimation = cssTransition({
|
const toastAnimation = cssTransition({
|
||||||
enter: 'animated fadeInRight',
|
enter: 'animated fadeInRight',
|
||||||
@@ -92,7 +93,9 @@ export const ChatImpl = memo(
|
|||||||
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
|
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
|
||||||
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
|
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
|
||||||
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
|
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
|
||||||
const { activeProviders } = useSettings();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
const files = useStore(workbenchStore.files);
|
||||||
|
const { activeProviders, promptId } = useSettings();
|
||||||
|
|
||||||
const [model, setModel] = useState(() => {
|
const [model, setModel] = useState(() => {
|
||||||
const savedModel = Cookies.get('selectedModel');
|
const savedModel = Cookies.get('selectedModel');
|
||||||
@@ -113,19 +116,48 @@ export const ChatImpl = memo(
|
|||||||
api: '/api/chat',
|
api: '/api/chat',
|
||||||
body: {
|
body: {
|
||||||
apiKeys,
|
apiKeys,
|
||||||
|
files,
|
||||||
|
promptId,
|
||||||
},
|
},
|
||||||
|
sendExtraMessageFields: true,
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
logger.error('Request failed\n\n', error);
|
logger.error('Request failed\n\n', error);
|
||||||
toast.error(
|
toast.error(
|
||||||
'There was an error processing your request: ' + (error.message ? error.message : 'No details were returned'),
|
'There was an error processing your request: ' + (error.message ? error.message : 'No details were returned'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onFinish: () => {
|
onFinish: (message, response) => {
|
||||||
|
const usage = response.usage;
|
||||||
|
|
||||||
|
if (usage) {
|
||||||
|
console.log('Token usage:', usage);
|
||||||
|
|
||||||
|
// You can now use the usage data as needed
|
||||||
|
}
|
||||||
|
|
||||||
logger.debug('Finished streaming');
|
logger.debug('Finished streaming');
|
||||||
},
|
},
|
||||||
initialMessages,
|
initialMessages,
|
||||||
initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '',
|
initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '',
|
||||||
});
|
});
|
||||||
|
useEffect(() => {
|
||||||
|
const prompt = searchParams.get('prompt');
|
||||||
|
console.log(prompt, searchParams, model, provider);
|
||||||
|
|
||||||
|
if (prompt) {
|
||||||
|
setSearchParams({});
|
||||||
|
runAnimation();
|
||||||
|
append({
|
||||||
|
role: 'user',
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: 'text',
|
||||||
|
text: `[Model: ${model}]\n\n[Provider: ${provider.name}]\n\n${prompt}`,
|
||||||
|
},
|
||||||
|
] as any, // Type assertion to bypass compiler check
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [model, provider, searchParams]);
|
||||||
|
|
||||||
const { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer();
|
const { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer();
|
||||||
const { parsedMessages, parseMessages } = useMessageParser();
|
const { parsedMessages, parseMessages } = useMessageParser();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export const CodeBlock = memo(
|
|||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
styles.CopyButtonContainer,
|
styles.CopyButtonContainer,
|
||||||
'bg-white absolute top-[10px] right-[10px] rounded-md z-10 text-lg flex items-center justify-center opacity-0 group-hover:opacity-100',
|
'bg-transparant absolute top-[10px] right-[10px] rounded-md z-10 text-lg flex items-center justify-center opacity-0 group-hover:opacity-100',
|
||||||
{
|
{
|
||||||
'rounded-l-0 opacity-100': copied,
|
'rounded-l-0 opacity-100': copied,
|
||||||
},
|
},
|
||||||
@@ -62,7 +62,7 @@ export const CodeBlock = memo(
|
|||||||
{!disableCopy && (
|
{!disableCopy && (
|
||||||
<button
|
<button
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'flex items-center bg-transparent p-[6px] justify-center before:bg-white before:rounded-l-md before:text-gray-500 before:border-r before:border-gray-300',
|
'flex items-center bg-accent-500 p-[6px] justify-center before:bg-white before:rounded-l-md before:text-gray-500 before:border-r before:border-gray-300 rounded-md transition-theme',
|
||||||
{
|
{
|
||||||
'before:opacity-0': !copied,
|
'before:opacity-0': !copied,
|
||||||
'before:opacity-100': copied,
|
'before:opacity-100': copied,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import ignore from 'ignore';
|
import ignore from 'ignore';
|
||||||
import { useGit } from '~/lib/hooks/useGit';
|
import { useGit } from '~/lib/hooks/useGit';
|
||||||
import type { Message } from 'ai';
|
import type { Message } from 'ai';
|
||||||
import WithTooltip from '~/components/ui/Tooltip';
|
|
||||||
import { detectProjectCommands, createCommandsMessage } from '~/utils/projectCommands';
|
import { detectProjectCommands, createCommandsMessage } from '~/utils/projectCommands';
|
||||||
import { generateId } from '~/utils/fileUtils';
|
import { generateId } from '~/utils/fileUtils';
|
||||||
|
|
||||||
@@ -99,17 +98,13 @@ ${file.content}
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithTooltip tooltip="Clone A Git Repo">
|
|
||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={onClick}
|
||||||
onClick(e);
|
title="Clone a Git Repo"
|
||||||
}}
|
|
||||||
title="Clone A Git Repo"
|
|
||||||
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"
|
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"
|
||||||
>
|
>
|
||||||
<span className="i-ph:git-branch" />
|
<span className="i-ph:git-branch" />
|
||||||
Clone A Git Repo
|
Clone a Git Repo
|
||||||
</button>
|
</button>
|
||||||
</WithTooltip>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { Message } from 'ai';
|
|||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { MAX_FILES, isBinaryFile, shouldIncludeFile } from '~/utils/fileUtils';
|
import { MAX_FILES, isBinaryFile, shouldIncludeFile } from '~/utils/fileUtils';
|
||||||
import { createChatFromFolder } from '~/utils/folderImport';
|
import { createChatFromFolder } from '~/utils/folderImport';
|
||||||
|
import { logStore } from '~/lib/stores/logs'; // Assuming logStore is imported from this location
|
||||||
|
|
||||||
interface ImportFolderButtonProps {
|
interface ImportFolderButtonProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
@@ -16,9 +17,15 @@ export const ImportFolderButton: React.FC<ImportFolderButtonProps> = ({ classNam
|
|||||||
const allFiles = Array.from(e.target.files || []);
|
const allFiles = Array.from(e.target.files || []);
|
||||||
|
|
||||||
if (allFiles.length > MAX_FILES) {
|
if (allFiles.length > MAX_FILES) {
|
||||||
|
const error = new Error(`Too many files: ${allFiles.length}`);
|
||||||
|
logStore.logError('File import failed - too many files', error, {
|
||||||
|
fileCount: allFiles.length,
|
||||||
|
maxFiles: MAX_FILES,
|
||||||
|
});
|
||||||
toast.error(
|
toast.error(
|
||||||
`This folder contains ${allFiles.length.toLocaleString()} files. This product is not yet optimized for very large projects. Please select a folder with fewer than ${MAX_FILES.toLocaleString()} files.`,
|
`This folder contains ${allFiles.length.toLocaleString()} files. This product is not yet optimized for very large projects. Please select a folder with fewer than ${MAX_FILES.toLocaleString()} files.`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +38,10 @@ export const ImportFolderButton: React.FC<ImportFolderButtonProps> = ({ classNam
|
|||||||
const filteredFiles = allFiles.filter((file) => shouldIncludeFile(file.webkitRelativePath));
|
const filteredFiles = allFiles.filter((file) => shouldIncludeFile(file.webkitRelativePath));
|
||||||
|
|
||||||
if (filteredFiles.length === 0) {
|
if (filteredFiles.length === 0) {
|
||||||
|
const error = new Error('No valid files found');
|
||||||
|
logStore.logError('File import failed - no valid files', error, { folderName });
|
||||||
toast.error('No files found in the selected folder');
|
toast.error('No files found in the selected folder');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,11 +58,18 @@ export const ImportFolderButton: React.FC<ImportFolderButtonProps> = ({ classNam
|
|||||||
.map((f) => f.file.webkitRelativePath.split('/').slice(1).join('/'));
|
.map((f) => f.file.webkitRelativePath.split('/').slice(1).join('/'));
|
||||||
|
|
||||||
if (textFiles.length === 0) {
|
if (textFiles.length === 0) {
|
||||||
|
const error = new Error('No text files found');
|
||||||
|
logStore.logError('File import failed - no text files', error, { folderName });
|
||||||
toast.error('No text files found in the selected folder');
|
toast.error('No text files found in the selected folder');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binaryFilePaths.length > 0) {
|
if (binaryFilePaths.length > 0) {
|
||||||
|
logStore.logWarning(`Skipping binary files during import`, {
|
||||||
|
folderName,
|
||||||
|
binaryCount: binaryFilePaths.length,
|
||||||
|
});
|
||||||
toast.info(`Skipping ${binaryFilePaths.length} binary files`);
|
toast.info(`Skipping ${binaryFilePaths.length} binary files`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +79,14 @@ export const ImportFolderButton: React.FC<ImportFolderButtonProps> = ({ classNam
|
|||||||
await importChat(folderName, [...messages]);
|
await importChat(folderName, [...messages]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logStore.logSystem('Folder imported successfully', {
|
||||||
|
folderName,
|
||||||
|
textFileCount: textFiles.length,
|
||||||
|
binaryFileCount: binaryFilePaths.length,
|
||||||
|
});
|
||||||
toast.success('Folder imported successfully');
|
toast.success('Folder imported successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logStore.logError('Failed to import folder', error, { folderName });
|
||||||
console.error('Failed to import folder:', error);
|
console.error('Failed to import folder:', error);
|
||||||
toast.error('Failed to import folder');
|
toast.error('Failed to import folder');
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -65,12 +65,16 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="grid grid-col-1 w-full">
|
<div className="grid grid-col-1 w-full">
|
||||||
{isUserMessage ? <UserMessage content={content} /> : <AssistantMessage content={content} />}
|
{isUserMessage ? (
|
||||||
|
<UserMessage content={content} />
|
||||||
|
) : (
|
||||||
|
<AssistantMessage content={content} annotations={message.annotations} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!isUserMessage && (
|
{!isUserMessage && (
|
||||||
<div className="flex gap-2 flex-col lg:flex-row">
|
<div className="flex gap-2 flex-col lg:flex-row">
|
||||||
<WithTooltip tooltip="Revert to this message">
|
|
||||||
{messageId && (
|
{messageId && (
|
||||||
|
<WithTooltip tooltip="Revert to this message">
|
||||||
<button
|
<button
|
||||||
onClick={() => handleRewind(messageId)}
|
onClick={() => handleRewind(messageId)}
|
||||||
key="i-ph:arrow-u-up-left"
|
key="i-ph:arrow-u-up-left"
|
||||||
@@ -79,8 +83,8 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
|
|||||||
'text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors',
|
'text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors',
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
|
)}
|
||||||
|
|
||||||
<WithTooltip tooltip="Fork chat from this message">
|
<WithTooltip tooltip="Fork chat from this message">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { ProviderInfo } from '~/types/model';
|
import type { ProviderInfo } from '~/types/model';
|
||||||
import type { ModelInfo } from '~/utils/types';
|
import type { ModelInfo } from '~/utils/types';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect } from 'react';
|
||||||
import Cookies from 'js-cookie';
|
|
||||||
|
|
||||||
interface ModelSelectorProps {
|
interface ModelSelectorProps {
|
||||||
model?: string;
|
model?: string;
|
||||||
@@ -22,37 +21,16 @@ export const ModelSelector = ({
|
|||||||
providerList,
|
providerList,
|
||||||
}: ModelSelectorProps) => {
|
}: ModelSelectorProps) => {
|
||||||
// Load enabled providers from cookies
|
// Load enabled providers from cookies
|
||||||
const [enabledProviders, setEnabledProviders] = useState(() => {
|
|
||||||
const savedProviders = Cookies.get('providers');
|
|
||||||
|
|
||||||
if (savedProviders) {
|
|
||||||
try {
|
|
||||||
const parsedProviders = JSON.parse(savedProviders);
|
|
||||||
return providerList.filter((p) => parsedProviders[p.name]);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to parse providers from cookies:', error);
|
|
||||||
return providerList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return providerList;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update enabled providers when cookies change
|
// Update enabled providers when cookies change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Function to update providers from cookies
|
|
||||||
const updateProvidersFromCookies = () => {
|
|
||||||
const savedProviders = Cookies.get('providers');
|
|
||||||
|
|
||||||
if (savedProviders) {
|
|
||||||
try {
|
|
||||||
const parsedProviders = JSON.parse(savedProviders);
|
|
||||||
const newEnabledProviders = providerList.filter((p) => parsedProviders[p.name]);
|
|
||||||
setEnabledProviders(newEnabledProviders);
|
|
||||||
|
|
||||||
// If current provider is disabled, switch to first enabled provider
|
// If current provider is disabled, switch to first enabled provider
|
||||||
if (provider && !parsedProviders[provider.name] && newEnabledProviders.length > 0) {
|
if (providerList.length == 0) {
|
||||||
const firstEnabledProvider = newEnabledProviders[0];
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (provider && !providerList.map((p) => p.name).includes(provider.name)) {
|
||||||
|
const firstEnabledProvider = providerList[0];
|
||||||
setProvider?.(firstEnabledProvider);
|
setProvider?.(firstEnabledProvider);
|
||||||
|
|
||||||
// Also update the model to the first available one for the new provider
|
// Also update the model to the first available one for the new provider
|
||||||
@@ -62,22 +40,9 @@ export const ModelSelector = ({
|
|||||||
setModel?.(firstModel.name);
|
setModel?.(firstModel.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to parse providers from cookies:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Initial update
|
|
||||||
updateProvidersFromCookies();
|
|
||||||
|
|
||||||
// Set up an interval to check for cookie changes
|
|
||||||
const interval = setInterval(updateProvidersFromCookies, 1000);
|
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
|
||||||
}, [providerList, provider, setProvider, modelList, setModel]);
|
}, [providerList, provider, setProvider, modelList, setModel]);
|
||||||
|
|
||||||
if (enabledProviders.length === 0) {
|
if (providerList.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="mb-2 p-4 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary">
|
<div className="mb-2 p-4 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary">
|
||||||
<p className="text-center">
|
<p className="text-center">
|
||||||
@@ -93,7 +58,7 @@ export const ModelSelector = ({
|
|||||||
<select
|
<select
|
||||||
value={provider?.name ?? ''}
|
value={provider?.name ?? ''}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newProvider = enabledProviders.find((p: ProviderInfo) => p.name === e.target.value);
|
const newProvider = providerList.find((p: ProviderInfo) => p.name === e.target.value);
|
||||||
|
|
||||||
if (newProvider && setProvider) {
|
if (newProvider && setProvider) {
|
||||||
setProvider(newProvider);
|
setProvider(newProvider);
|
||||||
@@ -107,7 +72,7 @@ export const ModelSelector = ({
|
|||||||
}}
|
}}
|
||||||
className="flex-1 p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all"
|
className="flex-1 p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all"
|
||||||
>
|
>
|
||||||
{enabledProviders.map((provider: ProviderInfo) => (
|
{providerList.map((provider: ProviderInfo) => (
|
||||||
<option key={provider.name} value={provider.name}>
|
<option key={provider.name} value={provider.name}>
|
||||||
{provider.name}
|
{provider.name}
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
33
app/components/chat/ScreenshotStateManager.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
interface ScreenshotStateManagerProps {
|
||||||
|
setUploadedFiles?: (files: File[]) => void;
|
||||||
|
setImageDataList?: (dataList: string[]) => void;
|
||||||
|
uploadedFiles: File[];
|
||||||
|
imageDataList: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ScreenshotStateManager = ({
|
||||||
|
setUploadedFiles,
|
||||||
|
setImageDataList,
|
||||||
|
uploadedFiles,
|
||||||
|
imageDataList,
|
||||||
|
}: ScreenshotStateManagerProps) => {
|
||||||
|
useEffect(() => {
|
||||||
|
if (setUploadedFiles && setImageDataList) {
|
||||||
|
(window as any).__BOLT_SET_UPLOADED_FILES__ = setUploadedFiles;
|
||||||
|
(window as any).__BOLT_SET_IMAGE_DATA_LIST__ = setImageDataList;
|
||||||
|
(window as any).__BOLT_UPLOADED_FILES__ = uploadedFiles;
|
||||||
|
(window as any).__BOLT_IMAGE_DATA_LIST__ = imageDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
delete (window as any).__BOLT_SET_UPLOADED_FILES__;
|
||||||
|
delete (window as any).__BOLT_SET_IMAGE_DATA_LIST__;
|
||||||
|
delete (window as any).__BOLT_UPLOADED_FILES__;
|
||||||
|
delete (window as any).__BOLT_IMAGE_DATA_LIST__;
|
||||||
|
};
|
||||||
|
}, [setUploadedFiles, setImageDataList, uploadedFiles, imageDataList]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
@@ -12,42 +12,36 @@ interface UserMessageProps {
|
|||||||
export function UserMessage({ content }: UserMessageProps) {
|
export function UserMessage({ content }: UserMessageProps) {
|
||||||
if (Array.isArray(content)) {
|
if (Array.isArray(content)) {
|
||||||
const textItem = content.find((item) => item.type === 'text');
|
const textItem = content.find((item) => item.type === 'text');
|
||||||
const textContent = sanitizeUserMessage(textItem?.text || '');
|
const textContent = stripMetadata(textItem?.text || '');
|
||||||
const images = content.filter((item) => item.type === 'image' && item.image);
|
const images = content.filter((item) => item.type === 'image' && item.image);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden pt-[4px]">
|
<div className="overflow-hidden pt-[4px]">
|
||||||
<div className="flex items-start gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<div className="flex-1">
|
{textContent && <Markdown html>{textContent}</Markdown>}
|
||||||
<Markdown limitedMarkdown>{textContent}</Markdown>
|
|
||||||
</div>
|
|
||||||
{images.length > 0 && (
|
|
||||||
<div className="flex-shrink-0 w-[160px]">
|
|
||||||
{images.map((item, index) => (
|
{images.map((item, index) => (
|
||||||
<div key={index} className="relative">
|
|
||||||
<img
|
<img
|
||||||
|
key={index}
|
||||||
src={item.image}
|
src={item.image}
|
||||||
alt={`Uploaded image ${index + 1}`}
|
alt={`Image ${index + 1}`}
|
||||||
className="w-full h-[160px] rounded-lg object-cover border border-bolt-elements-borderColor"
|
className="max-w-full h-auto rounded-lg"
|
||||||
|
style={{ maxHeight: '512px', objectFit: 'contain' }}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const textContent = sanitizeUserMessage(content);
|
const textContent = stripMetadata(content);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden pt-[4px]">
|
<div className="overflow-hidden pt-[4px]">
|
||||||
<Markdown limitedMarkdown>{textContent}</Markdown>
|
<Markdown html>{textContent}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeUserMessage(content: string) {
|
function stripMetadata(content: string) {
|
||||||
return content.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '');
|
return content.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { Message } from 'ai';
|
import type { Message } from 'ai';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import React from 'react';
|
|
||||||
import { ImportFolderButton } from '~/components/chat/ImportFolderButton';
|
import { ImportFolderButton } from '~/components/chat/ImportFolderButton';
|
||||||
|
|
||||||
export function ImportButtons(importChat: ((description: string, messages: Message[]) => Promise<void>) | undefined) {
|
export function ImportButtons(importChat: ((description: string, messages: Message[]) => Promise<void>) | undefined) {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { Chat } from '~/components/chat/Chat.client';
|
|||||||
import { useGit } from '~/lib/hooks/useGit';
|
import { useGit } from '~/lib/hooks/useGit';
|
||||||
import { useChatHistory } from '~/lib/persistence';
|
import { useChatHistory } from '~/lib/persistence';
|
||||||
import { createCommandsMessage, detectProjectCommands } from '~/utils/projectCommands';
|
import { createCommandsMessage, detectProjectCommands } from '~/utils/projectCommands';
|
||||||
|
import { LoadingOverlay } from '~/components/ui/LoadingOverlay';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
const IGNORE_PATTERNS = [
|
const IGNORE_PATTERNS = [
|
||||||
'node_modules/**',
|
'node_modules/**',
|
||||||
@@ -38,6 +40,7 @@ export function GitUrlImport() {
|
|||||||
const { ready: historyReady, importChat } = useChatHistory();
|
const { ready: historyReady, importChat } = useChatHistory();
|
||||||
const { ready: gitReady, gitClone } = useGit();
|
const { ready: gitReady, gitClone } = useGit();
|
||||||
const [imported, setImported] = useState(false);
|
const [imported, setImported] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
const importRepo = async (repoUrl?: string) => {
|
const importRepo = async (repoUrl?: string) => {
|
||||||
if (!gitReady && !historyReady) {
|
if (!gitReady && !historyReady) {
|
||||||
@@ -109,9 +112,23 @@ ${file.content}
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
importRepo(url);
|
importRepo(url).catch((error) => {
|
||||||
|
console.error('Error importing repo:', error);
|
||||||
|
toast.error('Failed to import repository');
|
||||||
|
setLoading(false);
|
||||||
|
window.location.href = '/';
|
||||||
|
});
|
||||||
setImported(true);
|
setImported(true);
|
||||||
}, [searchParams, historyReady, gitReady, imported]);
|
}, [searchParams, historyReady, gitReady, imported]);
|
||||||
|
|
||||||
return <ClientOnly fallback={<BaseChat />}>{() => <Chat />}</ClientOnly>;
|
return (
|
||||||
|
<ClientOnly fallback={<BaseChat />}>
|
||||||
|
{() => (
|
||||||
|
<>
|
||||||
|
<Chat />
|
||||||
|
{loading && <LoadingOverlay message="Please wait while we clone the repository..." />}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</ClientOnly>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import ProvidersTab from './providers/ProvidersTab';
|
|||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
import FeaturesTab from './features/FeaturesTab';
|
import FeaturesTab from './features/FeaturesTab';
|
||||||
import DebugTab from './debug/DebugTab';
|
import DebugTab from './debug/DebugTab';
|
||||||
|
import EventLogsTab from './event-logs/EventLogsTab';
|
||||||
import ConnectionsTab from './connections/ConnectionsTab';
|
import ConnectionsTab from './connections/ConnectionsTab';
|
||||||
|
|
||||||
interface SettingsProps {
|
interface SettingsProps {
|
||||||
@@ -17,18 +18,17 @@ interface SettingsProps {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type TabType = 'chat-history' | 'providers' | 'features' | 'debug' | 'connection';
|
type TabType = 'chat-history' | 'providers' | 'features' | 'debug' | 'event-logs' | 'connection';
|
||||||
|
|
||||||
// Providers that support base URL configuration
|
|
||||||
export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
|
export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
|
||||||
const { debug } = useSettings();
|
const { debug, eventLogs } = useSettings();
|
||||||
const [activeTab, setActiveTab] = useState<TabType>('chat-history');
|
const [activeTab, setActiveTab] = useState<TabType>('chat-history');
|
||||||
|
|
||||||
const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
|
const tabs: { id: TabType; label: string; icon: string; component?: ReactElement }[] = [
|
||||||
{ id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
|
{ id: 'chat-history', label: 'Chat History', icon: 'i-ph:book', component: <ChatHistoryTab /> },
|
||||||
{ id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
|
{ id: 'providers', label: 'Providers', icon: 'i-ph:key', component: <ProvidersTab /> },
|
||||||
{ id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
|
|
||||||
{ id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
|
{ id: 'connection', label: 'Connection', icon: 'i-ph:link', component: <ConnectionsTab /> },
|
||||||
|
{ id: 'features', label: 'Features', icon: 'i-ph:star', component: <FeaturesTab /> },
|
||||||
...(debug
|
...(debug
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
@@ -39,6 +39,16 @@ export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
...(eventLogs
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
id: 'event-logs' as TabType,
|
||||||
|
label: 'Event Logs',
|
||||||
|
icon: 'i-ph:list-bullets',
|
||||||
|
component: <EventLogsTab />,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { toast } from 'react-toastify';
|
|||||||
import { db, deleteById, getAll } from '~/lib/persistence';
|
import { db, deleteById, getAll } from '~/lib/persistence';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
import styles from '~/components/settings/Settings.module.scss';
|
import styles from '~/components/settings/Settings.module.scss';
|
||||||
|
import { logStore } from '~/lib/stores/logs'; // Import logStore for event logging
|
||||||
|
|
||||||
export default function ChatHistoryTab() {
|
export default function ChatHistoryTab() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -21,8 +22,17 @@ export default function ChatHistoryTab() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteAllChats = async () => {
|
const handleDeleteAllChats = async () => {
|
||||||
|
const confirmDelete = window.confirm('Are you sure you want to delete all chats? This action cannot be undone.');
|
||||||
|
|
||||||
|
if (!confirmDelete) {
|
||||||
|
return; // Exit if the user cancels
|
||||||
|
}
|
||||||
|
|
||||||
if (!db) {
|
if (!db) {
|
||||||
|
const error = new Error('Database is not available');
|
||||||
|
logStore.logError('Failed to delete chats - DB unavailable', error);
|
||||||
toast.error('Database is not available');
|
toast.error('Database is not available');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,13 +40,12 @@ export default function ChatHistoryTab() {
|
|||||||
setIsDeleting(true);
|
setIsDeleting(true);
|
||||||
|
|
||||||
const allChats = await getAll(db);
|
const allChats = await getAll(db);
|
||||||
|
|
||||||
// Delete all chats one by one
|
|
||||||
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
||||||
|
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
||||||
toast.success('All chats deleted successfully');
|
toast.success('All chats deleted successfully');
|
||||||
navigate('/', { replace: true });
|
navigate('/', { replace: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logStore.logError('Failed to delete chats', error);
|
||||||
toast.error('Failed to delete chats');
|
toast.error('Failed to delete chats');
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -46,7 +55,10 @@ export default function ChatHistoryTab() {
|
|||||||
|
|
||||||
const handleExportAllChats = async () => {
|
const handleExportAllChats = async () => {
|
||||||
if (!db) {
|
if (!db) {
|
||||||
|
const error = new Error('Database is not available');
|
||||||
|
logStore.logError('Failed to export chats - DB unavailable', error);
|
||||||
toast.error('Database is not available');
|
toast.error('Database is not available');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +70,10 @@ export default function ChatHistoryTab() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
downloadAsJson(exportData, `all-chats-${new Date().toISOString()}.json`);
|
downloadAsJson(exportData, `all-chats-${new Date().toISOString()}.json`);
|
||||||
|
logStore.logSystem('Chats exported successfully', { count: allChats.length });
|
||||||
toast.success('Chats exported successfully');
|
toast.success('Chats exported successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logStore.logError('Failed to export chats', error);
|
||||||
toast.error('Failed to export chats');
|
toast.error('Failed to export chats');
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,93 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
import { logStore } from '~/lib/stores/logs';
|
||||||
|
|
||||||
|
interface GitHubUserResponse {
|
||||||
|
login: string;
|
||||||
|
id: number;
|
||||||
|
[key: string]: any; // for other properties we don't explicitly need
|
||||||
|
}
|
||||||
|
|
||||||
export default function ConnectionsTab() {
|
export default function ConnectionsTab() {
|
||||||
const [githubUsername, setGithubUsername] = useState(Cookies.get('githubUsername') || '');
|
const [githubUsername, setGithubUsername] = useState(Cookies.get('githubUsername') || '');
|
||||||
const [githubToken, setGithubToken] = useState(Cookies.get('githubToken') || '');
|
const [githubToken, setGithubToken] = useState(Cookies.get('githubToken') || '');
|
||||||
|
const [isConnected, setIsConnected] = useState(false);
|
||||||
|
const [isVerifying, setIsVerifying] = useState(false);
|
||||||
|
|
||||||
const handleSaveConnection = () => {
|
useEffect(() => {
|
||||||
|
// Check if credentials exist and verify them
|
||||||
|
if (githubUsername && githubToken) {
|
||||||
|
verifyGitHubCredentials();
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const verifyGitHubCredentials = async () => {
|
||||||
|
setIsVerifying(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('https://api.github.com/user', {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${githubToken}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const data = (await response.json()) as GitHubUserResponse;
|
||||||
|
|
||||||
|
if (data.login === githubUsername) {
|
||||||
|
setIsConnected(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsConnected(false);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error verifying GitHub credentials:', error);
|
||||||
|
setIsConnected(false);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
setIsVerifying(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSaveConnection = async () => {
|
||||||
|
if (!githubUsername || !githubToken) {
|
||||||
|
toast.error('Please provide both GitHub username and token');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsVerifying(true);
|
||||||
|
|
||||||
|
const isValid = await verifyGitHubCredentials();
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
Cookies.set('githubUsername', githubUsername);
|
Cookies.set('githubUsername', githubUsername);
|
||||||
Cookies.set('githubToken', githubToken);
|
Cookies.set('githubToken', githubToken);
|
||||||
toast.success('GitHub credentials saved successfully!');
|
logStore.logSystem('GitHub connection settings updated', {
|
||||||
|
username: githubUsername,
|
||||||
|
hasToken: !!githubToken,
|
||||||
|
});
|
||||||
|
toast.success('GitHub credentials verified and saved successfully!');
|
||||||
|
Cookies.set('git:github.com', JSON.stringify({ username: githubToken, password: 'x-oauth-basic' }));
|
||||||
|
setIsConnected(true);
|
||||||
|
} else {
|
||||||
|
toast.error('Invalid GitHub credentials. Please check your username and token.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDisconnect = () => {
|
||||||
|
Cookies.remove('githubUsername');
|
||||||
|
Cookies.remove('githubToken');
|
||||||
|
Cookies.remove('git:github.com');
|
||||||
|
setGithubUsername('');
|
||||||
|
setGithubToken('');
|
||||||
|
setIsConnected(false);
|
||||||
|
logStore.logSystem('GitHub connection removed');
|
||||||
|
toast.success('GitHub connection removed successfully!');
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -22,7 +100,8 @@ export default function ConnectionsTab() {
|
|||||||
type="text"
|
type="text"
|
||||||
value={githubUsername}
|
value={githubUsername}
|
||||||
onChange={(e) => setGithubUsername(e.target.value)}
|
onChange={(e) => setGithubUsername(e.target.value)}
|
||||||
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
disabled={isVerifying}
|
||||||
|
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
@@ -31,17 +110,41 @@ export default function ConnectionsTab() {
|
|||||||
type="password"
|
type="password"
|
||||||
value={githubToken}
|
value={githubToken}
|
||||||
onChange={(e) => setGithubToken(e.target.value)}
|
onChange={(e) => setGithubToken(e.target.value)}
|
||||||
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
disabled={isVerifying}
|
||||||
|
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex mb-4">
|
<div className="flex mb-4 items-center">
|
||||||
|
{!isConnected ? (
|
||||||
<button
|
<button
|
||||||
onClick={handleSaveConnection}
|
onClick={handleSaveConnection}
|
||||||
className="bg-bolt-elements-button-primary-background rounded-lg px-4 py-2 mr-2 transition-colors duration-200 hover:bg-bolt-elements-button-primary-backgroundHover text-bolt-elements-button-primary-text"
|
disabled={isVerifying || !githubUsername || !githubToken}
|
||||||
|
className="bg-bolt-elements-button-primary-background rounded-lg px-4 py-2 mr-2 transition-colors duration-200 hover:bg-bolt-elements-button-primary-backgroundHover text-bolt-elements-button-primary-text disabled:opacity-50 disabled:cursor-not-allowed flex items-center"
|
||||||
>
|
>
|
||||||
Save Connection
|
{isVerifying ? (
|
||||||
|
<>
|
||||||
|
<div className="i-ph:spinner animate-spin mr-2" />
|
||||||
|
Verifying...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
'Connect'
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
onClick={handleDisconnect}
|
||||||
|
className="bg-bolt-elements-button-danger-background rounded-lg px-4 py-2 mr-2 transition-colors duration-200 hover:bg-bolt-elements-button-danger-backgroundHover text-bolt-elements-button-danger-text"
|
||||||
|
>
|
||||||
|
Disconnect
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{isConnected && (
|
||||||
|
<span className="text-sm text-green-600 flex items-center">
|
||||||
|
<div className="i-ph:check-circle mr-1" />
|
||||||
|
Connected to GitHub
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,69 +1,620 @@
|
|||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
import commit from '~/commit.json';
|
import commit from '~/commit.json';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
const versionHash = commit.commit; // Get the version hash from commit.json
|
interface ProviderStatus {
|
||||||
|
name: string;
|
||||||
|
enabled: boolean;
|
||||||
|
isLocal: boolean;
|
||||||
|
isRunning: boolean | null;
|
||||||
|
error?: string;
|
||||||
|
lastChecked: Date;
|
||||||
|
responseTime?: number;
|
||||||
|
url: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SystemInfo {
|
||||||
|
os: string;
|
||||||
|
browser: string;
|
||||||
|
screen: string;
|
||||||
|
language: string;
|
||||||
|
timezone: string;
|
||||||
|
memory: string;
|
||||||
|
cores: number;
|
||||||
|
deviceType: string;
|
||||||
|
colorDepth: string;
|
||||||
|
pixelRatio: number;
|
||||||
|
online: boolean;
|
||||||
|
cookiesEnabled: boolean;
|
||||||
|
doNotTrack: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IProviderConfig {
|
||||||
|
name: string;
|
||||||
|
settings: {
|
||||||
|
enabled: boolean;
|
||||||
|
baseUrl?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommitData {
|
||||||
|
commit: string;
|
||||||
|
version?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const connitJson: CommitData = commit;
|
||||||
|
|
||||||
|
const LOCAL_PROVIDERS = ['Ollama', 'LMStudio', 'OpenAILike'];
|
||||||
|
const versionHash = connitJson.commit;
|
||||||
|
const versionTag = connitJson.version;
|
||||||
|
const GITHUB_URLS = {
|
||||||
|
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
||||||
|
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
||||||
|
commitJson: (branch: string) =>
|
||||||
|
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
|
||||||
|
};
|
||||||
|
|
||||||
|
function getSystemInfo(): SystemInfo {
|
||||||
|
const formatBytes = (bytes: number): string => {
|
||||||
|
if (bytes === 0) {
|
||||||
|
return '0 Bytes';
|
||||||
|
}
|
||||||
|
|
||||||
|
const k = 1024;
|
||||||
|
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
||||||
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
|
|
||||||
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||||
|
};
|
||||||
|
|
||||||
|
const getBrowserInfo = (): string => {
|
||||||
|
const ua = navigator.userAgent;
|
||||||
|
let browser = 'Unknown';
|
||||||
|
|
||||||
|
if (ua.includes('Firefox/')) {
|
||||||
|
browser = 'Firefox';
|
||||||
|
} else if (ua.includes('Chrome/')) {
|
||||||
|
if (ua.includes('Edg/')) {
|
||||||
|
browser = 'Edge';
|
||||||
|
} else if (ua.includes('OPR/')) {
|
||||||
|
browser = 'Opera';
|
||||||
|
} else {
|
||||||
|
browser = 'Chrome';
|
||||||
|
}
|
||||||
|
} else if (ua.includes('Safari/')) {
|
||||||
|
if (!ua.includes('Chrome')) {
|
||||||
|
browser = 'Safari';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract version number
|
||||||
|
const match = ua.match(new RegExp(`${browser}\\/([\\d.]+)`));
|
||||||
|
const version = match ? ` ${match[1]}` : '';
|
||||||
|
|
||||||
|
return `${browser}${version}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getOperatingSystem = (): string => {
|
||||||
|
const ua = navigator.userAgent;
|
||||||
|
const platform = navigator.platform;
|
||||||
|
|
||||||
|
if (ua.includes('Win')) {
|
||||||
|
return 'Windows';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ua.includes('Mac')) {
|
||||||
|
if (ua.includes('iPhone') || ua.includes('iPad')) {
|
||||||
|
return 'iOS';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'macOS';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ua.includes('Linux')) {
|
||||||
|
return 'Linux';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ua.includes('Android')) {
|
||||||
|
return 'Android';
|
||||||
|
}
|
||||||
|
|
||||||
|
return platform || 'Unknown';
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDeviceType = (): string => {
|
||||||
|
const ua = navigator.userAgent;
|
||||||
|
|
||||||
|
if (ua.includes('Mobile')) {
|
||||||
|
return 'Mobile';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ua.includes('Tablet')) {
|
||||||
|
return 'Tablet';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Desktop';
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get more detailed memory info if available
|
||||||
|
const getMemoryInfo = (): string => {
|
||||||
|
if ('memory' in performance) {
|
||||||
|
const memory = (performance as any).memory;
|
||||||
|
return `${formatBytes(memory.jsHeapSizeLimit)} (Used: ${formatBytes(memory.usedJSHeapSize)})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Not available';
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
os: getOperatingSystem(),
|
||||||
|
browser: getBrowserInfo(),
|
||||||
|
screen: `${window.screen.width}x${window.screen.height}`,
|
||||||
|
language: navigator.language,
|
||||||
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||||
|
memory: getMemoryInfo(),
|
||||||
|
cores: navigator.hardwareConcurrency || 0,
|
||||||
|
deviceType: getDeviceType(),
|
||||||
|
|
||||||
|
// Add new fields
|
||||||
|
colorDepth: `${window.screen.colorDepth}-bit`,
|
||||||
|
pixelRatio: window.devicePixelRatio,
|
||||||
|
online: navigator.onLine,
|
||||||
|
cookiesEnabled: navigator.cookieEnabled,
|
||||||
|
doNotTrack: navigator.doNotTrack === '1',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkProviderStatus = async (url: string | null, providerName: string): Promise<ProviderStatus> => {
|
||||||
|
if (!url) {
|
||||||
|
console.log(`[Debug] No URL provided for ${providerName}`);
|
||||||
|
return {
|
||||||
|
name: providerName,
|
||||||
|
enabled: false,
|
||||||
|
isLocal: true,
|
||||||
|
isRunning: false,
|
||||||
|
error: 'No URL configured',
|
||||||
|
lastChecked: new Date(),
|
||||||
|
url: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`[Debug] Checking status for ${providerName} at ${url}`);
|
||||||
|
|
||||||
|
const startTime = performance.now();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (providerName.toLowerCase() === 'ollama') {
|
||||||
|
// Special check for Ollama root endpoint
|
||||||
|
try {
|
||||||
|
console.log(`[Debug] Checking Ollama root endpoint: ${url}`);
|
||||||
|
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timeoutId = setTimeout(() => controller.abort(), 5000); // 5 second timeout
|
||||||
|
|
||||||
|
const response = await fetch(url, {
|
||||||
|
signal: controller.signal,
|
||||||
|
headers: {
|
||||||
|
Accept: 'text/plain,application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
|
||||||
|
const text = await response.text();
|
||||||
|
console.log(`[Debug] Ollama root response:`, text);
|
||||||
|
|
||||||
|
if (text.includes('Ollama is running')) {
|
||||||
|
console.log(`[Debug] Ollama running confirmed via root endpoint`);
|
||||||
|
return {
|
||||||
|
name: providerName,
|
||||||
|
enabled: false,
|
||||||
|
isLocal: true,
|
||||||
|
isRunning: true,
|
||||||
|
lastChecked: new Date(),
|
||||||
|
responseTime: performance.now() - startTime,
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`[Debug] Ollama root check failed:`, error);
|
||||||
|
|
||||||
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
||||||
|
|
||||||
|
if (errorMessage.includes('aborted')) {
|
||||||
|
return {
|
||||||
|
name: providerName,
|
||||||
|
enabled: false,
|
||||||
|
isLocal: true,
|
||||||
|
isRunning: false,
|
||||||
|
error: 'Connection timeout',
|
||||||
|
lastChecked: new Date(),
|
||||||
|
responseTime: performance.now() - startTime,
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try different endpoints based on provider
|
||||||
|
const checkUrls = [`${url}/api/health`, `${url}/v1/models`];
|
||||||
|
console.log(`[Debug] Checking additional endpoints:`, checkUrls);
|
||||||
|
|
||||||
|
const results = await Promise.all(
|
||||||
|
checkUrls.map(async (checkUrl) => {
|
||||||
|
try {
|
||||||
|
console.log(`[Debug] Trying endpoint: ${checkUrl}`);
|
||||||
|
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timeoutId = setTimeout(() => controller.abort(), 5000);
|
||||||
|
|
||||||
|
const response = await fetch(checkUrl, {
|
||||||
|
signal: controller.signal,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
|
||||||
|
const ok = response.ok;
|
||||||
|
console.log(`[Debug] Endpoint ${checkUrl} response:`, ok);
|
||||||
|
|
||||||
|
if (ok) {
|
||||||
|
try {
|
||||||
|
const data = await response.json();
|
||||||
|
console.log(`[Debug] Endpoint ${checkUrl} data:`, data);
|
||||||
|
} catch {
|
||||||
|
console.log(`[Debug] Could not parse JSON from ${checkUrl}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`[Debug] Endpoint ${checkUrl} failed:`, error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const isRunning = results.some((result) => result);
|
||||||
|
console.log(`[Debug] Final status for ${providerName}:`, isRunning);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: providerName,
|
||||||
|
enabled: false,
|
||||||
|
isLocal: true,
|
||||||
|
isRunning,
|
||||||
|
lastChecked: new Date(),
|
||||||
|
responseTime: performance.now() - startTime,
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`[Debug] Provider check failed for ${providerName}:`, error);
|
||||||
|
return {
|
||||||
|
name: providerName,
|
||||||
|
enabled: false,
|
||||||
|
isLocal: true,
|
||||||
|
isRunning: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
lastChecked: new Date(),
|
||||||
|
responseTime: performance.now() - startTime,
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default function DebugTab() {
|
export default function DebugTab() {
|
||||||
const { providers } = useSettings();
|
const { providers, isLatestBranch } = useSettings();
|
||||||
const [activeProviders, setActiveProviders] = useState<string[]>([]);
|
const [activeProviders, setActiveProviders] = useState<ProviderStatus[]>([]);
|
||||||
useEffect(() => {
|
const [updateMessage, setUpdateMessage] = useState<string>('');
|
||||||
setActiveProviders(
|
const [systemInfo] = useState<SystemInfo>(getSystemInfo());
|
||||||
Object.entries(providers)
|
const [isCheckingUpdate, setIsCheckingUpdate] = useState(false);
|
||||||
.filter(([_key, provider]) => provider.settings.enabled)
|
|
||||||
.map(([_key, provider]) => provider.name),
|
const updateProviderStatuses = async () => {
|
||||||
|
if (!providers) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const entries = Object.entries(providers) as [string, IProviderConfig][];
|
||||||
|
const statuses = await Promise.all(
|
||||||
|
entries
|
||||||
|
.filter(([, provider]) => LOCAL_PROVIDERS.includes(provider.name))
|
||||||
|
.map(async ([, provider]) => {
|
||||||
|
const envVarName =
|
||||||
|
provider.name.toLowerCase() === 'ollama'
|
||||||
|
? 'OLLAMA_API_BASE_URL'
|
||||||
|
: provider.name.toLowerCase() === 'lmstudio'
|
||||||
|
? 'LMSTUDIO_API_BASE_URL'
|
||||||
|
: `REACT_APP_${provider.name.toUpperCase()}_URL`;
|
||||||
|
|
||||||
|
// Access environment variables through import.meta.env
|
||||||
|
const url = import.meta.env[envVarName] || provider.settings.baseUrl || null; // Ensure baseUrl is used
|
||||||
|
console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
|
||||||
|
|
||||||
|
const status = await checkProviderStatus(url, provider.name);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...status,
|
||||||
|
enabled: provider.settings.enabled ?? false,
|
||||||
|
};
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setActiveProviders(statuses);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[Debug] Failed to update provider statuses:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateProviderStatuses();
|
||||||
|
|
||||||
|
const interval = setInterval(updateProviderStatuses, 30000);
|
||||||
|
|
||||||
|
return () => clearInterval(interval);
|
||||||
}, [providers]);
|
}, [providers]);
|
||||||
|
|
||||||
|
const handleCheckForUpdate = useCallback(async () => {
|
||||||
|
if (isCheckingUpdate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setIsCheckingUpdate(true);
|
||||||
|
setUpdateMessage('Checking for updates...');
|
||||||
|
|
||||||
|
const branchToCheck = isLatestBranch ? 'main' : 'stable';
|
||||||
|
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
||||||
|
|
||||||
|
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
||||||
|
|
||||||
|
if (!localCommitResponse.ok) {
|
||||||
|
throw new Error('Failed to fetch local commit info');
|
||||||
|
}
|
||||||
|
|
||||||
|
const localCommitData = (await localCommitResponse.json()) as CommitData;
|
||||||
|
const remoteCommitHash = localCommitData.commit;
|
||||||
|
const currentCommitHash = versionHash;
|
||||||
|
|
||||||
|
if (remoteCommitHash !== currentCommitHash) {
|
||||||
|
setUpdateMessage(
|
||||||
|
`Update available from ${branchToCheck} branch!\n` +
|
||||||
|
`Current: ${currentCommitHash.slice(0, 7)}\n` +
|
||||||
|
`Latest: ${remoteCommitHash.slice(0, 7)}`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setUpdateMessage('Failed to check for updates');
|
||||||
|
console.error('[Debug] Failed to check for updates:', error);
|
||||||
|
} finally {
|
||||||
|
setIsCheckingUpdate(false);
|
||||||
|
}
|
||||||
|
}, [isCheckingUpdate, isLatestBranch]);
|
||||||
|
|
||||||
const handleCopyToClipboard = useCallback(() => {
|
const handleCopyToClipboard = useCallback(() => {
|
||||||
const debugInfo = {
|
const debugInfo = {
|
||||||
OS: navigator.platform,
|
System: systemInfo,
|
||||||
Browser: navigator.userAgent,
|
Providers: activeProviders.map((provider) => ({
|
||||||
ActiveFeatures: activeProviders,
|
name: provider.name,
|
||||||
BaseURLs: {
|
enabled: provider.enabled,
|
||||||
Ollama: process.env.REACT_APP_OLLAMA_URL,
|
isLocal: provider.isLocal,
|
||||||
OpenAI: process.env.REACT_APP_OPENAI_URL,
|
running: provider.isRunning,
|
||||||
LMStudio: process.env.REACT_APP_LM_STUDIO_URL,
|
error: provider.error,
|
||||||
|
lastChecked: provider.lastChecked,
|
||||||
|
responseTime: provider.responseTime,
|
||||||
|
url: provider.url,
|
||||||
|
})),
|
||||||
|
Version: {
|
||||||
|
hash: versionHash.slice(0, 7),
|
||||||
|
branch: isLatestBranch ? 'main' : 'stable',
|
||||||
},
|
},
|
||||||
Version: versionHash,
|
Timestamp: new Date().toISOString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
|
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
|
||||||
alert('Debug information copied to clipboard!');
|
toast.success('Debug information copied to clipboard!');
|
||||||
});
|
});
|
||||||
}, [providers]);
|
}, [activeProviders, systemInfo, isLatestBranch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4 space-y-6">
|
||||||
<h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Debug Tab</h3>
|
<div className="flex items-center justify-between">
|
||||||
|
<h3 className="text-lg font-medium text-bolt-elements-textPrimary">Debug Information</h3>
|
||||||
|
<div className="flex gap-2">
|
||||||
<button
|
<button
|
||||||
onClick={handleCopyToClipboard}
|
onClick={handleCopyToClipboard}
|
||||||
className="bg-blue-500 text-white rounded-lg px-4 py-2 hover:bg-blue-600 mb-4 transition-colors duration-200"
|
className="bg-bolt-elements-button-primary-background rounded-lg px-4 py-2 transition-colors duration-200 hover:bg-bolt-elements-button-primary-backgroundHover text-bolt-elements-button-primary-text"
|
||||||
>
|
>
|
||||||
Copy to Clipboard
|
Copy Debug Info
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleCheckForUpdate}
|
||||||
|
disabled={isCheckingUpdate}
|
||||||
|
className={`bg-bolt-elements-button-primary-background rounded-lg px-4 py-2 transition-colors duration-200
|
||||||
|
${!isCheckingUpdate ? 'hover:bg-bolt-elements-button-primary-backgroundHover' : 'opacity-75 cursor-not-allowed'}
|
||||||
|
text-bolt-elements-button-primary-text`}
|
||||||
|
>
|
||||||
|
{isCheckingUpdate ? 'Checking...' : 'Check for Updates'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h4 className="text-md font-medium text-bolt-elements-textPrimary">System Information</h4>
|
{updateMessage && (
|
||||||
<p className="text-bolt-elements-textSecondary">OS: {navigator.platform}</p>
|
<div
|
||||||
<p className="text-bolt-elements-textSecondary">Browser: {navigator.userAgent}</p>
|
className={`bg-bolt-elements-surface rounded-lg p-3 ${
|
||||||
|
updateMessage.includes('Update available') ? 'border-l-4 border-yellow-400' : ''
|
||||||
<h4 className="text-md font-medium text-bolt-elements-textPrimary mt-4">Active Features</h4>
|
}`}
|
||||||
<ul>
|
>
|
||||||
{activeProviders.map((name) => (
|
<p className="text-bolt-elements-textSecondary whitespace-pre-line">{updateMessage}</p>
|
||||||
<li key={name} className="text-bolt-elements-textSecondary">
|
{updateMessage.includes('Update available') && (
|
||||||
{name}
|
<div className="mt-3 text-sm">
|
||||||
|
<p className="font-medium text-bolt-elements-textPrimary">To update:</p>
|
||||||
|
<ol className="list-decimal ml-4 mt-1 text-bolt-elements-textSecondary">
|
||||||
|
<li>
|
||||||
|
Pull the latest changes:{' '}
|
||||||
|
<code className="bg-bolt-elements-surface-hover px-1 rounded">git pull upstream main</code>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
Install any new dependencies:{' '}
|
||||||
|
<code className="bg-bolt-elements-surface-hover px-1 rounded">pnpm install</code>
|
||||||
|
</li>
|
||||||
|
<li>Restart the application</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<section className="space-y-4">
|
||||||
|
<div>
|
||||||
|
<h4 className="text-md font-medium text-bolt-elements-textPrimary mb-2">System Information</h4>
|
||||||
|
<div className="bg-bolt-elements-surface rounded-lg p-4">
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Operating System</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.os}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Device Type</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.deviceType}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Browser</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.browser}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Display</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">
|
||||||
|
{systemInfo.screen} ({systemInfo.colorDepth}) @{systemInfo.pixelRatio}x
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Connection</p>
|
||||||
|
<p className="text-sm font-medium flex items-center gap-2">
|
||||||
|
<span
|
||||||
|
className={`inline-block w-2 h-2 rounded-full ${systemInfo.online ? 'bg-green-500' : 'bg-red-500'}`}
|
||||||
|
/>
|
||||||
|
<span className={`${systemInfo.online ? 'text-green-600' : 'text-red-600'}`}>
|
||||||
|
{systemInfo.online ? 'Online' : 'Offline'}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Screen Resolution</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.screen}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Language</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.language}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Timezone</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.timezone}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">CPU Cores</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.cores}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="mt-3 pt-3 border-t border-bolt-elements-surface-hover">
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary">Version</p>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary font-mono">
|
||||||
|
{versionHash.slice(0, 7)}
|
||||||
|
<span className="ml-2 text-xs text-bolt-elements-textSecondary">
|
||||||
|
(v{versionTag || '0.0.1'}) - {isLatestBranch ? 'nightly' : 'stable'}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4 className="text-md font-medium text-bolt-elements-textPrimary mb-2">Local LLM Status</h4>
|
||||||
|
<div className="bg-bolt-elements-surface rounded-lg">
|
||||||
|
<div className="grid grid-cols-1 divide-y">
|
||||||
|
{activeProviders.map((provider) => (
|
||||||
|
<div key={provider.name} className="p-3 flex flex-col space-y-2">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="flex-shrink-0">
|
||||||
|
<div
|
||||||
|
className={`w-2 h-2 rounded-full ${
|
||||||
|
!provider.enabled ? 'bg-gray-300' : provider.isRunning ? 'bg-green-400' : 'bg-red-400'
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary">{provider.name}</p>
|
||||||
|
{provider.url && (
|
||||||
|
<p className="text-xs text-bolt-elements-textSecondary truncate max-w-[300px]">
|
||||||
|
{provider.url}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span
|
||||||
|
className={`px-2 py-0.5 text-xs rounded-full ${
|
||||||
|
provider.enabled ? 'bg-green-100 text-green-800' : 'bg-gray-100 text-gray-800'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{provider.enabled ? 'Enabled' : 'Disabled'}
|
||||||
|
</span>
|
||||||
|
{provider.enabled && (
|
||||||
|
<span
|
||||||
|
className={`px-2 py-0.5 text-xs rounded-full ${
|
||||||
|
provider.isRunning ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{provider.isRunning ? 'Running' : 'Not Running'}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="pl-5 flex flex-col space-y-1 text-xs">
|
||||||
|
{/* Status Details */}
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
<span className="text-bolt-elements-textSecondary">
|
||||||
|
Last checked: {new Date(provider.lastChecked).toLocaleTimeString()}
|
||||||
|
</span>
|
||||||
|
{provider.responseTime && (
|
||||||
|
<span className="text-bolt-elements-textSecondary">
|
||||||
|
Response time: {Math.round(provider.responseTime)}ms
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Error Message */}
|
||||||
|
{provider.error && (
|
||||||
|
<div className="mt-1 text-red-600 bg-red-50 rounded-md p-2">
|
||||||
|
<span className="font-medium">Error:</span> {provider.error}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Connection Info */}
|
||||||
|
{provider.url && (
|
||||||
|
<div className="text-bolt-elements-textSecondary">
|
||||||
|
<span className="font-medium">Endpoints checked:</span>
|
||||||
|
<ul className="list-disc list-inside pl-2 mt-1">
|
||||||
|
<li>{provider.url} (root)</li>
|
||||||
|
<li>{provider.url}/api/health</li>
|
||||||
|
<li>{provider.url}/v1/models</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</ul>
|
{activeProviders.length === 0 && (
|
||||||
|
<div className="p-4 text-center text-bolt-elements-textSecondary">No local LLMs configured</div>
|
||||||
<h4 className="text-md font-medium text-bolt-elements-textPrimary mt-4">Base URLs</h4>
|
)}
|
||||||
<ul>
|
</div>
|
||||||
<li className="text-bolt-elements-textSecondary">Ollama: {process.env.REACT_APP_OLLAMA_URL}</li>
|
</div>
|
||||||
<li className="text-bolt-elements-textSecondary">OpenAI: {process.env.REACT_APP_OPENAI_URL}</li>
|
</div>
|
||||||
<li className="text-bolt-elements-textSecondary">LM Studio: {process.env.REACT_APP_LM_STUDIO_URL}</li>
|
</section>
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4 className="text-md font-medium text-bolt-elements-textPrimary mt-4">Version Information</h4>
|
|
||||||
<p className="text-bolt-elements-textSecondary">Version Hash: {versionHash}</p>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
219
app/components/settings/event-logs/EventLogsTab.tsx
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||||
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
import { Switch } from '~/components/ui/Switch';
|
||||||
|
import { logStore, type LogEntry } from '~/lib/stores/logs';
|
||||||
|
import { useStore } from '@nanostores/react';
|
||||||
|
import { classNames } from '~/utils/classNames';
|
||||||
|
|
||||||
|
export default function EventLogsTab() {
|
||||||
|
const {} = useSettings();
|
||||||
|
const showLogs = useStore(logStore.showLogs);
|
||||||
|
const [logLevel, setLogLevel] = useState<LogEntry['level'] | 'all'>('info');
|
||||||
|
const [autoScroll, setAutoScroll] = useState(true);
|
||||||
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
|
const [, forceUpdate] = useState({});
|
||||||
|
|
||||||
|
const filteredLogs = useMemo(() => {
|
||||||
|
const logs = logStore.getLogs();
|
||||||
|
return logs.filter((log) => {
|
||||||
|
const matchesLevel = !logLevel || log.level === logLevel || logLevel === 'all';
|
||||||
|
const matchesSearch =
|
||||||
|
!searchQuery ||
|
||||||
|
log.message?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
JSON.stringify(log.details)?.toLowerCase()?.includes(searchQuery?.toLowerCase());
|
||||||
|
|
||||||
|
return matchesLevel && matchesSearch;
|
||||||
|
});
|
||||||
|
}, [logLevel, searchQuery]);
|
||||||
|
|
||||||
|
// Effect to initialize showLogs
|
||||||
|
useEffect(() => {
|
||||||
|
logStore.showLogs.set(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// System info logs
|
||||||
|
logStore.logSystem('Application initialized', {
|
||||||
|
version: process.env.NEXT_PUBLIC_APP_VERSION,
|
||||||
|
environment: process.env.NODE_ENV,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Debug logs for system state
|
||||||
|
logStore.logDebug('System configuration loaded', {
|
||||||
|
runtime: 'Next.js',
|
||||||
|
features: ['AI Chat', 'Event Logging'],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Warning logs for potential issues
|
||||||
|
logStore.logWarning('Resource usage threshold approaching', {
|
||||||
|
memoryUsage: '75%',
|
||||||
|
cpuLoad: '60%',
|
||||||
|
});
|
||||||
|
|
||||||
|
// Error logs with detailed context
|
||||||
|
logStore.logError('API connection failed', new Error('Connection timeout'), {
|
||||||
|
endpoint: '/api/chat',
|
||||||
|
retryCount: 3,
|
||||||
|
lastAttempt: new Date().toISOString(),
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const container = document.querySelector('.logs-container');
|
||||||
|
|
||||||
|
if (container && autoScroll) {
|
||||||
|
container.scrollTop = container.scrollHeight;
|
||||||
|
}
|
||||||
|
}, [filteredLogs, autoScroll]);
|
||||||
|
|
||||||
|
const handleClearLogs = useCallback(() => {
|
||||||
|
if (confirm('Are you sure you want to clear all logs?')) {
|
||||||
|
logStore.clearLogs();
|
||||||
|
toast.success('Logs cleared successfully');
|
||||||
|
forceUpdate({}); // Force a re-render after clearing logs
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleExportLogs = useCallback(() => {
|
||||||
|
try {
|
||||||
|
const logText = logStore
|
||||||
|
.getLogs()
|
||||||
|
.map(
|
||||||
|
(log) =>
|
||||||
|
`[${log.level.toUpperCase()}] ${log.timestamp} - ${log.message}${
|
||||||
|
log.details ? '\nDetails: ' + JSON.stringify(log.details, null, 2) : ''
|
||||||
|
}`,
|
||||||
|
)
|
||||||
|
.join('\n\n');
|
||||||
|
|
||||||
|
const blob = new Blob([logText], { type: 'text/plain' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `event-logs-${new Date().toISOString()}.txt`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
toast.success('Logs exported successfully');
|
||||||
|
} catch (error) {
|
||||||
|
toast.error('Failed to export logs');
|
||||||
|
console.error('Export error:', error);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getLevelColor = (level: LogEntry['level']) => {
|
||||||
|
switch (level) {
|
||||||
|
case 'info':
|
||||||
|
return 'text-blue-500';
|
||||||
|
case 'warning':
|
||||||
|
return 'text-yellow-500';
|
||||||
|
case 'error':
|
||||||
|
return 'text-red-500';
|
||||||
|
case 'debug':
|
||||||
|
return 'text-gray-500';
|
||||||
|
default:
|
||||||
|
return 'text-bolt-elements-textPrimary';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p-4 h-full flex flex-col">
|
||||||
|
<div className="flex flex-col space-y-4 mb-4">
|
||||||
|
{/* Title and Toggles Row */}
|
||||||
|
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
|
||||||
|
<h3 className="text-lg font-medium text-bolt-elements-textPrimary">Event Logs</h3>
|
||||||
|
<div className="flex flex-wrap items-center gap-4">
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<span className="text-sm text-bolt-elements-textSecondary whitespace-nowrap">Show Actions</span>
|
||||||
|
<Switch checked={showLogs} onCheckedChange={(checked) => logStore.showLogs.set(checked)} />
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<span className="text-sm text-bolt-elements-textSecondary whitespace-nowrap">Auto-scroll</span>
|
||||||
|
<Switch checked={autoScroll} onCheckedChange={setAutoScroll} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Controls Row */}
|
||||||
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
|
<select
|
||||||
|
value={logLevel}
|
||||||
|
onChange={(e) => setLogLevel(e.target.value as LogEntry['level'])}
|
||||||
|
className="flex-1 p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all lg:max-w-[20%] text-sm min-w-[100px]"
|
||||||
|
>
|
||||||
|
<option value="all">All</option>
|
||||||
|
<option value="info">Info</option>
|
||||||
|
<option value="warning">Warning</option>
|
||||||
|
<option value="error">Error</option>
|
||||||
|
<option value="debug">Debug</option>
|
||||||
|
</select>
|
||||||
|
<div className="flex-1 min-w-[200px]">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Search logs..."
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{showLogs && (
|
||||||
|
<div className="flex items-center gap-2 flex-nowrap">
|
||||||
|
<button
|
||||||
|
onClick={handleExportLogs}
|
||||||
|
className={classNames(
|
||||||
|
'bg-bolt-elements-button-primary-background',
|
||||||
|
'rounded-lg px-4 py-2 transition-colors duration-200',
|
||||||
|
'hover:bg-bolt-elements-button-primary-backgroundHover',
|
||||||
|
'text-bolt-elements-button-primary-text',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
Export Logs
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleClearLogs}
|
||||||
|
className={classNames(
|
||||||
|
'bg-bolt-elements-button-danger-background',
|
||||||
|
'rounded-lg px-4 py-2 transition-colors duration-200',
|
||||||
|
'hover:bg-bolt-elements-button-danger-backgroundHover',
|
||||||
|
'text-bolt-elements-button-danger-text',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
Clear Logs
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-bolt-elements-bg-depth-1 rounded-lg p-4 h-[calc(100vh - 250px)] min-h-[400px] overflow-y-auto logs-container overflow-y-auto">
|
||||||
|
{filteredLogs.length === 0 ? (
|
||||||
|
<div className="text-center text-bolt-elements-textSecondary py-8">No logs found</div>
|
||||||
|
) : (
|
||||||
|
filteredLogs.map((log, index) => (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
className="text-sm mb-3 font-mono border-b border-bolt-elements-borderColor pb-2 last:border-0"
|
||||||
|
>
|
||||||
|
<div className="flex items-start space-x-2 flex-wrap">
|
||||||
|
<span className={`font-bold ${getLevelColor(log.level)} whitespace-nowrap`}>
|
||||||
|
[{log.level.toUpperCase()}]
|
||||||
|
</span>
|
||||||
|
<span className="text-bolt-elements-textSecondary whitespace-nowrap">
|
||||||
|
{new Date(log.timestamp).toLocaleString()}
|
||||||
|
</span>
|
||||||
|
<span className="text-bolt-elements-textPrimary break-all">{log.message}</span>
|
||||||
|
</div>
|
||||||
|
{log.details && (
|
||||||
|
<pre className="mt-2 text-xs text-bolt-elements-textSecondary overflow-x-auto whitespace-pre-wrap break-all">
|
||||||
|
{JSON.stringify(log.details, null, 2)}
|
||||||
|
</pre>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,16 +1,44 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Switch } from '~/components/ui/Switch';
|
import { Switch } from '~/components/ui/Switch';
|
||||||
|
import { PromptLibrary } from '~/lib/common/prompt-library';
|
||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
|
|
||||||
export default function FeaturesTab() {
|
export default function FeaturesTab() {
|
||||||
const { debug, enableDebugMode, isLocalModel, enableLocalModels } = useSettings();
|
const {
|
||||||
|
debug,
|
||||||
|
enableDebugMode,
|
||||||
|
isLocalModel,
|
||||||
|
enableLocalModels,
|
||||||
|
enableEventLogs,
|
||||||
|
isLatestBranch,
|
||||||
|
enableLatestBranch,
|
||||||
|
promptId,
|
||||||
|
setPromptId,
|
||||||
|
} = useSettings();
|
||||||
|
|
||||||
|
const handleToggle = (enabled: boolean) => {
|
||||||
|
enableDebugMode(enabled);
|
||||||
|
enableEventLogs(enabled);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 bg-bolt-elements-bg-depth-2 border border-bolt-elements-borderColor rounded-lg mb-4">
|
<div className="p-4 bg-bolt-elements-bg-depth-2 border border-bolt-elements-borderColor rounded-lg mb-4">
|
||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
<h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Optional Features</h3>
|
<h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Optional Features</h3>
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="space-y-4">
|
||||||
<span className="text-bolt-elements-textPrimary">Debug Info</span>
|
<div className="flex items-center justify-between">
|
||||||
<Switch className="ml-auto" checked={debug} onCheckedChange={enableDebugMode} />
|
<span className="text-bolt-elements-textPrimary">Debug Features</span>
|
||||||
|
<Switch className="ml-auto" checked={debug} onCheckedChange={handleToggle} />
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<span className="text-bolt-elements-textPrimary">Use Main Branch</span>
|
||||||
|
<p className="text-sm text-bolt-elements-textSecondary">
|
||||||
|
Check for updates against the main branch instead of stable
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Switch className="ml-auto" checked={isLatestBranch} onCheckedChange={enableLatestBranch} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -19,10 +47,30 @@ export default function FeaturesTab() {
|
|||||||
<p className="text-sm text-bolt-elements-textSecondary mb-4">
|
<p className="text-sm text-bolt-elements-textSecondary mb-4">
|
||||||
Disclaimer: Experimental features may be unstable and are subject to change.
|
Disclaimer: Experimental features may be unstable and are subject to change.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
<span className="text-bolt-elements-textPrimary">Enable Local Models</span>
|
<span className="text-bolt-elements-textPrimary">Experimental Providers</span>
|
||||||
<Switch className="ml-auto" checked={isLocalModel} onCheckedChange={enableLocalModels} />
|
<Switch className="ml-auto" checked={isLocalModel} onCheckedChange={enableLocalModels} />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-start justify-between pt-4 mb-2 gap-2">
|
||||||
|
<div className="flex-1 max-w-[200px]">
|
||||||
|
<span className="text-bolt-elements-textPrimary">Prompt Library</span>
|
||||||
|
<p className="text-sm text-bolt-elements-textSecondary mb-4">
|
||||||
|
Choose a prompt from the library to use as the system prompt.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<select
|
||||||
|
value={promptId}
|
||||||
|
onChange={(e) => setPromptId(e.target.value)}
|
||||||
|
className="flex-1 p-2 ml-auto rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all text-sm min-w-[100px]"
|
||||||
|
>
|
||||||
|
{PromptLibrary.getList().map((x) => (
|
||||||
|
<option key={x.id} value={x.id}>
|
||||||
|
{x.label}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ import { Switch } from '~/components/ui/Switch';
|
|||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
import { LOCAL_PROVIDERS, URL_CONFIGURABLE_PROVIDERS } from '~/lib/stores/settings';
|
import { LOCAL_PROVIDERS, URL_CONFIGURABLE_PROVIDERS } from '~/lib/stores/settings';
|
||||||
import type { IProviderConfig } from '~/types/model';
|
import type { IProviderConfig } from '~/types/model';
|
||||||
|
import { logStore } from '~/lib/stores/logs';
|
||||||
|
|
||||||
|
// Import a default fallback icon
|
||||||
|
import DefaultIcon from '/icons/Default.svg'; // Adjust the path as necessary
|
||||||
|
|
||||||
export default function ProvidersTab() {
|
export default function ProvidersTab() {
|
||||||
const { providers, updateProviderSettings, isLocalModel } = useSettings();
|
const { providers, updateProviderSettings, isLocalModel } = useSettings();
|
||||||
@@ -49,11 +53,30 @@ export default function ProvidersTab() {
|
|||||||
className="flex flex-col mb-2 provider-item hover:bg-bolt-elements-bg-depth-3 p-4 rounded-lg border border-bolt-elements-borderColor "
|
className="flex flex-col mb-2 provider-item hover:bg-bolt-elements-bg-depth-3 p-4 rounded-lg border border-bolt-elements-borderColor "
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<img
|
||||||
|
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
|
||||||
|
onError={(e) => {
|
||||||
|
// Fallback to default icon on error
|
||||||
|
e.currentTarget.src = DefaultIcon;
|
||||||
|
}}
|
||||||
|
alt={`${provider.name} icon`}
|
||||||
|
className="w-6 h-6 dark:invert"
|
||||||
|
/>
|
||||||
<span className="text-bolt-elements-textPrimary">{provider.name}</span>
|
<span className="text-bolt-elements-textPrimary">{provider.name}</span>
|
||||||
|
</div>
|
||||||
<Switch
|
<Switch
|
||||||
className="ml-auto"
|
className="ml-auto"
|
||||||
checked={provider.settings.enabled}
|
checked={provider.settings.enabled}
|
||||||
onCheckedChange={(enabled) => updateProviderSettings(provider.name, { ...provider.settings, enabled })}
|
onCheckedChange={(enabled) => {
|
||||||
|
updateProviderSettings(provider.name, { ...provider.settings, enabled });
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
logStore.logProvider(`Provider ${provider.name} enabled`, { provider: provider.name });
|
||||||
|
} else {
|
||||||
|
logStore.logProvider(`Provider ${provider.name} disabled`, { provider: provider.name });
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/* Base URL input for configurable providers */}
|
{/* Base URL input for configurable providers */}
|
||||||
@@ -63,9 +86,14 @@ export default function ProvidersTab() {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={provider.settings.baseUrl || ''}
|
value={provider.settings.baseUrl || ''}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
updateProviderSettings(provider.name, { ...provider.settings, baseUrl: e.target.value })
|
const newBaseUrl = e.target.value;
|
||||||
}
|
updateProviderSettings(provider.name, { ...provider.settings, baseUrl: newBaseUrl });
|
||||||
|
logStore.logProvider(`Base URL updated for ${provider.name}`, {
|
||||||
|
provider: provider.name,
|
||||||
|
baseUrl: newBaseUrl,
|
||||||
|
});
|
||||||
|
}}
|
||||||
placeholder={`Enter ${provider.name} base URL`}
|
placeholder={`Enter ${provider.name} base URL`}
|
||||||
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import * as Dialog from '@radix-ui/react-dialog';
|
|||||||
import { type ChatHistoryItem } from '~/lib/persistence';
|
import { type ChatHistoryItem } from '~/lib/persistence';
|
||||||
import WithTooltip from '~/components/ui/Tooltip';
|
import WithTooltip from '~/components/ui/Tooltip';
|
||||||
import { useEditChatDescription } from '~/lib/hooks';
|
import { useEditChatDescription } from '~/lib/hooks';
|
||||||
|
import { forwardRef, type ForwardedRef } from 'react';
|
||||||
|
|
||||||
interface HistoryItemProps {
|
interface HistoryItemProps {
|
||||||
item: ChatHistoryItem;
|
item: ChatHistoryItem;
|
||||||
@@ -103,7 +104,9 @@ export function HistoryItem({ item, onDelete, onDuplicate, exportChat }: History
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChatActionButton = ({
|
const ChatActionButton = forwardRef(
|
||||||
|
(
|
||||||
|
{
|
||||||
toolTipContent,
|
toolTipContent,
|
||||||
icon,
|
icon,
|
||||||
className,
|
className,
|
||||||
@@ -114,14 +117,18 @@ const ChatActionButton = ({
|
|||||||
className?: string;
|
className?: string;
|
||||||
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
||||||
btnTitle?: string;
|
btnTitle?: string;
|
||||||
}) => {
|
},
|
||||||
|
ref: ForwardedRef<HTMLButtonElement>,
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<WithTooltip tooltip={toolTipContent}>
|
<WithTooltip tooltip={toolTipContent}>
|
||||||
<button
|
<button
|
||||||
|
ref={ref}
|
||||||
type="button"
|
type="button"
|
||||||
className={`scale-110 mr-2 hover:text-bolt-elements-item-contentAccent ${icon} ${className ? className : ''}`}
|
className={`scale-110 mr-2 hover:text-bolt-elements-item-contentAccent ${icon} ${className ? className : ''}`}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
/>
|
/>
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
);
|
);
|
||||||
};
|
},
|
||||||
|
);
|
||||||
|
|||||||
@@ -35,6 +35,25 @@ const menuVariants = {
|
|||||||
|
|
||||||
type DialogContent = { type: 'delete'; item: ChatHistoryItem } | null;
|
type DialogContent = { type: 'delete'; item: ChatHistoryItem } | null;
|
||||||
|
|
||||||
|
function CurrentDateTime() {
|
||||||
|
const [dateTime, setDateTime] = useState(new Date());
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
setDateTime(new Date());
|
||||||
|
}, 60000); // Update every minute
|
||||||
|
|
||||||
|
return () => clearInterval(timer);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-2 px-4 py-3 font-bold text-gray-700 dark:text-gray-300 border-b border-bolt-elements-borderColor">
|
||||||
|
<div className="h-4 w-4 i-ph:clock-thin" />
|
||||||
|
{dateTime.toLocaleDateString()} {dateTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export const Menu = () => {
|
export const Menu = () => {
|
||||||
const { duplicateCurrentChat, exportChat } = useChatHistory();
|
const { duplicateCurrentChat, exportChat } = useChatHistory();
|
||||||
const menuRef = useRef<HTMLDivElement>(null);
|
const menuRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -126,18 +145,17 @@ export const Menu = () => {
|
|||||||
variants={menuVariants}
|
variants={menuVariants}
|
||||||
className="flex selection-accent flex-col side-menu fixed top-0 w-[350px] h-full bg-bolt-elements-background-depth-2 border-r rounded-r-3xl border-bolt-elements-borderColor z-sidebar shadow-xl shadow-bolt-elements-sidebar-dropdownShadow text-sm"
|
className="flex selection-accent flex-col side-menu fixed top-0 w-[350px] h-full bg-bolt-elements-background-depth-2 border-r rounded-r-3xl border-bolt-elements-borderColor z-sidebar shadow-xl shadow-bolt-elements-sidebar-dropdownShadow text-sm"
|
||||||
>
|
>
|
||||||
<div className="flex items-center h-[var(--header-height)]">{/* Placeholder */}</div>
|
<div className="h-[60px]" /> {/* Spacer for top margin */}
|
||||||
|
<CurrentDateTime />
|
||||||
<div className="flex-1 flex flex-col h-full w-full overflow-hidden">
|
<div className="flex-1 flex flex-col h-full w-full overflow-hidden">
|
||||||
<div className="p-4 select-none">
|
<div className="p-4 select-none">
|
||||||
<a
|
<a
|
||||||
href="/"
|
href="/"
|
||||||
className="flex gap-2 items-center bg-bolt-elements-sidebar-buttonBackgroundDefault text-bolt-elements-sidebar-buttonText hover:bg-bolt-elements-sidebar-buttonBackgroundHover rounded-md p-2 transition-theme"
|
className="flex gap-2 items-center bg-bolt-elements-sidebar-buttonBackgroundDefault text-bolt-elements-sidebar-buttonText hover:bg-bolt-elements-sidebar-buttonBackgroundHover rounded-md p-2 transition-theme mb-4"
|
||||||
>
|
>
|
||||||
<span className="inline-block i-bolt:chat scale-110" />
|
<span className="inline-block i-bolt:chat scale-110" />
|
||||||
Start new chat
|
Start new chat
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
<div className="pl-4 pr-4 my-2">
|
|
||||||
<div className="relative w-full">
|
<div className="relative w-full">
|
||||||
<input
|
<input
|
||||||
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { memo } from 'react';
|
import { memo, forwardRef, type ForwardedRef } from 'react';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
|
|
||||||
type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||||
@@ -25,8 +25,11 @@ type IconButtonWithChildrenProps = {
|
|||||||
|
|
||||||
type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps;
|
type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps;
|
||||||
|
|
||||||
|
// Componente IconButton com suporte a refs
|
||||||
export const IconButton = memo(
|
export const IconButton = memo(
|
||||||
({
|
forwardRef(
|
||||||
|
(
|
||||||
|
{
|
||||||
icon,
|
icon,
|
||||||
size = 'xl',
|
size = 'xl',
|
||||||
className,
|
className,
|
||||||
@@ -36,9 +39,12 @@ export const IconButton = memo(
|
|||||||
title,
|
title,
|
||||||
onClick,
|
onClick,
|
||||||
children,
|
children,
|
||||||
}: IconButtonProps) => {
|
}: IconButtonProps,
|
||||||
|
ref: ForwardedRef<HTMLButtonElement>,
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
ref={ref}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed',
|
'flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed',
|
||||||
{
|
{
|
||||||
@@ -60,6 +66,7 @@ export const IconButton = memo(
|
|||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
function getIconSize(size: IconSize) {
|
function getIconSize(size: IconSize) {
|
||||||
|
|||||||
14
app/components/ui/LoadingOverlay.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
export const LoadingOverlay = ({ message = 'Loading...' }) => {
|
||||||
|
return (
|
||||||
|
<div className="fixed inset-0 flex items-center justify-center bg-black/80 z-50 backdrop-blur-sm">
|
||||||
|
{/* Loading content */}
|
||||||
|
<div className="relative flex flex-col items-center gap-4 p-8 rounded-lg bg-bolt-elements-background-depth-2 shadow-lg">
|
||||||
|
<div
|
||||||
|
className={'i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress'}
|
||||||
|
style={{ fontSize: '2rem' }}
|
||||||
|
></div>
|
||||||
|
<p className="text-lg text-bolt-elements-textTertiary">{message}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||||
|
import { forwardRef, type ForwardedRef, type ReactElement } from 'react';
|
||||||
|
|
||||||
interface TooltipProps {
|
interface TooltipProps {
|
||||||
tooltip: React.ReactNode;
|
tooltip: React.ReactNode;
|
||||||
children: React.ReactNode;
|
children: ReactElement;
|
||||||
sideOffset?: number;
|
sideOffset?: number;
|
||||||
className?: string;
|
className?: string;
|
||||||
arrowClassName?: string;
|
arrowClassName?: string;
|
||||||
@@ -12,7 +13,9 @@ interface TooltipProps {
|
|||||||
delay?: number;
|
delay?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WithTooltip = ({
|
const WithTooltip = forwardRef(
|
||||||
|
(
|
||||||
|
{
|
||||||
tooltip,
|
tooltip,
|
||||||
children,
|
children,
|
||||||
sideOffset = 5,
|
sideOffset = 5,
|
||||||
@@ -22,7 +25,9 @@ const WithTooltip = ({
|
|||||||
position = 'top',
|
position = 'top',
|
||||||
maxWidth = 250,
|
maxWidth = 250,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
}: TooltipProps) => {
|
}: TooltipProps,
|
||||||
|
_ref: ForwardedRef<HTMLElement>,
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip.Root delayDuration={delay}>
|
<Tooltip.Root delayDuration={delay}>
|
||||||
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
||||||
@@ -68,6 +73,7 @@ const WithTooltip = ({
|
|||||||
</Tooltip.Portal>
|
</Tooltip.Portal>
|
||||||
</Tooltip.Root>
|
</Tooltip.Root>
|
||||||
);
|
);
|
||||||
};
|
},
|
||||||
|
);
|
||||||
|
|
||||||
export default WithTooltip;
|
export default WithTooltip;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { memo, useEffect, useMemo, useState, type ReactNode } from 'react';
|
|||||||
import type { FileMap } from '~/lib/stores/files';
|
import type { FileMap } from '~/lib/stores/files';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
import { createScopedLogger, renderLogger } from '~/utils/logger';
|
import { createScopedLogger, renderLogger } from '~/utils/logger';
|
||||||
|
import * as ContextMenu from '@radix-ui/react-context-menu';
|
||||||
|
|
||||||
const logger = createScopedLogger('FileTree');
|
const logger = createScopedLogger('FileTree');
|
||||||
|
|
||||||
@@ -110,6 +111,22 @@ export const FileTree = memo(
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onCopyPath = (fileOrFolder: FileNode | FolderNode) => {
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(fileOrFolder.fullPath);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onCopyRelativePath = (fileOrFolder: FileNode | FolderNode) => {
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(fileOrFolder.fullPath.substring((rootFolder || '').length));
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames('text-sm', className, 'overflow-y-auto')}>
|
<div className={classNames('text-sm', className, 'overflow-y-auto')}>
|
||||||
{filteredFileList.map((fileOrFolder) => {
|
{filteredFileList.map((fileOrFolder) => {
|
||||||
@@ -121,6 +138,12 @@ export const FileTree = memo(
|
|||||||
selected={selectedFile === fileOrFolder.fullPath}
|
selected={selectedFile === fileOrFolder.fullPath}
|
||||||
file={fileOrFolder}
|
file={fileOrFolder}
|
||||||
unsavedChanges={unsavedFiles?.has(fileOrFolder.fullPath)}
|
unsavedChanges={unsavedFiles?.has(fileOrFolder.fullPath)}
|
||||||
|
onCopyPath={() => {
|
||||||
|
onCopyPath(fileOrFolder);
|
||||||
|
}}
|
||||||
|
onCopyRelativePath={() => {
|
||||||
|
onCopyRelativePath(fileOrFolder);
|
||||||
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onFileSelect?.(fileOrFolder.fullPath);
|
onFileSelect?.(fileOrFolder.fullPath);
|
||||||
}}
|
}}
|
||||||
@@ -134,6 +157,12 @@ export const FileTree = memo(
|
|||||||
folder={fileOrFolder}
|
folder={fileOrFolder}
|
||||||
selected={allowFolderSelection && selectedFile === fileOrFolder.fullPath}
|
selected={allowFolderSelection && selectedFile === fileOrFolder.fullPath}
|
||||||
collapsed={collapsedFolders.has(fileOrFolder.fullPath)}
|
collapsed={collapsedFolders.has(fileOrFolder.fullPath)}
|
||||||
|
onCopyPath={() => {
|
||||||
|
onCopyPath(fileOrFolder);
|
||||||
|
}}
|
||||||
|
onCopyRelativePath={() => {
|
||||||
|
onCopyRelativePath(fileOrFolder);
|
||||||
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
toggleCollapseState(fileOrFolder.fullPath);
|
toggleCollapseState(fileOrFolder.fullPath);
|
||||||
}}
|
}}
|
||||||
@@ -156,26 +185,67 @@ interface FolderProps {
|
|||||||
folder: FolderNode;
|
folder: FolderNode;
|
||||||
collapsed: boolean;
|
collapsed: boolean;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
|
onCopyPath: () => void;
|
||||||
|
onCopyRelativePath: () => void;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Folder({ folder: { depth, name }, collapsed, selected = false, onClick }: FolderProps) {
|
interface FolderContextMenuProps {
|
||||||
|
onCopyPath?: () => void;
|
||||||
|
onCopyRelativePath?: () => void;
|
||||||
|
children: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ContextMenuItem({ onSelect, children }: { onSelect?: () => void; children: ReactNode }) {
|
||||||
return (
|
return (
|
||||||
|
<ContextMenu.Item
|
||||||
|
onSelect={onSelect}
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
<span className="size-4 shrink-0"></span>
|
||||||
|
<span>{children}</span>
|
||||||
|
</ContextMenu.Item>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function FileContextMenu({ onCopyPath, onCopyRelativePath, children }: FolderContextMenuProps) {
|
||||||
|
return (
|
||||||
|
<ContextMenu.Root>
|
||||||
|
<ContextMenu.Trigger>{children}</ContextMenu.Trigger>
|
||||||
|
<ContextMenu.Portal>
|
||||||
|
<ContextMenu.Content
|
||||||
|
style={{ zIndex: 998 }}
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
<ContextMenu.Group className="p-1 border-b-px border-solid border-bolt-elements-borderColor">
|
||||||
|
<ContextMenuItem onSelect={onCopyPath}>Copy path</ContextMenuItem>
|
||||||
|
<ContextMenuItem onSelect={onCopyRelativePath}>Copy relative path</ContextMenuItem>
|
||||||
|
</ContextMenu.Group>
|
||||||
|
</ContextMenu.Content>
|
||||||
|
</ContextMenu.Portal>
|
||||||
|
</ContextMenu.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Folder({ folder, collapsed, selected = false, onCopyPath, onCopyRelativePath, onClick }: FolderProps) {
|
||||||
|
return (
|
||||||
|
<FileContextMenu onCopyPath={onCopyPath} onCopyRelativePath={onCopyRelativePath}>
|
||||||
<NodeButton
|
<NodeButton
|
||||||
className={classNames('group', {
|
className={classNames('group', {
|
||||||
'bg-transparent text-bolt-elements-item-contentDefault hover:text-bolt-elements-item-contentActive hover:bg-bolt-elements-item-backgroundActive':
|
'bg-transparent text-bolt-elements-item-contentDefault hover:text-bolt-elements-item-contentActive hover:bg-bolt-elements-item-backgroundActive':
|
||||||
!selected,
|
!selected,
|
||||||
'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
|
'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
|
||||||
})}
|
})}
|
||||||
depth={depth}
|
depth={folder.depth}
|
||||||
iconClasses={classNames({
|
iconClasses={classNames({
|
||||||
'i-ph:caret-right scale-98': collapsed,
|
'i-ph:caret-right scale-98': collapsed,
|
||||||
'i-ph:caret-down scale-98': !collapsed,
|
'i-ph:caret-down scale-98': !collapsed,
|
||||||
})}
|
})}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{name}
|
{folder.name}
|
||||||
</NodeButton>
|
</NodeButton>
|
||||||
|
</FileContextMenu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,14 +253,25 @@ interface FileProps {
|
|||||||
file: FileNode;
|
file: FileNode;
|
||||||
selected: boolean;
|
selected: boolean;
|
||||||
unsavedChanges?: boolean;
|
unsavedChanges?: boolean;
|
||||||
|
onCopyPath: () => void;
|
||||||
|
onCopyRelativePath: () => void;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function File({ file: { depth, name }, onClick, selected, unsavedChanges = false }: FileProps) {
|
function File({
|
||||||
|
file: { depth, name },
|
||||||
|
onClick,
|
||||||
|
onCopyPath,
|
||||||
|
onCopyRelativePath,
|
||||||
|
selected,
|
||||||
|
unsavedChanges = false,
|
||||||
|
}: FileProps) {
|
||||||
return (
|
return (
|
||||||
|
<FileContextMenu onCopyPath={onCopyPath} onCopyRelativePath={onCopyRelativePath}>
|
||||||
<NodeButton
|
<NodeButton
|
||||||
className={classNames('group', {
|
className={classNames('group', {
|
||||||
'bg-transparent hover:bg-bolt-elements-item-backgroundActive text-bolt-elements-item-contentDefault': !selected,
|
'bg-transparent hover:bg-bolt-elements-item-backgroundActive text-bolt-elements-item-contentDefault':
|
||||||
|
!selected,
|
||||||
'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
|
'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent': selected,
|
||||||
})}
|
})}
|
||||||
depth={depth}
|
depth={depth}
|
||||||
@@ -208,6 +289,7 @@ function File({ file: { depth, name }, onClick, selected, unsavedChanges = false
|
|||||||
{unsavedChanges && <span className="i-ph:circle-fill scale-68 shrink-0 text-orange-500" />}
|
{unsavedChanges && <span className="i-ph:circle-fill scale-68 shrink-0 text-orange-500" />}
|
||||||
</div>
|
</div>
|
||||||
</NodeButton>
|
</NodeButton>
|
||||||
|
</FileContextMenu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import { IconButton } from '~/components/ui/IconButton';
|
import { IconButton } from '~/components/ui/IconButton';
|
||||||
import { workbenchStore } from '~/lib/stores/workbench';
|
import { workbenchStore } from '~/lib/stores/workbench';
|
||||||
import { PortDropdown } from './PortDropdown';
|
import { PortDropdown } from './PortDropdown';
|
||||||
|
import { ScreenshotSelector } from './ScreenshotSelector';
|
||||||
|
|
||||||
type ResizeSide = 'left' | 'right' | null;
|
type ResizeSide = 'left' | 'right' | null;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ export const Preview = memo(() => {
|
|||||||
|
|
||||||
const [url, setUrl] = useState('');
|
const [url, setUrl] = useState('');
|
||||||
const [iframeUrl, setIframeUrl] = useState<string | undefined>();
|
const [iframeUrl, setIframeUrl] = useState<string | undefined>();
|
||||||
|
const [isSelectionMode, setIsSelectionMode] = useState(false);
|
||||||
|
|
||||||
// Toggle between responsive mode and device mode
|
// Toggle between responsive mode and device mode
|
||||||
const [isDeviceModeOn, setIsDeviceModeOn] = useState(false);
|
const [isDeviceModeOn, setIsDeviceModeOn] = useState(false);
|
||||||
@@ -218,12 +220,17 @@ export const Preview = memo(() => {
|
|||||||
)}
|
)}
|
||||||
<div className="bg-bolt-elements-background-depth-2 p-2 flex items-center gap-1.5">
|
<div className="bg-bolt-elements-background-depth-2 p-2 flex items-center gap-1.5">
|
||||||
<IconButton icon="i-ph:arrow-clockwise" onClick={reloadPreview} />
|
<IconButton icon="i-ph:arrow-clockwise" onClick={reloadPreview} />
|
||||||
|
<IconButton
|
||||||
|
icon="i-ph:selection"
|
||||||
|
onClick={() => setIsSelectionMode(!isSelectionMode)}
|
||||||
|
className={isSelectionMode ? 'bg-bolt-elements-background-depth-3' : ''}
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
className="flex items-center gap-1 flex-grow bg-bolt-elements-preview-addressBar-background border border-bolt-elements-borderColor text-bolt-elements-preview-addressBar-text rounded-full px-3 py-1 text-sm hover:bg-bolt-elements-preview-addressBar-backgroundHover hover:focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within:bg-bolt-elements-preview-addressBar-backgroundActive
|
className="flex items-center gap-1 flex-grow bg-bolt-elements-preview-addressBar-background border border-bolt-elements-borderColor text-bolt-elements-preview-addressBar-text rounded-full px-3 py-1 text-sm hover:bg-bolt-elements-preview-addressBar-backgroundHover hover:focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within:bg-bolt-elements-preview-addressBar-backgroundActive
|
||||||
focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive"
|
focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
title="URL"
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
className="w-full bg-transparent outline-none"
|
className="w-full bg-transparent outline-none"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -281,7 +288,20 @@ export const Preview = memo(() => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{activePreview ? (
|
{activePreview ? (
|
||||||
<iframe ref={iframeRef} className="border-none w-full h-full bg-white" src={iframeUrl} allowFullScreen />
|
<>
|
||||||
|
<iframe
|
||||||
|
ref={iframeRef}
|
||||||
|
title="preview"
|
||||||
|
className="border-none w-full h-full bg-white"
|
||||||
|
src={iframeUrl}
|
||||||
|
allowFullScreen
|
||||||
|
/>
|
||||||
|
<ScreenshotSelector
|
||||||
|
isSelectionMode={isSelectionMode}
|
||||||
|
setIsSelectionMode={setIsSelectionMode}
|
||||||
|
containerRef={iframeRef}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex w-full h-full justify-center items-center bg-white">No preview available</div>
|
<div className="flex w-full h-full justify-center items-center bg-white">No preview available</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
293
app/components/workbench/ScreenshotSelector.tsx
Normal file
@@ -0,0 +1,293 @@
|
|||||||
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
|
interface ScreenshotSelectorProps {
|
||||||
|
isSelectionMode: boolean;
|
||||||
|
setIsSelectionMode: (mode: boolean) => void;
|
||||||
|
containerRef: React.RefObject<HTMLElement>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ScreenshotSelector = memo(
|
||||||
|
({ isSelectionMode, setIsSelectionMode, containerRef }: ScreenshotSelectorProps) => {
|
||||||
|
const [isCapturing, setIsCapturing] = useState(false);
|
||||||
|
const [selectionStart, setSelectionStart] = useState<{ x: number; y: number } | null>(null);
|
||||||
|
const [selectionEnd, setSelectionEnd] = useState<{ x: number; y: number } | null>(null);
|
||||||
|
const mediaStreamRef = useRef<MediaStream | null>(null);
|
||||||
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Cleanup function to stop all tracks when component unmounts
|
||||||
|
return () => {
|
||||||
|
if (videoRef.current) {
|
||||||
|
videoRef.current.pause();
|
||||||
|
videoRef.current.srcObject = null;
|
||||||
|
videoRef.current.remove();
|
||||||
|
videoRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mediaStreamRef.current) {
|
||||||
|
mediaStreamRef.current.getTracks().forEach((track) => track.stop());
|
||||||
|
mediaStreamRef.current = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const initializeStream = async () => {
|
||||||
|
if (!mediaStreamRef.current) {
|
||||||
|
try {
|
||||||
|
const stream = await navigator.mediaDevices.getDisplayMedia({
|
||||||
|
audio: false,
|
||||||
|
video: {
|
||||||
|
displaySurface: 'window',
|
||||||
|
preferCurrentTab: true,
|
||||||
|
surfaceSwitching: 'include',
|
||||||
|
systemAudio: 'exclude',
|
||||||
|
},
|
||||||
|
} as MediaStreamConstraints);
|
||||||
|
|
||||||
|
// Add handler for when sharing stops
|
||||||
|
stream.addEventListener('inactive', () => {
|
||||||
|
if (videoRef.current) {
|
||||||
|
videoRef.current.pause();
|
||||||
|
videoRef.current.srcObject = null;
|
||||||
|
videoRef.current.remove();
|
||||||
|
videoRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mediaStreamRef.current) {
|
||||||
|
mediaStreamRef.current.getTracks().forEach((track) => track.stop());
|
||||||
|
mediaStreamRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsSelectionMode(false);
|
||||||
|
setSelectionStart(null);
|
||||||
|
setSelectionEnd(null);
|
||||||
|
setIsCapturing(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
mediaStreamRef.current = stream;
|
||||||
|
|
||||||
|
// Initialize video element if needed
|
||||||
|
if (!videoRef.current) {
|
||||||
|
const video = document.createElement('video');
|
||||||
|
video.style.opacity = '0';
|
||||||
|
video.style.position = 'fixed';
|
||||||
|
video.style.pointerEvents = 'none';
|
||||||
|
video.style.zIndex = '-1';
|
||||||
|
document.body.appendChild(video);
|
||||||
|
videoRef.current = video;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up video with the stream
|
||||||
|
videoRef.current.srcObject = stream;
|
||||||
|
await videoRef.current.play();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to initialize stream:', error);
|
||||||
|
setIsSelectionMode(false);
|
||||||
|
toast.error('Failed to initialize screen capture');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mediaStreamRef.current;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCopySelection = useCallback(async () => {
|
||||||
|
if (!isSelectionMode || !selectionStart || !selectionEnd || !containerRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsCapturing(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const stream = await initializeStream();
|
||||||
|
|
||||||
|
if (!stream || !videoRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for video to be ready
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||||
|
|
||||||
|
// Create temporary canvas for full screenshot
|
||||||
|
const tempCanvas = document.createElement('canvas');
|
||||||
|
tempCanvas.width = videoRef.current.videoWidth;
|
||||||
|
tempCanvas.height = videoRef.current.videoHeight;
|
||||||
|
|
||||||
|
const tempCtx = tempCanvas.getContext('2d');
|
||||||
|
|
||||||
|
if (!tempCtx) {
|
||||||
|
throw new Error('Failed to get temporary canvas context');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the full video frame
|
||||||
|
tempCtx.drawImage(videoRef.current, 0, 0);
|
||||||
|
|
||||||
|
// Calculate scale factor between video and screen
|
||||||
|
const scaleX = videoRef.current.videoWidth / window.innerWidth;
|
||||||
|
const scaleY = videoRef.current.videoHeight / window.innerHeight;
|
||||||
|
|
||||||
|
// Get window scroll position
|
||||||
|
const scrollX = window.scrollX;
|
||||||
|
const scrollY = window.scrollY + 40;
|
||||||
|
|
||||||
|
// Get the container's position in the page
|
||||||
|
const containerRect = containerRef.current.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Offset adjustments for more accurate clipping
|
||||||
|
const leftOffset = -9; // Adjust left position
|
||||||
|
const bottomOffset = -14; // Adjust bottom position
|
||||||
|
|
||||||
|
// Calculate the scaled coordinates with scroll offset and adjustments
|
||||||
|
const scaledX = Math.round(
|
||||||
|
(containerRect.left + Math.min(selectionStart.x, selectionEnd.x) + scrollX + leftOffset) * scaleX,
|
||||||
|
);
|
||||||
|
const scaledY = Math.round(
|
||||||
|
(containerRect.top + Math.min(selectionStart.y, selectionEnd.y) + scrollY + bottomOffset) * scaleY,
|
||||||
|
);
|
||||||
|
const scaledWidth = Math.round(Math.abs(selectionEnd.x - selectionStart.x) * scaleX);
|
||||||
|
const scaledHeight = Math.round(Math.abs(selectionEnd.y - selectionStart.y) * scaleY);
|
||||||
|
|
||||||
|
// Create final canvas for the cropped area
|
||||||
|
const canvas = document.createElement('canvas');
|
||||||
|
canvas.width = Math.round(Math.abs(selectionEnd.x - selectionStart.x));
|
||||||
|
canvas.height = Math.round(Math.abs(selectionEnd.y - selectionStart.y));
|
||||||
|
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
if (!ctx) {
|
||||||
|
throw new Error('Failed to get canvas context');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the cropped area
|
||||||
|
ctx.drawImage(tempCanvas, scaledX, scaledY, scaledWidth, scaledHeight, 0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
// Convert to blob
|
||||||
|
const blob = await new Promise<Blob>((resolve, reject) => {
|
||||||
|
canvas.toBlob((blob) => {
|
||||||
|
if (blob) {
|
||||||
|
resolve(blob);
|
||||||
|
} else {
|
||||||
|
reject(new Error('Failed to create blob'));
|
||||||
|
}
|
||||||
|
}, 'image/png');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create a FileReader to convert blob to base64
|
||||||
|
const reader = new FileReader();
|
||||||
|
|
||||||
|
reader.onload = (e) => {
|
||||||
|
const base64Image = e.target?.result as string;
|
||||||
|
|
||||||
|
// Find the textarea element
|
||||||
|
const textarea = document.querySelector('textarea');
|
||||||
|
|
||||||
|
if (textarea) {
|
||||||
|
// Get the setters from the BaseChat component
|
||||||
|
const setUploadedFiles = (window as any).__BOLT_SET_UPLOADED_FILES__;
|
||||||
|
const setImageDataList = (window as any).__BOLT_SET_IMAGE_DATA_LIST__;
|
||||||
|
const uploadedFiles = (window as any).__BOLT_UPLOADED_FILES__ || [];
|
||||||
|
const imageDataList = (window as any).__BOLT_IMAGE_DATA_LIST__ || [];
|
||||||
|
|
||||||
|
if (setUploadedFiles && setImageDataList) {
|
||||||
|
// Update the files and image data
|
||||||
|
const file = new File([blob], 'screenshot.png', { type: 'image/png' });
|
||||||
|
setUploadedFiles([...uploadedFiles, file]);
|
||||||
|
setImageDataList([...imageDataList, base64Image]);
|
||||||
|
toast.success('Screenshot captured and added to chat');
|
||||||
|
} else {
|
||||||
|
toast.error('Could not add screenshot to chat');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(blob);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to capture screenshot:', error);
|
||||||
|
toast.error('Failed to capture screenshot');
|
||||||
|
|
||||||
|
if (mediaStreamRef.current) {
|
||||||
|
mediaStreamRef.current.getTracks().forEach((track) => track.stop());
|
||||||
|
mediaStreamRef.current = null;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setIsCapturing(false);
|
||||||
|
setSelectionStart(null);
|
||||||
|
setSelectionEnd(null);
|
||||||
|
setIsSelectionMode(false); // Turn off selection mode after capture
|
||||||
|
}
|
||||||
|
}, [isSelectionMode, selectionStart, selectionEnd, containerRef, setIsSelectionMode]);
|
||||||
|
|
||||||
|
const handleSelectionStart = useCallback(
|
||||||
|
(e: React.MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
if (!isSelectionMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rect = e.currentTarget.getBoundingClientRect();
|
||||||
|
const x = e.clientX - rect.left;
|
||||||
|
const y = e.clientY - rect.top;
|
||||||
|
setSelectionStart({ x, y });
|
||||||
|
setSelectionEnd({ x, y });
|
||||||
|
},
|
||||||
|
[isSelectionMode],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSelectionMove = useCallback(
|
||||||
|
(e: React.MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
if (!isSelectionMode || !selectionStart) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rect = e.currentTarget.getBoundingClientRect();
|
||||||
|
const x = e.clientX - rect.left;
|
||||||
|
const y = e.clientY - rect.top;
|
||||||
|
setSelectionEnd({ x, y });
|
||||||
|
},
|
||||||
|
[isSelectionMode, selectionStart],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isSelectionMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 cursor-crosshair"
|
||||||
|
onMouseDown={handleSelectionStart}
|
||||||
|
onMouseMove={handleSelectionMove}
|
||||||
|
onMouseUp={handleCopySelection}
|
||||||
|
onMouseLeave={() => {
|
||||||
|
if (selectionStart) {
|
||||||
|
setSelectionStart(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
backgroundColor: isCapturing ? 'transparent' : 'rgba(0, 0, 0, 0.1)',
|
||||||
|
userSelect: 'none',
|
||||||
|
WebkitUserSelect: 'none',
|
||||||
|
pointerEvents: 'all',
|
||||||
|
opacity: isCapturing ? 0 : 1,
|
||||||
|
zIndex: 50,
|
||||||
|
transition: 'opacity 0.1s ease-in-out',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{selectionStart && selectionEnd && !isCapturing && (
|
||||||
|
<div
|
||||||
|
className="absolute border-2 border-blue-500 bg-blue-200 bg-opacity-20"
|
||||||
|
style={{
|
||||||
|
left: Math.min(selectionStart.x, selectionEnd.x),
|
||||||
|
top: Math.min(selectionStart.y, selectionEnd.y),
|
||||||
|
width: Math.abs(selectionEnd.x - selectionStart.x),
|
||||||
|
height: Math.abs(selectionEnd.y - selectionStart.y),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
@@ -39,6 +39,8 @@ export function getAPIKey(cloudflareEnv: Env, provider: string, userApiKeys?: Re
|
|||||||
return env.TOGETHER_API_KEY || cloudflareEnv.TOGETHER_API_KEY;
|
return env.TOGETHER_API_KEY || cloudflareEnv.TOGETHER_API_KEY;
|
||||||
case 'xAI':
|
case 'xAI':
|
||||||
return env.XAI_API_KEY || cloudflareEnv.XAI_API_KEY;
|
return env.XAI_API_KEY || cloudflareEnv.XAI_API_KEY;
|
||||||
|
case 'Perplexity':
|
||||||
|
return env.PERPLEXITY_API_KEY || cloudflareEnv.PERPLEXITY_API_KEY;
|
||||||
case 'Cohere':
|
case 'Cohere':
|
||||||
return env.COHERE_API_KEY;
|
return env.COHERE_API_KEY;
|
||||||
case 'AzureOpenAI':
|
case 'AzureOpenAI':
|
||||||
|
|||||||
@@ -128,6 +128,15 @@ export function getXAIModel(apiKey: OptionalApiKey, model: string) {
|
|||||||
return openai(model);
|
return openai(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPerplexityModel(apiKey: OptionalApiKey, model: string) {
|
||||||
|
const perplexity = createOpenAI({
|
||||||
|
baseURL: 'https://api.perplexity.ai/',
|
||||||
|
apiKey,
|
||||||
|
});
|
||||||
|
|
||||||
|
return perplexity(model);
|
||||||
|
}
|
||||||
|
|
||||||
export function getModel(
|
export function getModel(
|
||||||
provider: string,
|
provider: string,
|
||||||
model: string,
|
model: string,
|
||||||
@@ -170,6 +179,8 @@ export function getModel(
|
|||||||
return getXAIModel(apiKey, model);
|
return getXAIModel(apiKey, model);
|
||||||
case 'Cohere':
|
case 'Cohere':
|
||||||
return getCohereAIModel(apiKey, model);
|
return getCohereAIModel(apiKey, model);
|
||||||
|
case 'Perplexity':
|
||||||
|
return getPerplexityModel(apiKey, model);
|
||||||
default:
|
default:
|
||||||
return getOllamaModel(baseURL, model);
|
return getOllamaModel(baseURL, model);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
import { convertToCoreMessages, streamText as _streamText } from 'ai';
|
import { convertToCoreMessages, streamText as _streamText } from 'ai';
|
||||||
import { getModel } from '~/lib/.server/llm/model';
|
import { getModel } from '~/lib/.server/llm/model';
|
||||||
import { MAX_TOKENS } from './constants';
|
import { MAX_TOKENS } from './constants';
|
||||||
import { getSystemPrompt } from './prompts';
|
import { getSystemPrompt } from '~/lib/common/prompts/prompts';
|
||||||
import { DEFAULT_MODEL, DEFAULT_PROVIDER, getModelList, MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
|
import {
|
||||||
|
DEFAULT_MODEL,
|
||||||
|
DEFAULT_PROVIDER,
|
||||||
|
getModelList,
|
||||||
|
MODEL_REGEX,
|
||||||
|
MODIFICATIONS_TAG_NAME,
|
||||||
|
PROVIDER_REGEX,
|
||||||
|
WORK_DIR,
|
||||||
|
} from '~/utils/constants';
|
||||||
|
import ignore from 'ignore';
|
||||||
import type { IProviderSetting } from '~/types/model';
|
import type { IProviderSetting } from '~/types/model';
|
||||||
|
import { PromptLibrary } from '~/lib/common/prompt-library';
|
||||||
|
import { allowedHTMLElements } from '~/utils/markdown';
|
||||||
|
|
||||||
interface ToolResult<Name extends string, Args, Result> {
|
interface ToolResult<Name extends string, Args, Result> {
|
||||||
toolCallId: string;
|
toolCallId: string;
|
||||||
@@ -23,6 +34,78 @@ export type Messages = Message[];
|
|||||||
|
|
||||||
export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;
|
export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;
|
||||||
|
|
||||||
|
export interface File {
|
||||||
|
type: 'file';
|
||||||
|
content: string;
|
||||||
|
isBinary: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Folder {
|
||||||
|
type: 'folder';
|
||||||
|
}
|
||||||
|
|
||||||
|
type Dirent = File | Folder;
|
||||||
|
|
||||||
|
export type FileMap = Record<string, Dirent | undefined>;
|
||||||
|
|
||||||
|
export function simplifyBoltActions(input: string): string {
|
||||||
|
// Using regex to match boltAction tags that have type="file"
|
||||||
|
const regex = /(<boltAction[^>]*type="file"[^>]*>)([\s\S]*?)(<\/boltAction>)/g;
|
||||||
|
|
||||||
|
// Replace each matching occurrence
|
||||||
|
return input.replace(regex, (_0, openingTag, _2, closingTag) => {
|
||||||
|
return `${openingTag}\n ...\n ${closingTag}`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common patterns to ignore, similar to .gitignore
|
||||||
|
const IGNORE_PATTERNS = [
|
||||||
|
'node_modules/**',
|
||||||
|
'.git/**',
|
||||||
|
'dist/**',
|
||||||
|
'build/**',
|
||||||
|
'.next/**',
|
||||||
|
'coverage/**',
|
||||||
|
'.cache/**',
|
||||||
|
'.vscode/**',
|
||||||
|
'.idea/**',
|
||||||
|
'**/*.log',
|
||||||
|
'**/.DS_Store',
|
||||||
|
'**/npm-debug.log*',
|
||||||
|
'**/yarn-debug.log*',
|
||||||
|
'**/yarn-error.log*',
|
||||||
|
'**/*lock.json',
|
||||||
|
'**/*lock.yml',
|
||||||
|
];
|
||||||
|
const ig = ignore().add(IGNORE_PATTERNS);
|
||||||
|
|
||||||
|
function createFilesContext(files: FileMap) {
|
||||||
|
let filePaths = Object.keys(files);
|
||||||
|
filePaths = filePaths.filter((x) => {
|
||||||
|
const relPath = x.replace('/home/project/', '');
|
||||||
|
return !ig.ignores(relPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
const fileContexts = filePaths
|
||||||
|
.filter((x) => files[x] && files[x].type == 'file')
|
||||||
|
.map((path) => {
|
||||||
|
const dirent = files[path];
|
||||||
|
|
||||||
|
if (!dirent || dirent.type == 'folder') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const codeWithLinesNumbers = dirent.content
|
||||||
|
.split('\n')
|
||||||
|
.map((v, i) => `${i + 1}|${v}`)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
|
return `<file path="${path}">\n${codeWithLinesNumbers}\n</file>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
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>`;
|
||||||
|
}
|
||||||
|
|
||||||
function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
|
function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
|
||||||
const textContent = Array.isArray(message.content)
|
const textContent = Array.isArray(message.content)
|
||||||
? message.content.find((item) => item.type === 'text')?.text || ''
|
? message.content.find((item) => item.type === 'text')?.text || ''
|
||||||
@@ -64,9 +147,11 @@ export async function streamText(props: {
|
|||||||
env: Env;
|
env: Env;
|
||||||
options?: StreamingOptions;
|
options?: StreamingOptions;
|
||||||
apiKeys?: Record<string, string>;
|
apiKeys?: Record<string, string>;
|
||||||
|
files?: FileMap;
|
||||||
providerSettings?: Record<string, IProviderSetting>;
|
providerSettings?: Record<string, IProviderSetting>;
|
||||||
|
promptId?: string;
|
||||||
}) {
|
}) {
|
||||||
const { messages, env, options, apiKeys, providerSettings } = props;
|
const { messages, env, options, apiKeys, files, providerSettings, promptId } = props;
|
||||||
let currentModel = DEFAULT_MODEL;
|
let currentModel = DEFAULT_MODEL;
|
||||||
let currentProvider = DEFAULT_PROVIDER.name;
|
let currentProvider = DEFAULT_PROVIDER.name;
|
||||||
const MODEL_LIST = await getModelList(apiKeys || {}, providerSettings);
|
const MODEL_LIST = await getModelList(apiKeys || {}, providerSettings);
|
||||||
@@ -80,6 +165,12 @@ export async function streamText(props: {
|
|||||||
|
|
||||||
currentProvider = provider;
|
currentProvider = provider;
|
||||||
|
|
||||||
|
return { ...message, content };
|
||||||
|
} else if (message.role == 'assistant') {
|
||||||
|
const content = message.content;
|
||||||
|
|
||||||
|
// content = simplifyBoltActions(content);
|
||||||
|
|
||||||
return { ...message, content };
|
return { ...message, content };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,9 +181,23 @@ export async function streamText(props: {
|
|||||||
|
|
||||||
const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS;
|
const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS;
|
||||||
|
|
||||||
|
let systemPrompt =
|
||||||
|
PromptLibrary.getPropmtFromLibrary(promptId || 'default', {
|
||||||
|
cwd: WORK_DIR,
|
||||||
|
allowedHtmlElements: allowedHTMLElements,
|
||||||
|
modificationTagName: MODIFICATIONS_TAG_NAME,
|
||||||
|
}) ?? getSystemPrompt();
|
||||||
|
let codeContext = '';
|
||||||
|
|
||||||
|
if (files) {
|
||||||
|
codeContext = createFilesContext(files);
|
||||||
|
codeContext = '';
|
||||||
|
systemPrompt = `${systemPrompt}\n\n ${codeContext}`;
|
||||||
|
}
|
||||||
|
|
||||||
return _streamText({
|
return _streamText({
|
||||||
model: getModel(currentProvider, currentModel, env, apiKeys, providerSettings) as any,
|
model: getModel(currentProvider, currentModel, env, apiKeys, providerSettings) as any,
|
||||||
system: getSystemPrompt(),
|
system: systemPrompt,
|
||||||
maxTokens: dynamicMaxTokens,
|
maxTokens: dynamicMaxTokens,
|
||||||
messages: convertToCoreMessages(processedMessages as any),
|
messages: convertToCoreMessages(processedMessages as any),
|
||||||
...options,
|
...options,
|
||||||
|
|||||||
49
app/lib/common/prompt-library.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { getSystemPrompt } from './prompts/prompts';
|
||||||
|
import optimized from './prompts/optimized';
|
||||||
|
|
||||||
|
export interface PromptOptions {
|
||||||
|
cwd: string;
|
||||||
|
allowedHtmlElements: string[];
|
||||||
|
modificationTagName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PromptLibrary {
|
||||||
|
static library: Record<
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
label: string;
|
||||||
|
description: string;
|
||||||
|
get: (options: PromptOptions) => string;
|
||||||
|
}
|
||||||
|
> = {
|
||||||
|
default: {
|
||||||
|
label: 'Default Prompt',
|
||||||
|
description: 'This is the battle tested default system Prompt',
|
||||||
|
get: (options) => getSystemPrompt(options.cwd),
|
||||||
|
},
|
||||||
|
optimized: {
|
||||||
|
label: 'Optimized Prompt (experimental)',
|
||||||
|
description: 'an Experimental version of the prompt for lower token usage',
|
||||||
|
get: (options) => optimized(options),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
static getList() {
|
||||||
|
return Object.entries(this.library).map(([key, value]) => {
|
||||||
|
const { label, description } = value;
|
||||||
|
return {
|
||||||
|
id: key,
|
||||||
|
label,
|
||||||
|
description,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static getPropmtFromLibrary(promptId: string, options: PromptOptions) {
|
||||||
|
const prompt = this.library[promptId];
|
||||||
|
|
||||||
|
if (!prompt) {
|
||||||
|
throw 'Prompt Now Found';
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.library[promptId]?.get(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
199
app/lib/common/prompts/optimized.ts
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
import type { PromptOptions } from '~/lib/common/prompt-library';
|
||||||
|
|
||||||
|
export default (options: PromptOptions) => {
|
||||||
|
const { cwd, allowedHtmlElements, modificationTagName } = options;
|
||||||
|
return `
|
||||||
|
You are Bolt, an expert AI assistant and exceptional senior software developer with vast knowledge across multiple programming languages, frameworks, and best practices.
|
||||||
|
|
||||||
|
<system_constraints>
|
||||||
|
- Operating in WebContainer, an in-browser Node.js runtime
|
||||||
|
- Limited Python support: standard library only, no pip
|
||||||
|
- No C/C++ compiler, native binaries, or Git
|
||||||
|
- Prefer Node.js scripts over shell scripts
|
||||||
|
- Use Vite for web servers
|
||||||
|
- Databases: prefer libsql, sqlite, or non-native solutions
|
||||||
|
- When for react dont forget to write vite config and index.html to the project
|
||||||
|
|
||||||
|
Available shell commands: cat, cp, ls, mkdir, mv, rm, rmdir, touch, hostname, ps, pwd, uptime, env, node, python3, code, jq, curl, head, sort, tail, clear, which, export, chmod, scho, kill, ln, xxd, alias, getconf, loadenv, wasm, xdg-open, command, exit, source
|
||||||
|
</system_constraints>
|
||||||
|
|
||||||
|
<code_formatting_info>
|
||||||
|
Use 2 spaces for indentation
|
||||||
|
</code_formatting_info>
|
||||||
|
|
||||||
|
<message_formatting_info>
|
||||||
|
Available HTML elements: ${allowedHtmlElements.join(', ')}
|
||||||
|
</message_formatting_info>
|
||||||
|
|
||||||
|
<diff_spec>
|
||||||
|
File modifications in \`<${modificationTagName}>\` section:
|
||||||
|
- \`<diff path="/path/to/file">\`: GNU unified diff format
|
||||||
|
- \`<file path="/path/to/file">\`: Full new content
|
||||||
|
</diff_spec>
|
||||||
|
|
||||||
|
<chain_of_thought_instructions>
|
||||||
|
do not mention the phrase "chain of thought"
|
||||||
|
Before solutions, briefly outline implementation steps (2-4 lines max):
|
||||||
|
- List concrete steps
|
||||||
|
- Identify key components
|
||||||
|
- Note potential challenges
|
||||||
|
- Do not write the actual code just the plan and structure if needed
|
||||||
|
- Once completed planning start writing the artifacts
|
||||||
|
</chain_of_thought_instructions>
|
||||||
|
|
||||||
|
<artifact_info>
|
||||||
|
Create a single, comprehensive artifact for each project:
|
||||||
|
- Use \`<boltArtifact>\` tags with \`title\` and \`id\` attributes
|
||||||
|
- Use \`<boltAction>\` tags with \`type\` attribute:
|
||||||
|
- shell: Run commands
|
||||||
|
- file: Write/update files (use \`filePath\` attribute)
|
||||||
|
- start: Start dev server (only when necessary)
|
||||||
|
- Order actions logically
|
||||||
|
- Install dependencies first
|
||||||
|
- Provide full, updated content for all files
|
||||||
|
- Use coding best practices: modular, clean, readable code
|
||||||
|
</artifact_info>
|
||||||
|
|
||||||
|
|
||||||
|
# CRITICAL RULES - NEVER IGNORE
|
||||||
|
|
||||||
|
## File and Command Handling
|
||||||
|
1. ALWAYS use artifacts for file contents and commands - NO EXCEPTIONS
|
||||||
|
2. When writing a file, INCLUDE THE ENTIRE FILE CONTENT - NO PARTIAL UPDATES
|
||||||
|
3. For modifications, ONLY alter files that require changes - DO NOT touch unaffected files
|
||||||
|
|
||||||
|
## Response Format
|
||||||
|
4. Use markdown EXCLUSIVELY - HTML tags are ONLY allowed within artifacts
|
||||||
|
5. Be concise - Explain ONLY when explicitly requested
|
||||||
|
6. NEVER use the word "artifact" in responses
|
||||||
|
|
||||||
|
## Development Process
|
||||||
|
7. ALWAYS think and plan comprehensively before providing a solution
|
||||||
|
8. Current working directory: \`${cwd} \` - Use this for all file paths
|
||||||
|
9. Don't use cli scaffolding to steup the project, use cwd as Root of the project
|
||||||
|
11. For nodejs projects ALWAYS install dependencies after writing package.json file
|
||||||
|
|
||||||
|
## Coding Standards
|
||||||
|
10. ALWAYS create smaller, atomic components and modules
|
||||||
|
11. Modularity is PARAMOUNT - Break down functionality into logical, reusable parts
|
||||||
|
12. IMMEDIATELY refactor any file exceeding 250 lines
|
||||||
|
13. ALWAYS plan refactoring before implementation - Consider impacts on the entire system
|
||||||
|
|
||||||
|
## Artifact Usage
|
||||||
|
22. Use \`<boltArtifact>\` tags with \`title\` and \`id\` attributes for each project
|
||||||
|
23. Use \`<boltAction>\` tags with appropriate \`type\` attribute:
|
||||||
|
- \`shell\`: For running commands
|
||||||
|
- \`file\`: For writing/updating files (include \`filePath\` attribute)
|
||||||
|
- \`start\`: For starting dev servers (use only when necessary/ or new dependencies are installed)
|
||||||
|
24. Order actions logically - dependencies MUST be installed first
|
||||||
|
25. For Vite project must include vite config and index.html for entry point
|
||||||
|
26. Provide COMPLETE, up-to-date content for all files - NO placeholders or partial updates
|
||||||
|
|
||||||
|
CRITICAL: These rules are ABSOLUTE and MUST be followed WITHOUT EXCEPTION in EVERY response.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
<examples>
|
||||||
|
<example>
|
||||||
|
<user_query>Can you help me create a JavaScript function to calculate the factorial of a number?</user_query>
|
||||||
|
<assistant_response>
|
||||||
|
Certainly, I can help you create a JavaScript function to calculate the factorial of a number.
|
||||||
|
|
||||||
|
<boltArtifact id="factorial-function" title="JavaScript Factorial Function">
|
||||||
|
<boltAction type="file" filePath="index.js">
|
||||||
|
function factorial(n) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="shell">
|
||||||
|
node index.js
|
||||||
|
</boltAction>
|
||||||
|
</boltArtifact>
|
||||||
|
</assistant_response>
|
||||||
|
</example>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<user_query>Build a snake game</user_query>
|
||||||
|
<assistant_response>
|
||||||
|
Certainly! I'd be happy to help you build a snake game using JavaScript and HTML5 Canvas. This will be a basic implementation that you can later expand upon. Let's create the game step by step.
|
||||||
|
|
||||||
|
<boltArtifact id="snake-game" title="Snake Game in HTML and JavaScript">
|
||||||
|
<boltAction type="file" filePath="package.json">
|
||||||
|
{
|
||||||
|
"name": "snake",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite"
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="shell">
|
||||||
|
npm install --save-dev vite
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="file" filePath="index.html">
|
||||||
|
...
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="start">
|
||||||
|
npm run dev
|
||||||
|
</boltAction>
|
||||||
|
</boltArtifact>
|
||||||
|
|
||||||
|
Now you can play the Snake game by opening the provided local server URL in your browser. Use the arrow keys to control the snake. Eat the red food to grow and increase your score. The game ends if you hit the wall or your own tail.
|
||||||
|
</assistant_response>
|
||||||
|
</example>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<user_query>Make a bouncing ball with real gravity using React</user_query>
|
||||||
|
<assistant_response>
|
||||||
|
Certainly! I'll create a bouncing ball with real gravity using React. We'll use the react-spring library for physics-based animations.
|
||||||
|
|
||||||
|
<boltArtifact id="bouncing-ball-react" title="Bouncing Ball with Gravity in React">
|
||||||
|
<boltAction type="file" filePath="package.json">
|
||||||
|
{
|
||||||
|
"name": "bouncing-ball",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"react-spring": "^9.7.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "^18.0.28",
|
||||||
|
"@types/react-dom": "^18.0.11",
|
||||||
|
"@vitejs/plugin-react": "^3.1.0",
|
||||||
|
"vite": "^4.2.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="file" filePath="index.html">
|
||||||
|
...
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="file" filePath="src/main.jsx">
|
||||||
|
...
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="file" filePath="src/index.css">
|
||||||
|
...
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="file" filePath="src/App.jsx">
|
||||||
|
...
|
||||||
|
</boltAction>
|
||||||
|
<boltAction type="start">
|
||||||
|
npm run dev
|
||||||
|
</boltAction>
|
||||||
|
</boltArtifact>
|
||||||
|
|
||||||
|
You can now view the bouncing ball animation in the preview. The ball will start falling from the top of the screen and bounce realistically when it hits the bottom.
|
||||||
|
</assistant_response>
|
||||||
|
</example>
|
||||||
|
</examples>
|
||||||
|
Always use artifacts for file contents and commands, following the format shown in these examples.
|
||||||
|
`;
|
||||||
|
};
|
||||||
@@ -23,14 +23,14 @@ const messageParser = new StreamingMessageParser({
|
|||||||
logger.trace('onActionOpen', data.action);
|
logger.trace('onActionOpen', data.action);
|
||||||
|
|
||||||
// we only add shell actions when when the close tag got parsed because only then we have the content
|
// we only add shell actions when when the close tag got parsed because only then we have the content
|
||||||
if (data.action.type !== 'shell') {
|
if (data.action.type === 'file') {
|
||||||
workbenchStore.addAction(data);
|
workbenchStore.addAction(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onActionClose: (data) => {
|
onActionClose: (data) => {
|
||||||
logger.trace('onActionClose', data.action);
|
logger.trace('onActionClose', data.action);
|
||||||
|
|
||||||
if (data.action.type === 'shell') {
|
if (data.action.type !== 'file') {
|
||||||
workbenchStore.addAction(data);
|
workbenchStore.addAction(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,56 @@
|
|||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { isDebugMode, isLocalModelsEnabled, LOCAL_PROVIDERS, providersStore } from '~/lib/stores/settings';
|
import {
|
||||||
|
isDebugMode,
|
||||||
|
isEventLogsEnabled,
|
||||||
|
isLocalModelsEnabled,
|
||||||
|
LOCAL_PROVIDERS,
|
||||||
|
promptStore,
|
||||||
|
providersStore,
|
||||||
|
latestBranchStore,
|
||||||
|
} from '~/lib/stores/settings';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import type { IProviderSetting, ProviderInfo } from '~/types/model';
|
import type { IProviderSetting, ProviderInfo } from '~/types/model';
|
||||||
|
import { logStore } from '~/lib/stores/logs'; // assuming logStore is imported from this location
|
||||||
|
import commit from '~/commit.json';
|
||||||
|
|
||||||
|
interface CommitData {
|
||||||
|
commit: string;
|
||||||
|
version?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const commitJson: CommitData = commit;
|
||||||
|
|
||||||
export function useSettings() {
|
export function useSettings() {
|
||||||
const providers = useStore(providersStore);
|
const providers = useStore(providersStore);
|
||||||
const debug = useStore(isDebugMode);
|
const debug = useStore(isDebugMode);
|
||||||
|
const eventLogs = useStore(isEventLogsEnabled);
|
||||||
|
const promptId = useStore(promptStore);
|
||||||
const isLocalModel = useStore(isLocalModelsEnabled);
|
const isLocalModel = useStore(isLocalModelsEnabled);
|
||||||
|
const isLatestBranch = useStore(latestBranchStore);
|
||||||
const [activeProviders, setActiveProviders] = useState<ProviderInfo[]>([]);
|
const [activeProviders, setActiveProviders] = useState<ProviderInfo[]>([]);
|
||||||
|
|
||||||
|
// Function to check if we're on stable version
|
||||||
|
const checkIsStableVersion = async () => {
|
||||||
|
try {
|
||||||
|
const stableResponse = await fetch(
|
||||||
|
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/refs/tags/v${commitJson.version}/app/commit.json`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!stableResponse.ok) {
|
||||||
|
console.warn('Failed to fetch stable commit info');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stableData = (await stableResponse.json()) as CommitData;
|
||||||
|
|
||||||
|
return commit.commit === stableData.commit;
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Error checking stable version:', error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// reading values from cookies on mount
|
// reading values from cookies on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedProviders = Cookies.get('providers');
|
const savedProviders = Cookies.get('providers');
|
||||||
@@ -39,12 +80,45 @@ export function useSettings() {
|
|||||||
isDebugMode.set(savedDebugMode === 'true');
|
isDebugMode.set(savedDebugMode === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load event logs from cookies
|
||||||
|
const savedEventLogs = Cookies.get('isEventLogsEnabled');
|
||||||
|
|
||||||
|
if (savedEventLogs) {
|
||||||
|
isEventLogsEnabled.set(savedEventLogs === 'true');
|
||||||
|
}
|
||||||
|
|
||||||
// load local models from cookies
|
// load local models from cookies
|
||||||
const savedLocalModels = Cookies.get('isLocalModelsEnabled');
|
const savedLocalModels = Cookies.get('isLocalModelsEnabled');
|
||||||
|
|
||||||
if (savedLocalModels) {
|
if (savedLocalModels) {
|
||||||
isLocalModelsEnabled.set(savedLocalModels === 'true');
|
isLocalModelsEnabled.set(savedLocalModels === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const promptId = Cookies.get('promptId');
|
||||||
|
|
||||||
|
if (promptId) {
|
||||||
|
promptStore.set(promptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// load latest branch setting from cookies or determine based on version
|
||||||
|
const savedLatestBranch = Cookies.get('isLatestBranch');
|
||||||
|
let checkCommit = Cookies.get('commitHash');
|
||||||
|
|
||||||
|
if (checkCommit === undefined) {
|
||||||
|
checkCommit = commit.commit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedLatestBranch === undefined || checkCommit !== commit.commit) {
|
||||||
|
// If setting hasn't been set by user, check version
|
||||||
|
checkIsStableVersion().then((isStable) => {
|
||||||
|
const shouldUseLatest = !isStable;
|
||||||
|
latestBranchStore.set(shouldUseLatest);
|
||||||
|
Cookies.set('isLatestBranch', String(shouldUseLatest));
|
||||||
|
Cookies.set('commitHash', String(commit.commit));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
latestBranchStore.set(savedLatestBranch === 'true');
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// writing values to cookies on change
|
// writing values to cookies on change
|
||||||
@@ -80,21 +154,45 @@ export function useSettings() {
|
|||||||
|
|
||||||
const enableDebugMode = useCallback((enabled: boolean) => {
|
const enableDebugMode = useCallback((enabled: boolean) => {
|
||||||
isDebugMode.set(enabled);
|
isDebugMode.set(enabled);
|
||||||
|
logStore.logSystem(`Debug mode ${enabled ? 'enabled' : 'disabled'}`);
|
||||||
Cookies.set('isDebugEnabled', String(enabled));
|
Cookies.set('isDebugEnabled', String(enabled));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const enableEventLogs = useCallback((enabled: boolean) => {
|
||||||
|
isEventLogsEnabled.set(enabled);
|
||||||
|
logStore.logSystem(`Event logs ${enabled ? 'enabled' : 'disabled'}`);
|
||||||
|
Cookies.set('isEventLogsEnabled', String(enabled));
|
||||||
|
}, []);
|
||||||
|
|
||||||
const enableLocalModels = useCallback((enabled: boolean) => {
|
const enableLocalModels = useCallback((enabled: boolean) => {
|
||||||
isLocalModelsEnabled.set(enabled);
|
isLocalModelsEnabled.set(enabled);
|
||||||
|
logStore.logSystem(`Local models ${enabled ? 'enabled' : 'disabled'}`);
|
||||||
Cookies.set('isLocalModelsEnabled', String(enabled));
|
Cookies.set('isLocalModelsEnabled', String(enabled));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const setPromptId = useCallback((promptId: string) => {
|
||||||
|
promptStore.set(promptId);
|
||||||
|
Cookies.set('promptId', promptId);
|
||||||
|
}, []);
|
||||||
|
const enableLatestBranch = useCallback((enabled: boolean) => {
|
||||||
|
latestBranchStore.set(enabled);
|
||||||
|
logStore.logSystem(`Main branch updates ${enabled ? 'enabled' : 'disabled'}`);
|
||||||
|
Cookies.set('isLatestBranch', String(enabled));
|
||||||
|
}, []);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
providers,
|
providers,
|
||||||
activeProviders,
|
activeProviders,
|
||||||
updateProviderSettings,
|
updateProviderSettings,
|
||||||
debug,
|
debug,
|
||||||
enableDebugMode,
|
enableDebugMode,
|
||||||
|
eventLogs,
|
||||||
|
enableEventLogs,
|
||||||
isLocalModel,
|
isLocalModel,
|
||||||
enableLocalModels,
|
enableLocalModels,
|
||||||
|
promptId,
|
||||||
|
setPromptId,
|
||||||
|
isLatestBranch,
|
||||||
|
enableLatestBranch,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { atom } from 'nanostores';
|
|||||||
import type { Message } from 'ai';
|
import type { Message } from 'ai';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { workbenchStore } from '~/lib/stores/workbench';
|
import { workbenchStore } from '~/lib/stores/workbench';
|
||||||
|
import { logStore } from '~/lib/stores/logs'; // Import logStore
|
||||||
import {
|
import {
|
||||||
getMessages,
|
getMessages,
|
||||||
getNextId,
|
getNextId,
|
||||||
@@ -43,6 +44,8 @@ export function useChatHistory() {
|
|||||||
setReady(true);
|
setReady(true);
|
||||||
|
|
||||||
if (persistenceEnabled) {
|
if (persistenceEnabled) {
|
||||||
|
const error = new Error('Chat persistence is unavailable');
|
||||||
|
logStore.logError('Chat persistence initialization failed', error);
|
||||||
toast.error('Chat persistence is unavailable');
|
toast.error('Chat persistence is unavailable');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +72,7 @@ export function useChatHistory() {
|
|||||||
setReady(true);
|
setReady(true);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
logStore.logError('Failed to load chat messages', error);
|
||||||
toast.error(error.message);
|
toast.error(error.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,8 +202,9 @@ export class ActionRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const webcontainer = await this.#webcontainer;
|
const webcontainer = await this.#webcontainer;
|
||||||
|
const relativePath = nodePath.relative(webcontainer.workdir, action.filePath);
|
||||||
|
|
||||||
let folder = nodePath.dirname(action.filePath);
|
let folder = nodePath.dirname(relativePath);
|
||||||
|
|
||||||
// remove trailing slashes
|
// remove trailing slashes
|
||||||
folder = folder.replace(/\/+$/g, '');
|
folder = folder.replace(/\/+$/g, '');
|
||||||
@@ -218,8 +219,8 @@ export class ActionRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await webcontainer.fs.writeFile(action.filePath, action.content);
|
await webcontainer.fs.writeFile(relativePath, action.content);
|
||||||
logger.debug(`File written ${action.filePath}`);
|
logger.debug(`File written ${relativePath}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Failed to write file\n\n', error);
|
logger.error('Failed to write file\n\n', error);
|
||||||
}
|
}
|
||||||
|
|||||||
149
app/lib/stores/logs.ts
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
import { atom, map } from 'nanostores';
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
import { createScopedLogger } from '~/utils/logger';
|
||||||
|
|
||||||
|
const logger = createScopedLogger('LogStore');
|
||||||
|
|
||||||
|
export interface LogEntry {
|
||||||
|
id: string;
|
||||||
|
timestamp: string;
|
||||||
|
level: 'info' | 'warning' | 'error' | 'debug';
|
||||||
|
message: string;
|
||||||
|
details?: Record<string, any>;
|
||||||
|
category: 'system' | 'provider' | 'user' | 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
const MAX_LOGS = 1000; // Maximum number of logs to keep in memory
|
||||||
|
|
||||||
|
class LogStore {
|
||||||
|
private _logs = map<Record<string, LogEntry>>({});
|
||||||
|
showLogs = atom(true);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
// Load saved logs from cookies on initialization
|
||||||
|
this._loadLogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _loadLogs() {
|
||||||
|
const savedLogs = Cookies.get('eventLogs');
|
||||||
|
|
||||||
|
if (savedLogs) {
|
||||||
|
try {
|
||||||
|
const parsedLogs = JSON.parse(savedLogs);
|
||||||
|
this._logs.set(parsedLogs);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('Failed to parse logs from cookies:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _saveLogs() {
|
||||||
|
const currentLogs = this._logs.get();
|
||||||
|
Cookies.set('eventLogs', JSON.stringify(currentLogs));
|
||||||
|
}
|
||||||
|
|
||||||
|
private _generateId(): string {
|
||||||
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _trimLogs() {
|
||||||
|
const currentLogs = Object.entries(this._logs.get());
|
||||||
|
|
||||||
|
if (currentLogs.length > MAX_LOGS) {
|
||||||
|
const sortedLogs = currentLogs.sort(
|
||||||
|
([, a], [, b]) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
|
||||||
|
);
|
||||||
|
const newLogs = Object.fromEntries(sortedLogs.slice(0, MAX_LOGS));
|
||||||
|
this._logs.set(newLogs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addLog(
|
||||||
|
message: string,
|
||||||
|
level: LogEntry['level'] = 'info',
|
||||||
|
category: LogEntry['category'] = 'system',
|
||||||
|
details?: Record<string, any>,
|
||||||
|
) {
|
||||||
|
const id = this._generateId();
|
||||||
|
const entry: LogEntry = {
|
||||||
|
id,
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
level,
|
||||||
|
message,
|
||||||
|
details,
|
||||||
|
category,
|
||||||
|
};
|
||||||
|
|
||||||
|
this._logs.setKey(id, entry);
|
||||||
|
this._trimLogs();
|
||||||
|
this._saveLogs();
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// System events
|
||||||
|
logSystem(message: string, details?: Record<string, any>) {
|
||||||
|
return this.addLog(message, 'info', 'system', details);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provider events
|
||||||
|
logProvider(message: string, details?: Record<string, any>) {
|
||||||
|
return this.addLog(message, 'info', 'provider', details);
|
||||||
|
}
|
||||||
|
|
||||||
|
// User actions
|
||||||
|
logUserAction(message: string, details?: Record<string, any>) {
|
||||||
|
return this.addLog(message, 'info', 'user', details);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error events
|
||||||
|
logError(message: string, error?: Error | unknown, details?: Record<string, any>) {
|
||||||
|
const errorDetails = {
|
||||||
|
...(details || {}),
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? {
|
||||||
|
message: error.message,
|
||||||
|
stack: error.stack,
|
||||||
|
}
|
||||||
|
: error,
|
||||||
|
};
|
||||||
|
return this.addLog(message, 'error', 'error', errorDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warning events
|
||||||
|
logWarning(message: string, details?: Record<string, any>) {
|
||||||
|
return this.addLog(message, 'warning', 'system', details);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debug events
|
||||||
|
logDebug(message: string, details?: Record<string, any>) {
|
||||||
|
return this.addLog(message, 'debug', 'system', details);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearLogs() {
|
||||||
|
this._logs.set({});
|
||||||
|
this._saveLogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
getLogs() {
|
||||||
|
return Object.values(this._logs.get()).sort(
|
||||||
|
(a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getFilteredLogs(level?: LogEntry['level'], category?: LogEntry['category'], searchQuery?: string) {
|
||||||
|
return this.getLogs().filter((log) => {
|
||||||
|
const matchesLevel = !level || level === 'debug' || log.level === level;
|
||||||
|
const matchesCategory = !category || log.category === category;
|
||||||
|
const matchesSearch =
|
||||||
|
!searchQuery ||
|
||||||
|
log.message.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
JSON.stringify(log.details).toLowerCase().includes(searchQuery.toLowerCase());
|
||||||
|
|
||||||
|
return matchesLevel && matchesCategory && matchesSearch;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const logStore = new LogStore();
|
||||||
@@ -43,4 +43,10 @@ export const providersStore = map<ProviderSetting>(initialProviderSettings);
|
|||||||
|
|
||||||
export const isDebugMode = atom(false);
|
export const isDebugMode = atom(false);
|
||||||
|
|
||||||
|
export const isEventLogsEnabled = atom(false);
|
||||||
|
|
||||||
export const isLocalModelsEnabled = atom(true);
|
export const isLocalModelsEnabled = atom(true);
|
||||||
|
|
||||||
|
export const promptStore = atom<string>('default');
|
||||||
|
|
||||||
|
export const latestBranchStore = atom(false);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { atom } from 'nanostores';
|
import { atom } from 'nanostores';
|
||||||
|
import { logStore } from './logs';
|
||||||
|
|
||||||
export type Theme = 'dark' | 'light';
|
export type Theme = 'dark' | 'light';
|
||||||
|
|
||||||
@@ -26,10 +27,8 @@ function initStore() {
|
|||||||
export function toggleTheme() {
|
export function toggleTheme() {
|
||||||
const currentTheme = themeStore.get();
|
const currentTheme = themeStore.get();
|
||||||
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
||||||
|
|
||||||
themeStore.set(newTheme);
|
themeStore.set(newTheme);
|
||||||
|
logStore.logSystem(`Theme changed to ${newTheme} mode`);
|
||||||
localStorage.setItem(kTheme, newTheme);
|
localStorage.setItem(kTheme, newTheme);
|
||||||
|
|
||||||
document.querySelector('html')?.setAttribute('data-theme', newTheme);
|
document.querySelector('html')?.setAttribute('data-theme', newTheme);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import * as nodePath from 'node:path';
|
|||||||
import { extractRelativePath } from '~/utils/diff';
|
import { extractRelativePath } from '~/utils/diff';
|
||||||
import { description } from '~/lib/persistence';
|
import { description } from '~/lib/persistence';
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
import { createSampler } from '~/utils/sampler';
|
||||||
|
|
||||||
export interface ArtifactState {
|
export interface ArtifactState {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -262,9 +263,9 @@ export class WorkbenchStore {
|
|||||||
this.artifacts.setKey(messageId, { ...artifact, ...state });
|
this.artifacts.setKey(messageId, { ...artifact, ...state });
|
||||||
}
|
}
|
||||||
addAction(data: ActionCallbackData) {
|
addAction(data: ActionCallbackData) {
|
||||||
this._addAction(data);
|
// this._addAction(data);
|
||||||
|
|
||||||
// this.addToExecutionQueue(()=>this._addAction(data))
|
this.addToExecutionQueue(() => this._addAction(data));
|
||||||
}
|
}
|
||||||
async _addAction(data: ActionCallbackData) {
|
async _addAction(data: ActionCallbackData) {
|
||||||
const { messageId } = data;
|
const { messageId } = data;
|
||||||
@@ -280,7 +281,7 @@ export class WorkbenchStore {
|
|||||||
|
|
||||||
runAction(data: ActionCallbackData, isStreaming: boolean = false) {
|
runAction(data: ActionCallbackData, isStreaming: boolean = false) {
|
||||||
if (isStreaming) {
|
if (isStreaming) {
|
||||||
this._runAction(data, isStreaming);
|
this.actionStreamSampler(data, isStreaming);
|
||||||
} else {
|
} else {
|
||||||
this.addToExecutionQueue(() => this._runAction(data, isStreaming));
|
this.addToExecutionQueue(() => this._runAction(data, isStreaming));
|
||||||
}
|
}
|
||||||
@@ -294,6 +295,12 @@ export class WorkbenchStore {
|
|||||||
unreachable('Artifact not found');
|
unreachable('Artifact not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const action = artifact.runner.actions.get()[data.actionId];
|
||||||
|
|
||||||
|
if (!action || action.executed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.action.type === 'file') {
|
if (data.action.type === 'file') {
|
||||||
const wc = await webcontainer;
|
const wc = await webcontainer;
|
||||||
const fullPath = nodePath.join(wc.workdir, data.action.filePath);
|
const fullPath = nodePath.join(wc.workdir, data.action.filePath);
|
||||||
@@ -323,6 +330,10 @@ export class WorkbenchStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actionStreamSampler = createSampler(async (data: ActionCallbackData, isStreaming: boolean = false) => {
|
||||||
|
return await this._runAction(data, isStreaming);
|
||||||
|
}, 100); // TODO: remove this magic number to have it configurable
|
||||||
|
|
||||||
#getArtifact(id: string) {
|
#getArtifact(id: string) {
|
||||||
const artifacts = this.artifacts.get();
|
const artifacts = this.artifacts.get();
|
||||||
return artifacts[id];
|
return artifacts[id];
|
||||||
|
|||||||
19
app/root.tsx
@@ -78,6 +78,23 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import { logStore } from './lib/stores/logs';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return <Outlet />;
|
const theme = useStore(themeStore);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
logStore.logSystem('Application initialized', {
|
||||||
|
theme,
|
||||||
|
platform: navigator.platform,
|
||||||
|
userAgent: navigator.userAgent,
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<Outlet />
|
||||||
|
</Layout>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { type ActionFunctionArgs } from '@remix-run/cloudflare';
|
import { type ActionFunctionArgs } from '@remix-run/cloudflare';
|
||||||
|
import { createDataStream } from 'ai';
|
||||||
import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS } from '~/lib/.server/llm/constants';
|
import { MAX_RESPONSE_SEGMENTS, MAX_TOKENS } from '~/lib/.server/llm/constants';
|
||||||
import { CONTINUE_PROMPT } from '~/lib/.server/llm/prompts';
|
import { CONTINUE_PROMPT } from '~/lib/common/prompts/prompts';
|
||||||
import { streamText, type Messages, type StreamingOptions } from '~/lib/.server/llm/stream-text';
|
import { streamText, type Messages, type StreamingOptions } from '~/lib/.server/llm/stream-text';
|
||||||
import SwitchableStream from '~/lib/.server/llm/switchable-stream';
|
import SwitchableStream from '~/lib/.server/llm/switchable-stream';
|
||||||
import type { IProviderSetting } from '~/types/model';
|
import type { IProviderSetting } from '~/types/model';
|
||||||
@@ -9,17 +10,15 @@ export async function action(args: ActionFunctionArgs) {
|
|||||||
return chatAction(args);
|
return chatAction(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseCookies(cookieHeader: string) {
|
function parseCookies(cookieHeader: string): Record<string, string> {
|
||||||
const cookies: any = {};
|
const cookies: Record<string, string> = {};
|
||||||
|
|
||||||
// Split the cookie string by semicolons and spaces
|
|
||||||
const items = cookieHeader.split(';').map((cookie) => cookie.trim());
|
const items = cookieHeader.split(';').map((cookie) => cookie.trim());
|
||||||
|
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
const [name, ...rest] = item.split('=');
|
const [name, ...rest] = item.split('=');
|
||||||
|
|
||||||
if (name && rest) {
|
if (name && rest) {
|
||||||
// Decode the name and value, and join value parts in case it contains '='
|
|
||||||
const decodedName = decodeURIComponent(name.trim());
|
const decodedName = decodeURIComponent(name.trim());
|
||||||
const decodedValue = decodeURIComponent(rest.join('=').trim());
|
const decodedValue = decodeURIComponent(rest.join('=').trim());
|
||||||
cookies[decodedName] = decodedValue;
|
cookies[decodedName] = decodedValue;
|
||||||
@@ -30,14 +29,13 @@ function parseCookies(cookieHeader: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function chatAction({ context, request }: ActionFunctionArgs) {
|
async function chatAction({ context, request }: ActionFunctionArgs) {
|
||||||
const { messages } = await request.json<{
|
const { messages, files, promptId } = await request.json<{
|
||||||
messages: Messages;
|
messages: Messages;
|
||||||
model: string;
|
files: any;
|
||||||
|
promptId?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const cookieHeader = request.headers.get('Cookie');
|
const cookieHeader = request.headers.get('Cookie');
|
||||||
|
|
||||||
// Parse the cookie's value (returns an object or null if no cookie exists)
|
|
||||||
const apiKeys = JSON.parse(parseCookies(cookieHeader || '').apiKeys || '{}');
|
const apiKeys = JSON.parse(parseCookies(cookieHeader || '').apiKeys || '{}');
|
||||||
const providerSettings: Record<string, IProviderSetting> = JSON.parse(
|
const providerSettings: Record<string, IProviderSetting> = JSON.parse(
|
||||||
parseCookies(cookieHeader || '').providers || '{}',
|
parseCookies(cookieHeader || '').providers || '{}',
|
||||||
@@ -45,12 +43,42 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
|
|||||||
|
|
||||||
const stream = new SwitchableStream();
|
const stream = new SwitchableStream();
|
||||||
|
|
||||||
|
const cumulativeUsage = {
|
||||||
|
completionTokens: 0,
|
||||||
|
promptTokens: 0,
|
||||||
|
totalTokens: 0,
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options: StreamingOptions = {
|
const options: StreamingOptions = {
|
||||||
toolChoice: 'none',
|
toolChoice: 'none',
|
||||||
onFinish: async ({ text: content, finishReason }) => {
|
onFinish: async ({ text: content, finishReason, usage }) => {
|
||||||
|
console.log('usage', usage);
|
||||||
|
|
||||||
|
if (usage) {
|
||||||
|
cumulativeUsage.completionTokens += usage.completionTokens || 0;
|
||||||
|
cumulativeUsage.promptTokens += usage.promptTokens || 0;
|
||||||
|
cumulativeUsage.totalTokens += usage.totalTokens || 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (finishReason !== 'length') {
|
if (finishReason !== 'length') {
|
||||||
return stream.close();
|
return stream
|
||||||
|
.switchSource(
|
||||||
|
createDataStream({
|
||||||
|
async execute(dataStream) {
|
||||||
|
dataStream.writeMessageAnnotation({
|
||||||
|
type: 'usage',
|
||||||
|
value: {
|
||||||
|
completionTokens: cumulativeUsage.completionTokens,
|
||||||
|
promptTokens: cumulativeUsage.promptTokens,
|
||||||
|
totalTokens: cumulativeUsage.totalTokens,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onError: (error: any) => `Custom error: ${error.message}`,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.then(() => stream.close());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.switches >= MAX_RESPONSE_SEGMENTS) {
|
if (stream.switches >= MAX_RESPONSE_SEGMENTS) {
|
||||||
@@ -64,15 +92,31 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
|
|||||||
messages.push({ role: 'assistant', content });
|
messages.push({ role: 'assistant', content });
|
||||||
messages.push({ role: 'user', content: CONTINUE_PROMPT });
|
messages.push({ role: 'user', content: CONTINUE_PROMPT });
|
||||||
|
|
||||||
const result = await streamText({ messages, env: context.cloudflare.env, options, apiKeys, providerSettings });
|
const result = await streamText({
|
||||||
|
messages,
|
||||||
|
env: context.cloudflare.env,
|
||||||
|
options,
|
||||||
|
apiKeys,
|
||||||
|
files,
|
||||||
|
providerSettings,
|
||||||
|
promptId,
|
||||||
|
});
|
||||||
|
|
||||||
return stream.switchSource(result.toAIStream());
|
return stream.switchSource(result.toDataStream());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await streamText({ messages, env: context.cloudflare.env, options, apiKeys, providerSettings });
|
const result = await streamText({
|
||||||
|
messages,
|
||||||
|
env: context.cloudflare.env,
|
||||||
|
options,
|
||||||
|
apiKeys,
|
||||||
|
files,
|
||||||
|
providerSettings,
|
||||||
|
promptId,
|
||||||
|
});
|
||||||
|
|
||||||
stream.switchSource(result.toAIStream());
|
stream.switchSource(result.toDataStream());
|
||||||
|
|
||||||
return new Response(stream.readable, {
|
return new Response(stream.readable, {
|
||||||
status: 200,
|
status: 200,
|
||||||
@@ -81,7 +125,7 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
|
|
||||||
if (error.message?.includes('API key')) {
|
if (error.message?.includes('API key')) {
|
||||||
throw new Response('Invalid or missing API key', {
|
throw new Response('Invalid or missing API key', {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { type ActionFunctionArgs } from '@remix-run/cloudflare';
|
import { type ActionFunctionArgs } from '@remix-run/cloudflare';
|
||||||
import { StreamingTextResponse, parseStreamPart } from 'ai';
|
|
||||||
|
//import { StreamingTextResponse, parseStreamPart } from 'ai';
|
||||||
import { streamText } from '~/lib/.server/llm/stream-text';
|
import { streamText } from '~/lib/.server/llm/stream-text';
|
||||||
import { stripIndents } from '~/utils/stripIndent';
|
import { stripIndents } from '~/utils/stripIndent';
|
||||||
import type { IProviderSetting, ProviderInfo } from '~/types/model';
|
import type { IProviderSetting, ProviderInfo } from '~/types/model';
|
||||||
@@ -86,7 +87,7 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
|
|||||||
- Use professional language
|
- Use professional language
|
||||||
|
|
||||||
For invalid or unclear prompts:
|
For invalid or unclear prompts:
|
||||||
- Respond with a clear, professional guidance message
|
- Respond with clear, professional guidance
|
||||||
- Keep responses concise and actionable
|
- Keep responses concise and actionable
|
||||||
- Maintain a helpful, constructive tone
|
- Maintain a helpful, constructive tone
|
||||||
- Focus on what the user should provide
|
- Focus on what the user should provide
|
||||||
@@ -113,7 +114,7 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
|
|||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
try {
|
try {
|
||||||
const parsed = parseStreamPart(line);
|
const parsed = JSON.parse(line);
|
||||||
|
|
||||||
if (parsed.type === 'text') {
|
if (parsed.type === 'text') {
|
||||||
controller.enqueue(encoder.encode(parsed.value));
|
controller.enqueue(encoder.encode(parsed.value));
|
||||||
@@ -128,7 +129,12 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
|
|||||||
|
|
||||||
const transformedStream = result.toDataStream().pipeThrough(transformStream);
|
const transformedStream = result.toDataStream().pipeThrough(transformStream);
|
||||||
|
|
||||||
return new StreamingTextResponse(transformedStream);
|
return new Response(transformedStream, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain; charset=utf-8',
|
||||||
|
},
|
||||||
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ClientOnly } from 'remix-utils/client-only';
|
|||||||
import { BaseChat } from '~/components/chat/BaseChat';
|
import { BaseChat } from '~/components/chat/BaseChat';
|
||||||
import { GitUrlImport } from '~/components/git/GitUrlImport.client';
|
import { GitUrlImport } from '~/components/git/GitUrlImport.client';
|
||||||
import { Header } from '~/components/header/Header';
|
import { Header } from '~/components/header/Header';
|
||||||
|
import BackgroundRays from '~/components/ui/BackgroundRays';
|
||||||
|
|
||||||
export const meta: MetaFunction = () => {
|
export const meta: MetaFunction = () => {
|
||||||
return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }];
|
return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }];
|
||||||
@@ -15,7 +16,8 @@ export async function loader(args: LoaderFunctionArgs) {
|
|||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full w-full">
|
<div className="flex flex-col h-full w-full bg-bolt-elements-background-depth-1">
|
||||||
|
<BackgroundRays />
|
||||||
<Header />
|
<Header />
|
||||||
<ClientOnly fallback={<BaseChat />}>{() => <GitUrlImport />}</ClientOnly>
|
<ClientOnly fallback={<BaseChat />}>{() => <GitUrlImport />}</ClientOnly>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
8
app/types/global.d.ts
vendored
@@ -3,3 +3,11 @@ interface Window {
|
|||||||
webkitSpeechRecognition: typeof SpeechRecognition;
|
webkitSpeechRecognition: typeof SpeechRecognition;
|
||||||
SpeechRecognition: typeof SpeechRecognition;
|
SpeechRecognition: typeof SpeechRecognition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Performance {
|
||||||
|
memory?: {
|
||||||
|
jsHeapSizeLimit: number;
|
||||||
|
totalJSHeapSize: number;
|
||||||
|
usedJSHeapSize: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Cookies from 'js-cookie';
|
|||||||
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
||||||
import type { ProviderInfo, IProviderSetting } from '~/types/model';
|
import type { ProviderInfo, IProviderSetting } from '~/types/model';
|
||||||
import { createScopedLogger } from './logger';
|
import { createScopedLogger } from './logger';
|
||||||
|
import { logStore } from '~/lib/stores/logs';
|
||||||
|
|
||||||
export const WORK_DIR_NAME = 'project';
|
export const WORK_DIR_NAME = 'project';
|
||||||
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
||||||
@@ -138,11 +139,12 @@ const PROVIDER_LIST: ProviderInfo[] = [
|
|||||||
{
|
{
|
||||||
name: 'Groq',
|
name: 'Groq',
|
||||||
staticModels: [
|
staticModels: [
|
||||||
{ name: 'llama-3.1-70b-versatile', label: 'Llama 3.1 70b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
|
||||||
{ name: 'llama-3.1-8b-instant', label: 'Llama 3.1 8b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
{ name: 'llama-3.1-8b-instant', label: 'Llama 3.1 8b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
||||||
{ name: 'llama-3.2-11b-vision-preview', label: 'Llama 3.2 11b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
{ name: 'llama-3.2-11b-vision-preview', label: 'Llama 3.2 11b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
||||||
|
{ name: 'llama-3.2-90b-vision-preview', label: 'Llama 3.2 90b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
||||||
{ name: 'llama-3.2-3b-preview', label: 'Llama 3.2 3b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
{ name: 'llama-3.2-3b-preview', label: 'Llama 3.2 3b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
||||||
{ name: 'llama-3.2-1b-preview', label: 'Llama 3.2 1b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
{ name: 'llama-3.2-1b-preview', label: 'Llama 3.2 1b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
||||||
|
{ name: 'llama-3.3-70b-versatile', label: 'Llama 3.3 70b (Groq)', provider: 'Groq', maxTokenAllowed: 8000 },
|
||||||
],
|
],
|
||||||
getApiKeyLink: 'https://console.groq.com/keys',
|
getApiKeyLink: 'https://console.groq.com/keys',
|
||||||
},
|
},
|
||||||
@@ -291,6 +293,30 @@ const PROVIDER_LIST: ProviderInfo[] = [
|
|||||||
],
|
],
|
||||||
getApiKeyLink: 'https://api.together.xyz/settings/api-keys',
|
getApiKeyLink: 'https://api.together.xyz/settings/api-keys',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Perplexity',
|
||||||
|
staticModels: [
|
||||||
|
{
|
||||||
|
name: 'llama-3.1-sonar-small-128k-online',
|
||||||
|
label: 'Sonar Small Online',
|
||||||
|
provider: 'Perplexity',
|
||||||
|
maxTokenAllowed: 8192,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'llama-3.1-sonar-large-128k-online',
|
||||||
|
label: 'Sonar Large Online',
|
||||||
|
provider: 'Perplexity',
|
||||||
|
maxTokenAllowed: 8192,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'llama-3.1-sonar-huge-128k-online',
|
||||||
|
label: 'Sonar Huge Online',
|
||||||
|
provider: 'Perplexity',
|
||||||
|
maxTokenAllowed: 8192,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
getApiKeyLink: 'https://www.perplexity.ai/settings/api',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const DEFAULT_PROVIDER = PROVIDER_LIST[0];
|
export const DEFAULT_PROVIDER = PROVIDER_LIST[0];
|
||||||
@@ -373,12 +399,6 @@ const getOllamaBaseUrl = (settings?: IProviderSetting) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function getOllamaModels(apiKeys?: Record<string, string>, settings?: IProviderSetting): Promise<ModelInfo[]> {
|
async function getOllamaModels(apiKeys?: Record<string, string>, settings?: IProviderSetting): Promise<ModelInfo[]> {
|
||||||
/*
|
|
||||||
* if (typeof window === 'undefined') {
|
|
||||||
* return [];
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const baseUrl = getOllamaBaseUrl(settings);
|
const baseUrl = getOllamaBaseUrl(settings);
|
||||||
const response = await fetch(`${baseUrl}/api/tags`);
|
const response = await fetch(`${baseUrl}/api/tags`);
|
||||||
@@ -391,7 +411,9 @@ async function getOllamaModels(apiKeys?: Record<string, string>, settings?: IPro
|
|||||||
maxTokenAllowed: 8000,
|
maxTokenAllowed: 8000,
|
||||||
}));
|
}));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
logStore.logError('Failed to get Ollama models', e, { baseUrl: settings?.baseUrl });
|
||||||
logger.warn('Failed to get Ollama models: ', e.message || '');
|
logger.warn('Failed to get Ollama models: ', e.message || '');
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,10 +487,6 @@ async function getOpenRouterModels(): Promise<ModelInfo[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getLMStudioModels(_apiKeys?: Record<string, string>, settings?: IProviderSetting): Promise<ModelInfo[]> {
|
async function getLMStudioModels(_apiKeys?: Record<string, string>, settings?: IProviderSetting): Promise<ModelInfo[]> {
|
||||||
if (typeof window === 'undefined') {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const baseUrl = settings?.baseUrl || import.meta.env.LMSTUDIO_API_BASE_URL || 'http://localhost:1234';
|
const baseUrl = settings?.baseUrl || import.meta.env.LMSTUDIO_API_BASE_URL || 'http://localhost:1234';
|
||||||
const response = await fetch(`${baseUrl}/v1/models`);
|
const response = await fetch(`${baseUrl}/v1/models`);
|
||||||
@@ -480,7 +498,7 @@ async function getLMStudioModels(_apiKeys?: Record<string, string>, settings?: I
|
|||||||
provider: 'LMStudio',
|
provider: 'LMStudio',
|
||||||
}));
|
}));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.warn('Failed to get LMStudio models: ', e.message || '');
|
logStore.logError('Failed to get LMStudio models', e, { baseUrl: settings?.baseUrl });
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,6 +517,7 @@ async function initializeModelList(providerSettings?: Record<string, IProviderSe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
logStore.logError('Failed to fetch API keys from cookies', error);
|
||||||
logger.warn(`Failed to fetch apikeys from cookies: ${error?.message}`);
|
logger.warn(`Failed to fetch apikeys from cookies: ${error?.message}`);
|
||||||
}
|
}
|
||||||
MODEL_LIST = [
|
MODEL_LIST = [
|
||||||
|
|||||||
49
app/utils/sampler.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Creates a function that samples calls at regular intervals and captures trailing calls.
|
||||||
|
* - Drops calls that occur between sampling intervals
|
||||||
|
* - Takes one call per sampling interval if available
|
||||||
|
* - Captures the last call if no call was made during the interval
|
||||||
|
*
|
||||||
|
* @param fn The function to sample
|
||||||
|
* @param sampleInterval How often to sample calls (in ms)
|
||||||
|
* @returns The sampled function
|
||||||
|
*/
|
||||||
|
export function createSampler<T extends (...args: any[]) => any>(fn: T, sampleInterval: number): T {
|
||||||
|
let lastArgs: Parameters<T> | null = null;
|
||||||
|
let lastTime = 0;
|
||||||
|
let timeout: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
|
// Create a function with the same type as the input function
|
||||||
|
const sampled = function (this: any, ...args: Parameters<T>) {
|
||||||
|
const now = Date.now();
|
||||||
|
lastArgs = args;
|
||||||
|
|
||||||
|
// If we're within the sample interval, just store the args
|
||||||
|
if (now - lastTime < sampleInterval) {
|
||||||
|
// Set up trailing call if not already set
|
||||||
|
if (!timeout) {
|
||||||
|
timeout = setTimeout(
|
||||||
|
() => {
|
||||||
|
timeout = null;
|
||||||
|
lastTime = Date.now();
|
||||||
|
|
||||||
|
if (lastArgs) {
|
||||||
|
fn.apply(this, lastArgs);
|
||||||
|
lastArgs = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sampleInterval - (now - lastTime),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're outside the interval, execute immediately
|
||||||
|
lastTime = now;
|
||||||
|
fn.apply(this, args);
|
||||||
|
lastArgs = null;
|
||||||
|
} as T;
|
||||||
|
|
||||||
|
return sampled;
|
||||||
|
}
|
||||||
1015
changelog.md
@@ -1,11 +1,5 @@
|
|||||||
# Contribution Guidelines
|
# Contribution Guidelines
|
||||||
|
|
||||||
## DEFAULT_NUM_CTX
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## 📋 Table of Contents
|
## 📋 Table of Contents
|
||||||
- [Code of Conduct](#code-of-conduct)
|
- [Code of Conduct](#code-of-conduct)
|
||||||
- [How Can I Contribute?](#how-can-i-contribute)
|
- [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
|
|||||||
- [Development Setup](#development-setup)
|
- [Development Setup](#development-setup)
|
||||||
- [Deploymnt with Docker](#docker-deployment-documentation)
|
- [Deploymnt with Docker](#docker-deployment-documentation)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## How Can I Contribute?
|
## How Can I Contribute?
|
||||||
|
|
||||||
### 🐞 Reporting Bugs and Feature Requests
|
### 🐞 Reporting Bugs and Feature Requests
|
||||||
@@ -35,6 +33,8 @@ This project and everyone participating in it is governed by our Code of Conduct
|
|||||||
### ✨ Becoming a Core Contributor
|
### ✨ Becoming a Core Contributor
|
||||||
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).
|
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).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Pull Request Guidelines
|
## Pull Request Guidelines
|
||||||
|
|
||||||
### 📝 PR Checklist
|
### 📝 PR Checklist
|
||||||
@@ -49,6 +49,8 @@ We're looking for dedicated contributors to help maintain and grow this project.
|
|||||||
3. Address all review comments
|
3. Address all review comments
|
||||||
4. Maintain clean commit history
|
4. Maintain clean commit history
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Coding Standards
|
## Coding Standards
|
||||||
|
|
||||||
### 💻 General Guidelines
|
### 💻 General Guidelines
|
||||||
@@ -57,6 +59,8 @@ We're looking for dedicated contributors to help maintain and grow this project.
|
|||||||
- Keep functions focused and small
|
- Keep functions focused and small
|
||||||
- Use meaningful variable names
|
- Use meaningful variable names
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Development Setup
|
## Development Setup
|
||||||
|
|
||||||
### 🔄 Initial Setup
|
### 🔄 Initial Setup
|
||||||
@@ -106,6 +110,8 @@ pnpm run dev
|
|||||||
|
|
||||||
**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.
|
**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.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Run the test suite with:
|
Run the test suite with:
|
||||||
@@ -114,6 +120,8 @@ Run the test suite with:
|
|||||||
pnpm test
|
pnpm test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
To deploy the application to Cloudflare Pages:
|
To deploy the application to Cloudflare Pages:
|
||||||
@@ -124,6 +132,8 @@ pnpm run deploy
|
|||||||
|
|
||||||
Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account.
|
Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# Docker Deployment Documentation
|
# Docker Deployment Documentation
|
||||||
|
|
||||||
This guide outlines various methods for building and deploying the application using Docker.
|
This guide outlines various methods for building and deploying the application using Docker.
|
||||||
@@ -166,6 +176,8 @@ docker-compose --profile development up
|
|||||||
docker-compose --profile production up
|
docker-compose --profile production up
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Running the Application
|
## Running the Application
|
||||||
|
|
||||||
After building using any of the methods above, run the container with:
|
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
|
|||||||
docker run -p 5173:5173 --env-file .env.local bolt-ai:production
|
docker run -p 5173:5173 --env-file .env.local bolt-ai:production
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Deployment with Coolify
|
## Deployment with Coolify
|
||||||
|
|
||||||
[Coolify](https://github.com/coollabsio/coolify) provides a straightforward deployment process:
|
[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
|
|||||||
- Adjust other environment variables as needed
|
- Adjust other environment variables as needed
|
||||||
7. Deploy the application
|
7. Deploy the application
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## VS Code Integration
|
## VS Code Integration
|
||||||
|
|
||||||
The `docker-compose.yaml` configuration is compatible with VS Code dev containers:
|
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
|
|||||||
2. Select the dev container configuration
|
2. Select the dev container configuration
|
||||||
3. Choose the "development" profile from the context menu
|
3. Choose the "development" profile from the context menu
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Environment Files
|
## Environment Files
|
||||||
|
|
||||||
Ensure you have the appropriate `.env.local` file configured before running the containers. This file should contain:
|
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
|
|||||||
- Environment-specific configurations
|
- Environment-specific configurations
|
||||||
- Other required environment variables
|
- Other required environment variables
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DEFAULT_NUM_CTX
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Port 5173 is exposed and mapped for both development and production environments
|
- Port 5173 is exposed and mapped for both development and production environments
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
# Frequently Asked Questions (FAQ)
|
# Frequently Asked Questions (FAQ)
|
||||||
|
|
||||||
## How do I get the best results with Bolt.diy?
|
## How do I get the best results with bolt.diy?
|
||||||
|
|
||||||
- **Be specific about your stack**:
|
- **Be specific about your stack**:
|
||||||
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.
|
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.
|
||||||
|
|
||||||
- **Use the enhance prompt icon**:
|
- **Use the enhance prompt icon**:
|
||||||
Before sending your prompt, click the *enhance* icon to let the AI refine your prompt. You can edit the suggested improvements before submitting.
|
Before sending your prompt, click the *enhance* icon to let the AI refine your prompt. You can edit the suggested improvements before submitting.
|
||||||
|
|
||||||
- **Scaffold the basics first, then add features**:
|
- **Scaffold the basics first, then add features**:
|
||||||
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.
|
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.
|
||||||
|
|
||||||
- **Batch simple instructions**:
|
- **Batch simple instructions**:
|
||||||
Combine simple tasks into a single prompt to save time and reduce API credit consumption. For example:
|
Combine simple tasks into a single prompt to save time and reduce API credit consumption. For example:
|
||||||
@@ -17,14 +17,13 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## How do I contribute to Bolt.diy?
|
## How do I contribute to bolt.diy?
|
||||||
|
|
||||||
Check out our [Contribution Guide](CONTRIBUTING.md) for more details on how to get involved!
|
Check out our [Contribution Guide](CONTRIBUTING.md) for more details on how to get involved!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## What are the future plans for bolt.diy?
|
||||||
## What are the future plans for Bolt.diy?
|
|
||||||
|
|
||||||
Visit our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo) for the latest updates.
|
Visit our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo) for the latest updates.
|
||||||
New features and improvements are on the way!
|
New features and improvements are on the way!
|
||||||
@@ -33,13 +32,13 @@ New features and improvements are on the way!
|
|||||||
|
|
||||||
## Why are there so many open issues/pull requests?
|
## Why are there so many open issues/pull requests?
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## How do local LLMs compare to larger models like Claude 3.5 Sonnet for Bolt.diy?
|
## How do local LLMs compare to larger models like Claude 3.5 Sonnet for bolt.diy?
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,46 @@
|
|||||||
# Welcome to Bolt DIY
|
# Welcome to bolt diy
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Join the community!
|
---
|
||||||
|
|
||||||
https://thinktank.ottomator.ai
|
## Join the community!
|
||||||
|
|
||||||
## Whats Bolt.diy
|
[Join the community!](https://thinktank.ottomator.ai)
|
||||||
|
|
||||||
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)
|
---
|
||||||
|
|
||||||
## What Makes Bolt.diy Different
|
## Whats bolt.diy
|
||||||
|
|
||||||
Claude, v0, etc are incredible- but you can't install packages, run backends, or edit code. That’s where Bolt.diy stands out:
|
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)
|
||||||
|
|
||||||
- **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:
|
---
|
||||||
|
|
||||||
|
## What Makes bolt.diy Different
|
||||||
|
|
||||||
|
Claude, v0, etc are incredible- but you can't install packages, run backends, or edit code. That’s where bolt.diy stands out:
|
||||||
|
|
||||||
|
- **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:
|
||||||
- Install and run npm tools and libraries (like Vite, Next.js, and more)
|
- Install and run npm tools and libraries (like Vite, Next.js, and more)
|
||||||
- Run Node.js servers
|
- Run Node.js servers
|
||||||
- Interact with third-party APIs
|
- Interact with third-party APIs
|
||||||
- Deploy to production from chat
|
- Deploy to production from chat
|
||||||
- Share your work via a URL
|
- Share your work via a URL
|
||||||
|
|
||||||
- **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.
|
- **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.
|
||||||
|
|
||||||
Whether you’re an experienced developer, a PM, or a designer, Bolt.diy allows you to easily build production-grade full-stack applications.
|
Whether you’re an experienced developer, a PM, or a designer, bolt.diy allows you to easily build production-grade full-stack applications.
|
||||||
|
|
||||||
For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo!
|
For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
1. Install Git from https://git-scm.com/downloads
|
1. [Install Git from](https://git-scm.com/downloads)
|
||||||
|
|
||||||
2. Install Node.js from https://nodejs.org/en/download/
|
2. [Install Node.js from](https://nodejs.org/en/download/)
|
||||||
|
|
||||||
Pay attention to the installer notes after completion.
|
Pay attention to the installer notes after completion.
|
||||||
|
|
||||||
@@ -62,11 +70,11 @@ defaults write com.apple.finder AppleShowAllFiles YES
|
|||||||
|
|
||||||
**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:
|
**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:
|
||||||
|
|
||||||
Get your GROQ API Key here: https://console.groq.com/keys
|
[Get your GROQ API Key here](https://console.groq.com/keys)
|
||||||
|
|
||||||
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
|
[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)
|
||||||
|
|
||||||
Get your Anthropic API Key in your account settings: https://console.anthropic.com/settings/keys
|
Get your Anthropic API Key in your [account settings](https://console.anthropic.com/settings/keys)
|
||||||
|
|
||||||
```
|
```
|
||||||
GROQ_API_KEY=XXX
|
GROQ_API_KEY=XXX
|
||||||
@@ -128,6 +136,8 @@ When you run the Docker Compose command with the development profile, any change
|
|||||||
make on your machine to the code will automatically be reflected in the site running
|
make on your machine to the code will automatically be reflected in the site running
|
||||||
on the container (i.e. hot reloading still applies!).
|
on the container (i.e. hot reloading still applies!).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Run Without Docker
|
## Run Without Docker
|
||||||
|
|
||||||
1. Install dependencies using Terminal (or CMD in Windows with admin permissions):
|
1. Install dependencies using Terminal (or CMD in Windows with admin permissions):
|
||||||
@@ -148,14 +158,18 @@ sudo npm install -g pnpm
|
|||||||
pnpm run dev
|
pnpm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Adding New LLMs:
|
## Adding New LLMs:
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Available Scripts
|
## Available Scripts
|
||||||
|
|
||||||
- `pnpm run dev`: Starts the development server.
|
- `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
|
|||||||
- `pnpm run typegen`: Generates TypeScript types using Wrangler.
|
- `pnpm run typegen`: Generates TypeScript types using Wrangler.
|
||||||
- `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
|
- `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
To start the development server:
|
To start the development server:
|
||||||
@@ -177,9 +193,11 @@ pnpm run dev
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Tips and Tricks
|
## Tips and Tricks
|
||||||
|
|
||||||
Here are some tips to get the most out of Bolt.diy:
|
Here are some tips to get the most out of bolt.diy:
|
||||||
|
|
||||||
- **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.
|
- **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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
site_name: Bolt.diy Docs
|
site_name: bolt.diy Docs
|
||||||
site_dir: ../site
|
site_dir: ../site
|
||||||
theme:
|
theme:
|
||||||
name: material
|
name: material
|
||||||
@@ -31,7 +31,7 @@ theme:
|
|||||||
repo: fontawesome/brands/github
|
repo: fontawesome/brands/github
|
||||||
# logo: assets/logo.png
|
# logo: assets/logo.png
|
||||||
# favicon: assets/logo.png
|
# favicon: assets/logo.png
|
||||||
repo_name: Bolt.diy
|
repo_name: bolt.diy
|
||||||
repo_url: https://github.com/stackblitz-labs/bolt.diy
|
repo_url: https://github.com/stackblitz-labs/bolt.diy
|
||||||
edit_uri: ""
|
edit_uri: ""
|
||||||
|
|
||||||
@@ -40,16 +40,16 @@ extra:
|
|||||||
social:
|
social:
|
||||||
- icon: fontawesome/brands/github
|
- icon: fontawesome/brands/github
|
||||||
link: https://github.com/stackblitz-labs/bolt.diy
|
link: https://github.com/stackblitz-labs/bolt.diy
|
||||||
name: Bolt.diy
|
name: bolt.diy
|
||||||
- icon: fontawesome/brands/discourse
|
- icon: fontawesome/brands/discourse
|
||||||
link: https://thinktank.ottomator.ai/
|
link: https://thinktank.ottomator.ai/
|
||||||
name: Bolt.diy Discourse
|
name: bolt.diy Discourse
|
||||||
- icon: fontawesome/brands/x-twitter
|
- icon: fontawesome/brands/x-twitter
|
||||||
link: https://x.com/bolt_diy
|
link: https://x.com/bolt_diy
|
||||||
name: Bolt.diy on X
|
name: bolt.diy on X
|
||||||
- icon: fontawesome/brands/bluesky
|
- icon: fontawesome/brands/bluesky
|
||||||
link: https://bsky.app/profile/bolt.diy
|
link: https://bsky.app/profile/bolt.diy
|
||||||
name: Bolt.diy on Bluesky
|
name: bolt.diy on Bluesky
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"deploy": "npm run build && wrangler pages deploy",
|
"deploy": "npm run build && wrangler pages deploy",
|
||||||
"build": "remix vite:build",
|
"build": "remix vite:build",
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
"@octokit/rest": "^21.0.2",
|
"@octokit/rest": "^21.0.2",
|
||||||
"@octokit/types": "^13.6.2",
|
"@octokit/types": "^13.6.2",
|
||||||
"@openrouter/ai-sdk-provider": "^0.0.5",
|
"@openrouter/ai-sdk-provider": "^0.0.5",
|
||||||
|
"@radix-ui/react-context-menu": "^2.2.2",
|
||||||
"@radix-ui/react-dialog": "^1.1.2",
|
"@radix-ui/react-dialog": "^1.1.2",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
||||||
"@radix-ui/react-separator": "^1.1.0",
|
"@radix-ui/react-separator": "^1.1.0",
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
"@xterm/addon-fit": "^0.10.0",
|
"@xterm/addon-fit": "^0.10.0",
|
||||||
"@xterm/addon-web-links": "^0.11.0",
|
"@xterm/addon-web-links": "^0.11.0",
|
||||||
"@xterm/xterm": "^5.5.0",
|
"@xterm/xterm": "^5.5.0",
|
||||||
"ai": "^3.4.33",
|
"ai": "^4.0.13",
|
||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
"diff": "^5.2.0",
|
"diff": "^5.2.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
|||||||
385
pnpm-lock.yaml
generated
@@ -95,6 +95,9 @@ importers:
|
|||||||
'@openrouter/ai-sdk-provider':
|
'@openrouter/ai-sdk-provider':
|
||||||
specifier: ^0.0.5
|
specifier: ^0.0.5
|
||||||
version: 0.0.5(zod@3.23.8)
|
version: 0.0.5(zod@3.23.8)
|
||||||
|
'@radix-ui/react-context-menu':
|
||||||
|
specifier: ^2.2.2
|
||||||
|
version: 2.2.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
'@radix-ui/react-dialog':
|
'@radix-ui/react-dialog':
|
||||||
specifier: ^1.1.2
|
specifier: ^1.1.2
|
||||||
version: 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@@ -138,8 +141,8 @@ importers:
|
|||||||
specifier: ^5.5.0
|
specifier: ^5.5.0
|
||||||
version: 5.5.0
|
version: 5.5.0
|
||||||
ai:
|
ai:
|
||||||
specifier: ^3.4.33
|
specifier: ^4.0.13
|
||||||
version: 3.4.33(react@18.3.1)(sswr@2.1.0(svelte@5.4.0))(svelte@5.4.0)(vue@3.5.13(typescript@5.7.2))(zod@3.23.8)
|
version: 4.0.18(react@18.3.1)(zod@3.23.8)
|
||||||
date-fns:
|
date-fns:
|
||||||
specifier: ^3.6.0
|
specifier: ^3.6.0
|
||||||
version: 3.6.0
|
version: 3.6.0
|
||||||
@@ -348,15 +351,6 @@ packages:
|
|||||||
zod:
|
zod:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@ai-sdk/provider-utils@1.0.22':
|
|
||||||
resolution: {integrity: sha512-YHK2rpj++wnLVc9vPGzGFP3Pjeld2MwhKinetA0zKXOoHAT/Jit5O8kZsxcSlJPu9wvcGT1UGZEjZrtO7PfFOQ==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
peerDependencies:
|
|
||||||
zod: ^3.0.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
zod:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@ai-sdk/provider-utils@1.0.9':
|
'@ai-sdk/provider-utils@1.0.9':
|
||||||
resolution: {integrity: sha512-yfdanjUiCJbtGoRGXrcrmXn0pTyDfRIeY6ozDG96D66f2wupZaZvAgKptUa3zDYXtUCQQvcNJ+tipBBfQD/UYA==}
|
resolution: {integrity: sha512-yfdanjUiCJbtGoRGXrcrmXn0pTyDfRIeY6ozDG96D66f2wupZaZvAgKptUa3zDYXtUCQQvcNJ+tipBBfQD/UYA==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
@@ -375,6 +369,15 @@ packages:
|
|||||||
zod:
|
zod:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@ai-sdk/provider-utils@2.0.4':
|
||||||
|
resolution: {integrity: sha512-GMhcQCZbwM6RoZCri0MWeEWXRt/T+uCxsmHEsTwNvEH3GDjNzchfX25C8ftry2MeEOOn6KfqCLSKomcgK6RoOg==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
peerDependencies:
|
||||||
|
zod: ^3.0.0
|
||||||
|
peerDependenciesMeta:
|
||||||
|
zod:
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@ai-sdk/provider@0.0.12':
|
'@ai-sdk/provider@0.0.12':
|
||||||
resolution: {integrity: sha512-oOwPQD8i2Ynpn22cur4sk26FW3mSy6t6/X/K1Ay2yGBKYiSpRyLfObhOrZEGsXDx+3euKy4nEZ193R36NM+tpQ==}
|
resolution: {integrity: sha512-oOwPQD8i2Ynpn22cur4sk26FW3mSy6t6/X/K1Ay2yGBKYiSpRyLfObhOrZEGsXDx+3euKy4nEZ193R36NM+tpQ==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
@@ -387,16 +390,16 @@ packages:
|
|||||||
resolution: {integrity: sha512-XMsNGJdGO+L0cxhhegtqZ8+T6nn4EoShS819OvCgI2kLbYTIvk0GWFGD0AXJmxkxs3DrpsJxKAFukFR7bvTkgQ==}
|
resolution: {integrity: sha512-XMsNGJdGO+L0cxhhegtqZ8+T6nn4EoShS819OvCgI2kLbYTIvk0GWFGD0AXJmxkxs3DrpsJxKAFukFR7bvTkgQ==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
'@ai-sdk/provider@0.0.26':
|
|
||||||
resolution: {integrity: sha512-dQkfBDs2lTYpKM8389oopPdQgIU007GQyCbuPPrV+K6MtSII3HBfE0stUIMXUb44L+LK1t6GXPP7wjSzjO6uKg==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
|
|
||||||
'@ai-sdk/provider@1.0.1':
|
'@ai-sdk/provider@1.0.1':
|
||||||
resolution: {integrity: sha512-mV+3iNDkzUsZ0pR2jG0sVzU6xtQY5DtSCBy3JFycLp6PwjyLw/iodfL3MwdmMCRJWgs3dadcHejRnMvF9nGTBg==}
|
resolution: {integrity: sha512-mV+3iNDkzUsZ0pR2jG0sVzU6xtQY5DtSCBy3JFycLp6PwjyLw/iodfL3MwdmMCRJWgs3dadcHejRnMvF9nGTBg==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
'@ai-sdk/react@0.0.70':
|
'@ai-sdk/provider@1.0.2':
|
||||||
resolution: {integrity: sha512-GnwbtjW4/4z7MleLiW+TOZC2M29eCg1tOUpuEiYFMmFNZK8mkrqM0PFZMo6UsYeUYMWqEOOcPOU9OQVJMJh7IQ==}
|
resolution: {integrity: sha512-YYtP6xWQyaAf5LiWLJ+ycGTOeBLWrED7LUrvc+SQIWhGaneylqbaGsyQL7VouQUeQ4JZ1qKYZuhmi3W56HADPA==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
'@ai-sdk/react@1.0.6':
|
||||||
|
resolution: {integrity: sha512-8Hkserq0Ge6AEi7N4hlv2FkfglAGbkoAXEZ8YSp255c3PbnZz6+/5fppw+aROmZMOfNwallSRuy1i/iPa2rBpQ==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^18 || ^19 || ^19.0.0-rc
|
react: ^18 || ^19 || ^19.0.0-rc
|
||||||
@@ -407,26 +410,8 @@ packages:
|
|||||||
zod:
|
zod:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@ai-sdk/solid@0.0.54':
|
'@ai-sdk/ui-utils@1.0.5':
|
||||||
resolution: {integrity: sha512-96KWTVK+opdFeRubqrgaJXoNiDP89gNxFRWUp0PJOotZW816AbhUf4EnDjBjXTLjXL1n0h8tGSE9sZsRkj9wQQ==}
|
resolution: {integrity: sha512-DGJSbDf+vJyWmFNexSPUsS1AAy7gtsmFmoSyNbNbJjwl9hRIf2dknfA1V0ahx6pg3NNklNYFm53L8Nphjovfvg==}
|
||||||
engines: {node: '>=18'}
|
|
||||||
peerDependencies:
|
|
||||||
solid-js: ^1.7.7
|
|
||||||
peerDependenciesMeta:
|
|
||||||
solid-js:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@ai-sdk/svelte@0.0.57':
|
|
||||||
resolution: {integrity: sha512-SyF9ItIR9ALP9yDNAD+2/5Vl1IT6kchgyDH8xkmhysfJI6WrvJbtO1wdQ0nylvPLcsPoYu+cAlz1krU4lFHcYw==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
peerDependencies:
|
|
||||||
svelte: ^3.0.0 || ^4.0.0 || ^5.0.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
svelte:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@ai-sdk/ui-utils@0.0.50':
|
|
||||||
resolution: {integrity: sha512-Z5QYJVW+5XpSaJ4jYCCAVG7zIAuKOOdikhgpksneNmKvx61ACFaf98pmOd+xnjahl0pIlc/QIe6O4yVaJ1sEaw==}
|
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
zod: ^3.0.0
|
zod: ^3.0.0
|
||||||
@@ -434,15 +419,6 @@ packages:
|
|||||||
zod:
|
zod:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@ai-sdk/vue@0.0.59':
|
|
||||||
resolution: {integrity: sha512-+ofYlnqdc8c4F6tM0IKF0+7NagZRAiqBJpGDJ+6EYhDW8FHLUP/JFBgu32SjxSxC6IKFZxEnl68ZoP/Z38EMlw==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
peerDependencies:
|
|
||||||
vue: ^3.3.4
|
|
||||||
peerDependenciesMeta:
|
|
||||||
vue:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@ampproject/remapping@2.3.0':
|
'@ampproject/remapping@2.3.0':
|
||||||
resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
|
resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
@@ -1557,6 +1533,19 @@ packages:
|
|||||||
'@types/react':
|
'@types/react':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@radix-ui/react-context-menu@2.2.2':
|
||||||
|
resolution: {integrity: sha512-99EatSTpW+hRYHt7m8wdDlLtkmTovEe8Z/hnxUPV+SKuuNL5HWNhQI4QSdjZqNSgXHay2z4M3Dym73j9p2Gx5Q==}
|
||||||
|
peerDependencies:
|
||||||
|
'@types/react': '*'
|
||||||
|
'@types/react-dom': '*'
|
||||||
|
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
|
||||||
|
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@types/react':
|
||||||
|
optional: true
|
||||||
|
'@types/react-dom':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@radix-ui/react-context@1.1.0':
|
'@radix-ui/react-context@1.1.0':
|
||||||
resolution: {integrity: sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==}
|
resolution: {integrity: sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -2354,35 +2343,6 @@ packages:
|
|||||||
'@vitest/utils@2.1.8':
|
'@vitest/utils@2.1.8':
|
||||||
resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==}
|
resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==}
|
||||||
|
|
||||||
'@vue/compiler-core@3.5.13':
|
|
||||||
resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==}
|
|
||||||
|
|
||||||
'@vue/compiler-dom@3.5.13':
|
|
||||||
resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==}
|
|
||||||
|
|
||||||
'@vue/compiler-sfc@3.5.13':
|
|
||||||
resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==}
|
|
||||||
|
|
||||||
'@vue/compiler-ssr@3.5.13':
|
|
||||||
resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==}
|
|
||||||
|
|
||||||
'@vue/reactivity@3.5.13':
|
|
||||||
resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==}
|
|
||||||
|
|
||||||
'@vue/runtime-core@3.5.13':
|
|
||||||
resolution: {integrity: sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==}
|
|
||||||
|
|
||||||
'@vue/runtime-dom@3.5.13':
|
|
||||||
resolution: {integrity: sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==}
|
|
||||||
|
|
||||||
'@vue/server-renderer@3.5.13':
|
|
||||||
resolution: {integrity: sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==}
|
|
||||||
peerDependencies:
|
|
||||||
vue: 3.5.13
|
|
||||||
|
|
||||||
'@vue/shared@3.5.13':
|
|
||||||
resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
|
|
||||||
|
|
||||||
'@web3-storage/multipart-parser@1.0.0':
|
'@web3-storage/multipart-parser@1.0.0':
|
||||||
resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==}
|
resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==}
|
||||||
|
|
||||||
@@ -2418,11 +2378,6 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
|
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||||
|
|
||||||
acorn-typescript@1.4.13:
|
|
||||||
resolution: {integrity: sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==}
|
|
||||||
peerDependencies:
|
|
||||||
acorn: '>=8.9.0'
|
|
||||||
|
|
||||||
acorn-walk@8.3.4:
|
acorn-walk@8.3.4:
|
||||||
resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==}
|
resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==}
|
||||||
engines: {node: '>=0.4.0'}
|
engines: {node: '>=0.4.0'}
|
||||||
@@ -2436,24 +2391,15 @@ packages:
|
|||||||
resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
|
resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
ai@3.4.33:
|
ai@4.0.18:
|
||||||
resolution: {integrity: sha512-plBlrVZKwPoRTmM8+D1sJac9Bq8eaa2jiZlHLZIWekKWI1yMWYZvCCEezY9ASPwRhULYDJB2VhKOBUUeg3S5JQ==}
|
resolution: {integrity: sha512-BTWzalLNE1LQphEka5xzJXDs5v4xXy1Uzr7dAVk+C/CnO3WNpuMBgrCymwUv0VrWaWc8xMQuh+OqsT7P7JyekQ==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
openai: ^4.42.0
|
|
||||||
react: ^18 || ^19 || ^19.0.0-rc
|
react: ^18 || ^19 || ^19.0.0-rc
|
||||||
sswr: ^2.1.0
|
|
||||||
svelte: ^3.0.0 || ^4.0.0 || ^5.0.0
|
|
||||||
zod: ^3.0.0
|
zod: ^3.0.0
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
openai:
|
|
||||||
optional: true
|
|
||||||
react:
|
react:
|
||||||
optional: true
|
optional: true
|
||||||
sswr:
|
|
||||||
optional: true
|
|
||||||
svelte:
|
|
||||||
optional: true
|
|
||||||
zod:
|
zod:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -2490,10 +2436,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==}
|
resolution: {integrity: sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
aria-query@5.3.2:
|
|
||||||
resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
array-flatten@1.1.1:
|
array-flatten@1.1.1:
|
||||||
resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}
|
resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==}
|
||||||
|
|
||||||
@@ -2521,10 +2463,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
|
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
axobject-query@4.1.0:
|
|
||||||
resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
|
|
||||||
engines: {node: '>= 0.4'}
|
|
||||||
|
|
||||||
bail@2.0.2:
|
bail@2.0.2:
|
||||||
resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
|
resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
|
||||||
|
|
||||||
@@ -3133,9 +3071,6 @@ packages:
|
|||||||
jiti:
|
jiti:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
esm-env@1.2.1:
|
|
||||||
resolution: {integrity: sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==}
|
|
||||||
|
|
||||||
espree@10.3.0:
|
espree@10.3.0:
|
||||||
resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==}
|
resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -3148,9 +3083,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
|
resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
|
||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
|
|
||||||
esrap@1.2.3:
|
|
||||||
resolution: {integrity: sha512-ZlQmCCK+n7SGoqo7DnfKaP1sJZa49P01/dXzmjCASSo04p72w8EksT2NMK8CEX8DhKsfJXANioIw8VyHNsBfvQ==}
|
|
||||||
|
|
||||||
esrecurse@4.3.0:
|
esrecurse@4.3.0:
|
||||||
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
||||||
engines: {node: '>=4.0'}
|
engines: {node: '>=4.0'}
|
||||||
@@ -3804,9 +3736,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==}
|
resolution: {integrity: sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
|
|
||||||
locate-character@3.0.0:
|
|
||||||
resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==}
|
|
||||||
|
|
||||||
locate-path@6.0.0:
|
locate-path@6.0.0:
|
||||||
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -5174,11 +5103,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==}
|
resolution: {integrity: sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==}
|
||||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||||
|
|
||||||
sswr@2.1.0:
|
|
||||||
resolution: {integrity: sha512-Cqc355SYlTAaUt8iDPaC/4DPPXK925PePLMxyBKuWd5kKc5mwsG3nT9+Mq2tyguL5s7b4Jg+IRMpTRsNTAfpSQ==}
|
|
||||||
peerDependencies:
|
|
||||||
svelte: ^4.0.0 || ^5.0.0-next.0
|
|
||||||
|
|
||||||
stackback@0.0.2:
|
stackback@0.0.2:
|
||||||
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
|
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
|
||||||
|
|
||||||
@@ -5269,23 +5193,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
svelte@5.4.0:
|
|
||||||
resolution: {integrity: sha512-2I/mjD8cXDpKfdfUK+T6yo/OzugMXIm8lhyJUFM5F/gICMYnkl3C/+4cOSpia8TqpDsi6Qfm5+fdmBNMNmaf2g==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
|
|
||||||
swr@2.2.5:
|
swr@2.2.5:
|
||||||
resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==}
|
resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^16.11.0 || ^17.0.0 || ^18.0.0
|
react: ^16.11.0 || ^17.0.0 || ^18.0.0
|
||||||
|
|
||||||
swrev@4.0.0:
|
|
||||||
resolution: {integrity: sha512-LqVcOHSB4cPGgitD1riJ1Hh4vdmITOp+BkmfmXRh4hSF/t7EnS4iD+SOTmq7w5pPm/SiPeto4ADbKS6dHUDWFA==}
|
|
||||||
|
|
||||||
swrv@1.0.4:
|
|
||||||
resolution: {integrity: sha512-zjEkcP8Ywmj+xOJW3lIT65ciY/4AL4e/Or7Gj0MzU3zBJNMdJiT8geVZhINavnlHRMMCcJLHhraLTAiDOTmQ9g==}
|
|
||||||
peerDependencies:
|
|
||||||
vue: '>=3.2.26 < 4'
|
|
||||||
|
|
||||||
sync-child-process@1.0.2:
|
sync-child-process@1.0.2:
|
||||||
resolution: {integrity: sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==}
|
resolution: {integrity: sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==}
|
||||||
engines: {node: '>=16.0.0'}
|
engines: {node: '>=16.0.0'}
|
||||||
@@ -5705,14 +5617,6 @@ packages:
|
|||||||
vm-browserify@1.1.2:
|
vm-browserify@1.1.2:
|
||||||
resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==}
|
resolution: {integrity: sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==}
|
||||||
|
|
||||||
vue@3.5.13:
|
|
||||||
resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==}
|
|
||||||
peerDependencies:
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
w3c-keyname@2.2.8:
|
w3c-keyname@2.2.8:
|
||||||
resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
|
resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
|
||||||
|
|
||||||
@@ -5827,9 +5731,6 @@ packages:
|
|||||||
youch@3.3.4:
|
youch@3.3.4:
|
||||||
resolution: {integrity: sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==}
|
resolution: {integrity: sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==}
|
||||||
|
|
||||||
zimmerframe@1.1.2:
|
|
||||||
resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==}
|
|
||||||
|
|
||||||
zod-to-json-schema@3.23.5:
|
zod-to-json-schema@3.23.5:
|
||||||
resolution: {integrity: sha512-5wlSS0bXfF/BrL4jPAbz9da5hDlDptdEppYfe+x4eIJ7jioqKG9uUxOwPzqof09u/XeVdrgFu29lZi+8XNDJtA==}
|
resolution: {integrity: sha512-5wlSS0bXfF/BrL4jPAbz9da5hDlDptdEppYfe+x4eIJ7jioqKG9uUxOwPzqof09u/XeVdrgFu29lZi+8XNDJtA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -5892,15 +5793,6 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
zod: 3.23.8
|
zod: 3.23.8
|
||||||
|
|
||||||
'@ai-sdk/provider-utils@1.0.22(zod@3.23.8)':
|
|
||||||
dependencies:
|
|
||||||
'@ai-sdk/provider': 0.0.26
|
|
||||||
eventsource-parser: 1.1.2
|
|
||||||
nanoid: 3.3.8
|
|
||||||
secure-json-parse: 2.7.0
|
|
||||||
optionalDependencies:
|
|
||||||
zod: 3.23.8
|
|
||||||
|
|
||||||
'@ai-sdk/provider-utils@1.0.9(zod@3.23.8)':
|
'@ai-sdk/provider-utils@1.0.9(zod@3.23.8)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ai-sdk/provider': 0.0.17
|
'@ai-sdk/provider': 0.0.17
|
||||||
@@ -5919,6 +5811,15 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
zod: 3.23.8
|
zod: 3.23.8
|
||||||
|
|
||||||
|
'@ai-sdk/provider-utils@2.0.4(zod@3.23.8)':
|
||||||
|
dependencies:
|
||||||
|
'@ai-sdk/provider': 1.0.2
|
||||||
|
eventsource-parser: 3.0.0
|
||||||
|
nanoid: 3.3.8
|
||||||
|
secure-json-parse: 2.7.0
|
||||||
|
optionalDependencies:
|
||||||
|
zod: 3.23.8
|
||||||
|
|
||||||
'@ai-sdk/provider@0.0.12':
|
'@ai-sdk/provider@0.0.12':
|
||||||
dependencies:
|
dependencies:
|
||||||
json-schema: 0.4.0
|
json-schema: 0.4.0
|
||||||
@@ -5931,61 +5832,32 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
json-schema: 0.4.0
|
json-schema: 0.4.0
|
||||||
|
|
||||||
'@ai-sdk/provider@0.0.26':
|
|
||||||
dependencies:
|
|
||||||
json-schema: 0.4.0
|
|
||||||
|
|
||||||
'@ai-sdk/provider@1.0.1':
|
'@ai-sdk/provider@1.0.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
json-schema: 0.4.0
|
json-schema: 0.4.0
|
||||||
|
|
||||||
'@ai-sdk/react@0.0.70(react@18.3.1)(zod@3.23.8)':
|
'@ai-sdk/provider@1.0.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ai-sdk/provider-utils': 1.0.22(zod@3.23.8)
|
json-schema: 0.4.0
|
||||||
'@ai-sdk/ui-utils': 0.0.50(zod@3.23.8)
|
|
||||||
|
'@ai-sdk/react@1.0.6(react@18.3.1)(zod@3.23.8)':
|
||||||
|
dependencies:
|
||||||
|
'@ai-sdk/provider-utils': 2.0.4(zod@3.23.8)
|
||||||
|
'@ai-sdk/ui-utils': 1.0.5(zod@3.23.8)
|
||||||
swr: 2.2.5(react@18.3.1)
|
swr: 2.2.5(react@18.3.1)
|
||||||
throttleit: 2.1.0
|
throttleit: 2.1.0
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
zod: 3.23.8
|
zod: 3.23.8
|
||||||
|
|
||||||
'@ai-sdk/solid@0.0.54(zod@3.23.8)':
|
'@ai-sdk/ui-utils@1.0.5(zod@3.23.8)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ai-sdk/provider-utils': 1.0.22(zod@3.23.8)
|
'@ai-sdk/provider': 1.0.2
|
||||||
'@ai-sdk/ui-utils': 0.0.50(zod@3.23.8)
|
'@ai-sdk/provider-utils': 2.0.4(zod@3.23.8)
|
||||||
transitivePeerDependencies:
|
|
||||||
- zod
|
|
||||||
|
|
||||||
'@ai-sdk/svelte@0.0.57(svelte@5.4.0)(zod@3.23.8)':
|
|
||||||
dependencies:
|
|
||||||
'@ai-sdk/provider-utils': 1.0.22(zod@3.23.8)
|
|
||||||
'@ai-sdk/ui-utils': 0.0.50(zod@3.23.8)
|
|
||||||
sswr: 2.1.0(svelte@5.4.0)
|
|
||||||
optionalDependencies:
|
|
||||||
svelte: 5.4.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- zod
|
|
||||||
|
|
||||||
'@ai-sdk/ui-utils@0.0.50(zod@3.23.8)':
|
|
||||||
dependencies:
|
|
||||||
'@ai-sdk/provider': 0.0.26
|
|
||||||
'@ai-sdk/provider-utils': 1.0.22(zod@3.23.8)
|
|
||||||
json-schema: 0.4.0
|
|
||||||
secure-json-parse: 2.7.0
|
|
||||||
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
zod: 3.23.8
|
zod: 3.23.8
|
||||||
|
|
||||||
'@ai-sdk/vue@0.0.59(vue@3.5.13(typescript@5.7.2))(zod@3.23.8)':
|
|
||||||
dependencies:
|
|
||||||
'@ai-sdk/provider-utils': 1.0.22(zod@3.23.8)
|
|
||||||
'@ai-sdk/ui-utils': 0.0.50(zod@3.23.8)
|
|
||||||
swrv: 1.0.4(vue@3.5.13(typescript@5.7.2))
|
|
||||||
optionalDependencies:
|
|
||||||
vue: 3.5.13(typescript@5.7.2)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- zod
|
|
||||||
|
|
||||||
'@ampproject/remapping@2.3.0':
|
'@ampproject/remapping@2.3.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/gen-mapping': 0.3.5
|
'@jridgewell/gen-mapping': 0.3.5
|
||||||
@@ -7032,6 +6904,20 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 18.3.12
|
'@types/react': 18.3.12
|
||||||
|
|
||||||
|
'@radix-ui/react-context-menu@2.2.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
||||||
|
dependencies:
|
||||||
|
'@radix-ui/primitive': 1.1.0
|
||||||
|
'@radix-ui/react-context': 1.1.1(@types/react@18.3.12)(react@18.3.1)
|
||||||
|
'@radix-ui/react-menu': 2.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-use-callback-ref': 1.1.0(@types/react@18.3.12)(react@18.3.1)
|
||||||
|
'@radix-ui/react-use-controllable-state': 1.1.0(@types/react@18.3.12)(react@18.3.1)
|
||||||
|
react: 18.3.1
|
||||||
|
react-dom: 18.3.1(react@18.3.1)
|
||||||
|
optionalDependencies:
|
||||||
|
'@types/react': 18.3.12
|
||||||
|
'@types/react-dom': 18.3.1
|
||||||
|
|
||||||
'@radix-ui/react-context@1.1.0(@types/react@18.3.12)(react@18.3.1)':
|
'@radix-ui/react-context@1.1.0(@types/react@18.3.12)(react@18.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
@@ -8015,60 +7901,6 @@ snapshots:
|
|||||||
loupe: 3.1.2
|
loupe: 3.1.2
|
||||||
tinyrainbow: 1.2.0
|
tinyrainbow: 1.2.0
|
||||||
|
|
||||||
'@vue/compiler-core@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@babel/parser': 7.26.2
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
entities: 4.5.0
|
|
||||||
estree-walker: 2.0.2
|
|
||||||
source-map-js: 1.2.1
|
|
||||||
|
|
||||||
'@vue/compiler-dom@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@vue/compiler-core': 3.5.13
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
|
|
||||||
'@vue/compiler-sfc@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@babel/parser': 7.26.2
|
|
||||||
'@vue/compiler-core': 3.5.13
|
|
||||||
'@vue/compiler-dom': 3.5.13
|
|
||||||
'@vue/compiler-ssr': 3.5.13
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
estree-walker: 2.0.2
|
|
||||||
magic-string: 0.30.14
|
|
||||||
postcss: 8.4.49
|
|
||||||
source-map-js: 1.2.1
|
|
||||||
|
|
||||||
'@vue/compiler-ssr@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@vue/compiler-dom': 3.5.13
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
|
|
||||||
'@vue/reactivity@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
|
|
||||||
'@vue/runtime-core@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@vue/reactivity': 3.5.13
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
|
|
||||||
'@vue/runtime-dom@3.5.13':
|
|
||||||
dependencies:
|
|
||||||
'@vue/reactivity': 3.5.13
|
|
||||||
'@vue/runtime-core': 3.5.13
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
csstype: 3.1.3
|
|
||||||
|
|
||||||
'@vue/server-renderer@3.5.13(vue@3.5.13(typescript@5.7.2))':
|
|
||||||
dependencies:
|
|
||||||
'@vue/compiler-ssr': 3.5.13
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
vue: 3.5.13(typescript@5.7.2)
|
|
||||||
|
|
||||||
'@vue/shared@3.5.13': {}
|
|
||||||
|
|
||||||
'@web3-storage/multipart-parser@1.0.0': {}
|
'@web3-storage/multipart-parser@1.0.0': {}
|
||||||
|
|
||||||
'@webcontainer/api@1.3.0-internal.10': {}
|
'@webcontainer/api@1.3.0-internal.10': {}
|
||||||
@@ -8099,10 +7931,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
acorn: 8.14.0
|
acorn: 8.14.0
|
||||||
|
|
||||||
acorn-typescript@1.4.13(acorn@8.14.0):
|
|
||||||
dependencies:
|
|
||||||
acorn: 8.14.0
|
|
||||||
|
|
||||||
acorn-walk@8.3.4:
|
acorn-walk@8.3.4:
|
||||||
dependencies:
|
dependencies:
|
||||||
acorn: 8.14.0
|
acorn: 8.14.0
|
||||||
@@ -8114,29 +7942,18 @@ snapshots:
|
|||||||
clean-stack: 2.2.0
|
clean-stack: 2.2.0
|
||||||
indent-string: 4.0.0
|
indent-string: 4.0.0
|
||||||
|
|
||||||
ai@3.4.33(react@18.3.1)(sswr@2.1.0(svelte@5.4.0))(svelte@5.4.0)(vue@3.5.13(typescript@5.7.2))(zod@3.23.8):
|
ai@4.0.18(react@18.3.1)(zod@3.23.8):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ai-sdk/provider': 0.0.26
|
'@ai-sdk/provider': 1.0.2
|
||||||
'@ai-sdk/provider-utils': 1.0.22(zod@3.23.8)
|
'@ai-sdk/provider-utils': 2.0.4(zod@3.23.8)
|
||||||
'@ai-sdk/react': 0.0.70(react@18.3.1)(zod@3.23.8)
|
'@ai-sdk/react': 1.0.6(react@18.3.1)(zod@3.23.8)
|
||||||
'@ai-sdk/solid': 0.0.54(zod@3.23.8)
|
'@ai-sdk/ui-utils': 1.0.5(zod@3.23.8)
|
||||||
'@ai-sdk/svelte': 0.0.57(svelte@5.4.0)(zod@3.23.8)
|
|
||||||
'@ai-sdk/ui-utils': 0.0.50(zod@3.23.8)
|
|
||||||
'@ai-sdk/vue': 0.0.59(vue@3.5.13(typescript@5.7.2))(zod@3.23.8)
|
|
||||||
'@opentelemetry/api': 1.9.0
|
'@opentelemetry/api': 1.9.0
|
||||||
eventsource-parser: 1.1.2
|
|
||||||
json-schema: 0.4.0
|
|
||||||
jsondiffpatch: 0.6.0
|
jsondiffpatch: 0.6.0
|
||||||
secure-json-parse: 2.7.0
|
|
||||||
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
zod-to-json-schema: 3.23.5(zod@3.23.8)
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
sswr: 2.1.0(svelte@5.4.0)
|
|
||||||
svelte: 5.4.0
|
|
||||||
zod: 3.23.8
|
zod: 3.23.8
|
||||||
transitivePeerDependencies:
|
|
||||||
- solid-js
|
|
||||||
- vue
|
|
||||||
|
|
||||||
ajv@6.12.6:
|
ajv@6.12.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -8168,8 +7985,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
tslib: 2.8.1
|
tslib: 2.8.1
|
||||||
|
|
||||||
aria-query@5.3.2: {}
|
|
||||||
|
|
||||||
array-flatten@1.1.1: {}
|
array-flatten@1.1.1: {}
|
||||||
|
|
||||||
as-table@1.0.55:
|
as-table@1.0.55:
|
||||||
@@ -8200,8 +8015,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
possible-typed-array-names: 1.0.0
|
possible-typed-array-names: 1.0.0
|
||||||
|
|
||||||
axobject-query@4.1.0: {}
|
|
||||||
|
|
||||||
bail@2.0.2: {}
|
bail@2.0.2: {}
|
||||||
|
|
||||||
balanced-match@1.0.2: {}
|
balanced-match@1.0.2: {}
|
||||||
@@ -8901,8 +8714,6 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
esm-env@1.2.1: {}
|
|
||||||
|
|
||||||
espree@10.3.0:
|
espree@10.3.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
acorn: 8.14.0
|
acorn: 8.14.0
|
||||||
@@ -8919,11 +8730,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
estraverse: 5.3.0
|
estraverse: 5.3.0
|
||||||
|
|
||||||
esrap@1.2.3:
|
|
||||||
dependencies:
|
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
|
||||||
'@types/estree': 1.0.6
|
|
||||||
|
|
||||||
esrecurse@4.3.0:
|
esrecurse@4.3.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
estraverse: 5.3.0
|
estraverse: 5.3.0
|
||||||
@@ -9650,8 +9456,6 @@ snapshots:
|
|||||||
mlly: 1.7.3
|
mlly: 1.7.3
|
||||||
pkg-types: 1.2.1
|
pkg-types: 1.2.1
|
||||||
|
|
||||||
locate-character@3.0.0: {}
|
|
||||||
|
|
||||||
locate-path@6.0.0:
|
locate-path@6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
p-locate: 5.0.0
|
p-locate: 5.0.0
|
||||||
@@ -11462,11 +11266,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minipass: 7.1.2
|
minipass: 7.1.2
|
||||||
|
|
||||||
sswr@2.1.0(svelte@5.4.0):
|
|
||||||
dependencies:
|
|
||||||
svelte: 5.4.0
|
|
||||||
swrev: 4.0.0
|
|
||||||
|
|
||||||
stackback@0.0.2: {}
|
stackback@0.0.2: {}
|
||||||
|
|
||||||
stacktracey@2.1.8:
|
stacktracey@2.1.8:
|
||||||
@@ -11557,34 +11356,12 @@ snapshots:
|
|||||||
|
|
||||||
supports-preserve-symlinks-flag@1.0.0: {}
|
supports-preserve-symlinks-flag@1.0.0: {}
|
||||||
|
|
||||||
svelte@5.4.0:
|
|
||||||
dependencies:
|
|
||||||
'@ampproject/remapping': 2.3.0
|
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
|
||||||
'@types/estree': 1.0.6
|
|
||||||
acorn: 8.14.0
|
|
||||||
acorn-typescript: 1.4.13(acorn@8.14.0)
|
|
||||||
aria-query: 5.3.2
|
|
||||||
axobject-query: 4.1.0
|
|
||||||
esm-env: 1.2.1
|
|
||||||
esrap: 1.2.3
|
|
||||||
is-reference: 3.0.3
|
|
||||||
locate-character: 3.0.0
|
|
||||||
magic-string: 0.30.14
|
|
||||||
zimmerframe: 1.1.2
|
|
||||||
|
|
||||||
swr@2.2.5(react@18.3.1):
|
swr@2.2.5(react@18.3.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
client-only: 0.0.1
|
client-only: 0.0.1
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
use-sync-external-store: 1.2.2(react@18.3.1)
|
use-sync-external-store: 1.2.2(react@18.3.1)
|
||||||
|
|
||||||
swrev@4.0.0: {}
|
|
||||||
|
|
||||||
swrv@1.0.4(vue@3.5.13(typescript@5.7.2)):
|
|
||||||
dependencies:
|
|
||||||
vue: 3.5.13(typescript@5.7.2)
|
|
||||||
|
|
||||||
sync-child-process@1.0.2:
|
sync-child-process@1.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
sync-message-port: 1.1.3
|
sync-message-port: 1.1.3
|
||||||
@@ -12062,16 +11839,6 @@ snapshots:
|
|||||||
|
|
||||||
vm-browserify@1.1.2: {}
|
vm-browserify@1.1.2: {}
|
||||||
|
|
||||||
vue@3.5.13(typescript@5.7.2):
|
|
||||||
dependencies:
|
|
||||||
'@vue/compiler-dom': 3.5.13
|
|
||||||
'@vue/compiler-sfc': 3.5.13
|
|
||||||
'@vue/runtime-dom': 3.5.13
|
|
||||||
'@vue/server-renderer': 3.5.13(vue@3.5.13(typescript@5.7.2))
|
|
||||||
'@vue/shared': 3.5.13
|
|
||||||
optionalDependencies:
|
|
||||||
typescript: 5.7.2
|
|
||||||
|
|
||||||
w3c-keyname@2.2.8: {}
|
w3c-keyname@2.2.8: {}
|
||||||
|
|
||||||
wcwidth@1.0.1:
|
wcwidth@1.0.1:
|
||||||
@@ -12184,8 +11951,6 @@ snapshots:
|
|||||||
mustache: 4.2.0
|
mustache: 4.2.0
|
||||||
stacktracey: 2.1.8
|
stacktracey: 2.1.8
|
||||||
|
|
||||||
zimmerframe@1.1.2: {}
|
|
||||||
|
|
||||||
zod-to-json-schema@3.23.5(zod@3.23.8):
|
zod-to-json-schema@3.23.5(zod@3.23.8):
|
||||||
dependencies:
|
dependencies:
|
||||||
zod: 3.23.8
|
zod: 3.23.8
|
||||||
|
|||||||
BIN
public/apple-touch-icon-precomposed.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
4
public/icons/Anthropic.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2L2 19.5455H22L12 2ZM12 6.5L18.5 18H5.5L12 6.5Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 231 B |
4
public/icons/Cohere.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM15 6H9C7.34 6 6 7.34 6 9V15C6 16.66 7.34 18 9 18H15C16.66 18 18 16.66 18 15V9C18 7.34 16.66 6 15 6Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 465 B |
5
public/icons/Deepseek.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M21.5 12c0 5.25-4.25 9.5-9.5 9.5S2.5 17.25 2.5 12 6.75 2.5 12 2.5s9.5 4.25 9.5 9.5zM12 4.5c-4.136 0-7.5 3.364-7.5 7.5 0 4.136 3.364 7.5 7.5 7.5 4.136 0 7.5-3.364 7.5-7.5 0-4.136-3.364-7.5-7.5-7.5zm3.5 7.5c0 1.933-1.567 3.5-3.5 3.5S8.5 13.933 8.5 12 10.067 8.5 12 8.5s3.5 1.567 3.5 3.5z" fill="#000000"/>
|
||||||
|
<path d="M15.5 7.5c-.828 0-1.5-.672-1.5-1.5s.672-1.5 1.5-1.5 1.5.672 1.5 1.5-.672 1.5-1.5 1.5z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 582 B |
4
public/icons/Default.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2C6.477 2 2 6.477 2 12C2 17.523 6.477 22 12 22C17.523 22 22 17.523 22 12C22 6.477 17.523 2 12 2ZM12 4.5C16.142 4.5 19.5 7.858 19.5 12C19.5 16.142 16.142 19.5 12 19.5C7.858 19.5 4.5 16.142 4.5 12C4.5 7.858 7.858 4.5 12 4.5ZM12 7C9.239 7 7 9.239 7 12C7 14.761 9.239 17 12 17C14.761 17 17 14.761 17 12C17 9.239 14.761 7 12 7Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 506 B |
4
public/icons/Google.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 527 B |
4
public/icons/Groq.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2L2 7V17L12 22L22 17V7L12 2ZM12 4.618L19.236 8.236L12 11.854L4.764 8.236L12 4.618ZM4 9.618L11 13.146V18.382L4 14.854V9.618ZM13 18.382V13.146L20 9.618V14.854L13 18.382Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 351 B |
4
public/icons/HuggingFace.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M11.844 2.5c-.616 0-1.22.117-1.787.346a4.654 4.654 0 0 0-2.67-.346c-2.63.346-4.195 2.827-3.496 5.535.467 1.82 1.157 3.214 2.67 3.907v1.012c0 2.363 1.947 4.309 4.309 4.309 2.362 0 4.309-1.946 4.309-4.309v-.957c1.56-.693 2.25-2.143 2.67-3.962.7-2.708-.865-5.19-3.496-5.535a4.654 4.654 0 0 0-2.509.346zm.18 3.27a.82.82 0 0 1 .82.82.82.82 0 0 1-.82.819.82.82 0 0 1-.82-.82.82.82 0 0 1 .82-.819zm-3.725 0a.82.82 0 0 1 .82.82.82.82 0 0 1-.82.819.82.82 0 0 1-.82-.82.82.82 0 0 1 .82-.819zm3.95 3.158c-.484 1.161-1.55 1.955-2.786 1.955-1.237 0-2.302-.794-2.786-1.955-.064-.154.088-.316.251-.27.733.205 1.624.329 2.535.329.911 0 1.802-.124 2.535-.33.163-.045.315.117.251.271z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 846 B |
5
public/icons/LMStudio.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M5 4h14c.6 0 1 .4 1 1v14c0 .6-.4 1-1 1H5c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1zm7 3c-2.2 0-4 1.8-4 4 0 1.5.8 2.8 2 3.4v1.6c0 1.1.9 2 2 2s2-.9 2-2v-1.6c1.2-.7 2-2 2-3.4 0-2.2-1.8-4-4-4zm0 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z" fill="#000000"/>
|
||||||
|
<path d="M9 8h2v2H9zm4 0h2v2h-2z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 459 B |
4
public/icons/Mistral.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2C6.477 2 2 6.477 2 12C2 17.523 6.477 22 12 22C17.523 22 22 17.523 22 12C22 6.477 17.523 2 12 2ZM12 4C16.418 4 20 7.582 20 12C20 16.418 16.418 20 12 20C7.582 20 4 16.418 4 12C4 7.582 7.582 4 12 4ZM12 6L7 18H17L12 6ZM12 9.5L14.5 16H9.5L12 9.5Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 426 B |
4
public/icons/Ollama.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2C6.477 2 2 6.477 2 12C2 17.523 6.477 22 12 22C17.523 22 22 17.523 22 12C22 6.477 17.523 2 12 2ZM12 4.5C16.142 4.5 19.5 7.858 19.5 12C19.5 16.142 16.142 19.5 12 19.5C7.858 19.5 4.5 16.142 4.5 12C4.5 7.858 7.858 4.5 12 4.5ZM12 7C9.239 7 7 9.239 7 12C7 14.761 9.239 17 12 17C14.761 17 17 14.761 17 12C17 9.239 14.761 7 12 7Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 506 B |
4
public/icons/OpenAI.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
4
public/icons/OpenAILike.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M22.282 11.846c0-.813-.195-1.618-.57-2.341a4.757 4.757 0 0 0-1.573-1.724 4.813 4.813 0 0 0 .21-1.425c0-.813-.195-1.618-.57-2.341a4.846 4.846 0 0 0-1.557-1.724A4.846 4.846 0 0 0 16.026 1.5a4.846 4.846 0 0 0-2.341.195 4.846 4.846 0 0 0-1.724 1.557 4.813 4.813 0 0 0-1.425-.21c-.813 0-1.618.195-2.341.57a4.846 4.846 0 0 0-1.724 1.557A4.846 4.846 0 0 0 5.5 7.974c0 .488.065.975.195 1.441a4.757 4.757 0 0 0-1.573 1.724 4.813 4.813 0 0 0-.57 2.341c0 .813.195 1.618.57 2.341a4.757 4.757 0 0 0 1.573 1.724 4.813 4.813 0 0 0-.21 1.425c0 .813.195 1.618.57 2.341a4.846 4.846 0 0 0 1.557 1.724 4.846 4.846 0 0 0 2.195.791c.813 0 1.618-.195 2.341-.57a4.846 4.846 0 0 0 1.724-1.557c.456.13.928.195 1.425.195.813 0 1.618-.195 2.341-.57a4.846 4.846 0 0 0 1.724-1.557 4.846 4.846 0 0 0 .791-2.195c0-.488-.065-.975-.195-1.441a4.757 4.757 0 0 0 1.573-1.724c.375-.723.57-1.528.57-2.341z" fill="none" stroke="#000000" stroke-width="1.5"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
4
public/icons/OpenRouter.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2L4.5 6V18L12 22L19.5 18V6L12 2ZM12 4.236L17.14 7L12 9.764L6.86 7L12 4.236ZM6.5 8.764L11.5 11.464V16.764L6.5 14.064V8.764ZM12.5 16.764V11.464L17.5 8.764V14.064L12.5 16.764Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 356 B |
4
public/icons/Perplexity.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2C6.477 2 2 6.477 2 12C2 17.523 6.477 22 12 22C17.523 22 22 17.523 22 12C22 6.477 17.523 2 12 2ZM12 4.5C16.142 4.5 19.5 7.858 19.5 12C19.5 16.142 16.142 19.5 12 19.5C7.858 19.5 4.5 16.142 4.5 12C4.5 7.858 7.858 4.5 12 4.5ZM12 7C9.239 7 7 9.239 7 12C7 14.761 9.239 17 12 17C14.761 17 17 14.761 17 12C17 9.239 14.761 7 12 7Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 510 B |
4
public/icons/Together.svg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM15 6H9C7.34 6 6 7.34 6 9V15C6 16.66 7.34 18 9 18H15C16.66 18 18 16.66 18 15V9C18 7.34 16.66 6 15 6ZM16 15C16 15.55 15.55 16 15 16H9C8.45 16 8 15.55 8 15V9C8 8.45 8.45 8 9 8H15C15.55 8 16 8.45 16 9V15Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 566 B |
5
public/icons/xAI.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M3.5 3L9 12L3.5 21H6.5L10.5 14L14.5 21H17.5L12 12L17.5 3H14.5L10.5 10L6.5 3H3.5Z" fill="#000000"/>
|
||||||
|
<path d="M18 3L20.5 7L23 3H18Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 313 B |
@@ -241,6 +241,7 @@ export default defineConfig({
|
|||||||
collections: {
|
collections: {
|
||||||
...customIconCollection,
|
...customIconCollection,
|
||||||
},
|
},
|
||||||
|
unit: 'em',
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ export default defineConfig((config) => {
|
|||||||
future: {
|
future: {
|
||||||
v3_fetcherPersist: true,
|
v3_fetcherPersist: true,
|
||||||
v3_relativeSplatPath: true,
|
v3_relativeSplatPath: true,
|
||||||
v3_throwAbortReason: true
|
v3_throwAbortReason: true,
|
||||||
|
v3_lazyRouteDiscovery: true
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
UnoCSS(),
|
UnoCSS(),
|
||||||
|
|||||||
1
worker-configuration.d.ts
vendored
@@ -14,4 +14,5 @@ interface Env {
|
|||||||
GOOGLE_GENERATIVE_AI_API_KEY: string;
|
GOOGLE_GENERATIVE_AI_API_KEY: string;
|
||||||
MISTRAL_API_KEY: string;
|
MISTRAL_API_KEY: string;
|
||||||
XAI_API_KEY: string;
|
XAI_API_KEY: string;
|
||||||
|
PERPLEXITY_API_KEY: string;
|
||||||
}
|
}
|
||||||
|
|||||||