diff --git a/.env.example b/.env.example index 7306f36172fada99fa6399326f1ace8d902ca404..5baa3d4ac37e7fc64ed1cca985854fd83aa80552 100644 --- a/.env.example +++ b/.env.example @@ -70,6 +70,11 @@ LMSTUDIO_API_BASE_URL= # You only need this environment variable set if you want to use xAI models 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 VITE_LOG_LEVEL=debug diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..1fbea24a6bf5f29788f3a4983266bc558e37b0e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Bolt.new related issues + url: https://github.com/stackblitz/bolt.new/issues/new/choose + about: Report issues related to Bolt.new (not Bolt.diy) + - name: Chat + url: https://thinktank.ottomator.ai + about: Ask questions and discuss with other Bolt.diy users. diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index 2f194cdfa0b0ad5a315a5669c58bdb6c25872264..4e8545b0a5343e23fdd6dfd9c81bec0c4e2926b1 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -10,18 +10,25 @@ permissions: jobs: update-commit: + if: contains(github.event.head_commit.message, '#release') != true runs-on: ubuntu-latest steps: - name: Checkout the code uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' - 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 run: | - echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json + echo "{ \"commit\": \"$COMMIT_HASH\" , \"version\": \"$CURRENT_VERSION\" }" > app/commit.json - name: Commit and push the update run: | diff --git a/.github/workflows/pr-release-validation.yaml b/.github/workflows/pr-release-validation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..99c570373dab179fa5480d46feb6a80e9073c5df --- /dev/null +++ b/.github/workflows/pr-release-validation.yaml @@ -0,0 +1,31 @@ +name: PR Validation + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + branches: + - main + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Validate PR Labels + run: | + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'stable-release') }}" == "true" ]]; then + echo "βœ“ PR has stable-release label" + + # Check version bump labels + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'major') }}" == "true" ]]; then + echo "βœ“ Major version bump requested" + elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'minor') }}" == "true" ]]; then + echo "βœ“ Minor version bump requested" + else + echo "βœ“ Patch version bump will be applied" + fi + else + echo "This PR doesn't have the stable-release label. No release will be created." + fi \ No newline at end of file diff --git a/.github/workflows/update-stable.yml b/.github/workflows/update-stable.yml new file mode 100644 index 0000000000000000000000000000000000000000..d930fbd1d76a0672f5a42fb887a863e92db5e6ef --- /dev/null +++ b/.github/workflows/update-stable.yml @@ -0,0 +1,193 @@ +name: Update Stable Branch + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + prepare-release: + if: contains(github.event.head_commit.message, '#release') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Get Current Version + id: current_version + run: | + CURRENT_VERSION=$(node -p "require('./package.json').version") + echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + + - name: Install semver + run: pnpm add -g semver + + - name: Determine Version Bump + id: version_bump + run: | + COMMIT_MSG="${{ github.event.head_commit.message }}" + if [[ $COMMIT_MSG =~ "#release:major" ]]; then + echo "bump=major" >> $GITHUB_OUTPUT + elif [[ $COMMIT_MSG =~ "#release:minor" ]]; then + echo "bump=minor" >> $GITHUB_OUTPUT + else + echo "bump=patch" >> $GITHUB_OUTPUT + fi + + - name: Bump Version + id: bump_version + run: | + NEW_VERSION=$(semver -i ${{ steps.version_bump.outputs.bump }} ${{ steps.current_version.outputs.version }}) + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + + - name: Update Package.json + run: | + NEW_VERSION=${{ steps.bump_version.outputs.new_version }} + pnpm version $NEW_VERSION --no-git-tag-version --allow-same-version + + - name: Generate Changelog + id: changelog + run: | + # Get the latest tag + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + + # Start changelog file + echo "# Release v${{ steps.bump_version.outputs.new_version }}" > changelog.md + echo "" >> changelog.md + + if [ -z "$LATEST_TAG" ]; then + echo "### πŸŽ‰ First Release" >> changelog.md + echo "" >> changelog.md + COMPARE_BASE="$(git rev-list --max-parents=0 HEAD)" + else + echo "### πŸ”„ Changes since $LATEST_TAG" >> changelog.md + echo "" >> changelog.md + COMPARE_BASE="$LATEST_TAG" + fi + + # Function to extract conventional commit type + get_commit_type() { + if [[ $1 =~ ^feat:|^feature: ]]; then echo "✨ Features"; + elif [[ $1 =~ ^fix: ]]; then echo "πŸ› Bug Fixes"; + elif [[ $1 =~ ^docs: ]]; then echo "πŸ“š Documentation"; + elif [[ $1 =~ ^style: ]]; then echo "πŸ’Ž Styles"; + elif [[ $1 =~ ^refactor: ]]; then echo "♻️ Code Refactoring"; + elif [[ $1 =~ ^perf: ]]; then echo "⚑️ Performance Improvements"; + elif [[ $1 =~ ^test: ]]; then echo "βœ… Tests"; + elif [[ $1 =~ ^build: ]]; then echo "πŸ› οΈ Build System"; + elif [[ $1 =~ ^ci: ]]; then echo "βš™οΈ CI"; + elif [[ $1 =~ ^chore: ]]; then echo "πŸ”§ Chores"; + else echo "πŸ” Other Changes"; + fi + } + + # Generate categorized changelog + declare -A CATEGORIES + declare -A COMMITS_BY_CATEGORY + + # Get commits since last tag or all commits if no tag exists + while IFS= read -r commit_line; do + HASH=$(echo "$commit_line" | cut -d'|' -f1) + MSG=$(echo "$commit_line" | cut -d'|' -f2) + PR_NUM=$(echo "$commit_line" | cut -d'|' -f3) + + CATEGORY=$(get_commit_type "$MSG") + CATEGORIES["$CATEGORY"]=1 + + # Format commit message with PR link if available + if [ -n "$PR_NUM" ]; then + COMMITS_BY_CATEGORY["$CATEGORY"]+="- ${MSG#*: } ([#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM))"$'\n' + else + COMMITS_BY_CATEGORY["$CATEGORY"]+="- ${MSG#*: }"$'\n' + fi + done < <(git log "${COMPARE_BASE}..HEAD" --pretty=format:"%H|%s|%(trailers:key=PR-Number,valueonly)" --reverse) + + # Write categorized commits to changelog + for category in "✨ Features" "πŸ› Bug Fixes" "πŸ“š Documentation" "πŸ’Ž Styles" "♻️ Code Refactoring" "⚑️ Performance Improvements" "βœ… Tests" "πŸ› οΈ Build System" "βš™οΈ CI" "πŸ”§ Chores" "πŸ” Other Changes"; do + if [ -n "${COMMITS_BY_CATEGORY[$category]}" ]; then + echo "#### $category" >> changelog.md + echo "" >> changelog.md + echo "${COMMITS_BY_CATEGORY[$category]}" >> changelog.md + echo "" >> changelog.md + fi + done + + # Add compare link if not first release + if [ -n "$LATEST_TAG" ]; then + echo "**Full Changelog**: [\`$LATEST_TAG..v${{ steps.bump_version.outputs.new_version }}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/$LATEST_TAG...v${{ steps.bump_version.outputs.new_version }})" >> changelog.md + fi + + # Save changelog content for the release + CHANGELOG_CONTENT=$(cat changelog.md) + echo "content<> $GITHUB_OUTPUT + echo "$CHANGELOG_CONTENT" >> $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 "CURRENT_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV + + - name: Commit and Tag Release + run: | + git pull + echo "{ \"commit\": \"$COMMIT_HASH\" , \"version\": \"$CURRENT_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 tag "v${{ steps.bump_version.outputs.new_version }}" + git push + git push --tags + + - name: Update Stable Branch + run: | + if ! git checkout stable 2>/dev/null; then + echo "Creating new stable branch..." + git checkout -b stable + fi + git merge main --no-ff -m "chore: release version ${{ steps.bump_version.outputs.new_version }}" + git push --set-upstream origin stable --force + + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="v${{ steps.bump_version.outputs.new_version }}" + gh release create "$VERSION" \ + --title "Release $VERSION" \ + --notes "${{ steps.changelog.outputs.content }}" \ + --target stable \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7bbcc2ea3f3c5ef915a7832f0ac1268701fa5567..53eb0368f3db1a6ff761a75b34594e808a2ff590 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ modelfiles # docs ignore site + +# commit file ignore +app/commit.json \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index 1aab67dc43533bcd4d99c348c1546e62ba3a1457..b95e00d5e65edc06ed95bc14b1b1a0a9fd7ce577 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,25 +2,42 @@ 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" -[ -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" -echo "Running typecheck..." -which pnpm +# 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..." if ! pnpm typecheck; then - echo "❌ Type checking failed! Please review TypeScript types." - echo "Once you're done, don't forget to add your changes to the commit! πŸš€" - echo "Typecheck exit code: $?" - exit 1 + echo "❌ Type checking failed! Please review TypeScript types." + echo "Once you're done, don't forget to add your changes to the commit! πŸš€" + exit 1 fi +# Run lint echo "Running lint..." 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 "lint exit code: $?" exit 1 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..." diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68215a289bb750a8bd4aa4ed5193168043307a2e..bdb02ff192f89a59eb1d9d6b3f5e5a2030779cc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to oTToDev +# Contributing to bolt.diy -First off, thank you for considering contributing to oTToDev! This fork aims to expand the capabilities of the original project by integrating multiple LLM providers and enhancing functionality. Every contribution helps make oTToDev 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 - [Code of Conduct](#code-of-conduct) diff --git a/FAQ.md b/FAQ.md index 3e267058c7c6a1534f8364da4bc01def8b27ef3c..ecd4158fedb8fed26da00a6904385b769a672ced 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,49 +1,42 @@ -[![Bolt.new: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.new) +[![bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy) -# Bolt.new Fork by Cole Medin - oTToDev +# bolt.diy ## FAQ -### How do I get the best results with oTToDev? +### 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. -- **Scaffold the basics first, then add features**: Make sure the basic structure of your application is in place before diving into more advanced functionality. This helps oTToDev understand the foundation of your project and ensure everything is wired up right before building out more advanced functionality. +- **Scaffold the basics first, then add features**: Make sure the basic structure of your application is in place before diving into more advanced functionality. This helps Bolt.diy understand the foundation of your project and ensure everything is wired up right before building out more advanced functionality. -- **Batch simple instructions**: Save time by combining simple instructions into one message. For example, you can ask oTToDev 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 oTToDev back into the official Bolt.new repo? - -More news coming on this coming early next month - stay tuned! +- **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. ### Why are there so many open issues/pull requests? -oTToDev 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! +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! -### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for oTToDev/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! ### I'm getting the error: "There was an error processing this request" -If you see this error within oTToDev, 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" -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 oTToDev 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 oTToDev 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 oTToDev 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: -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! diff --git a/README.md b/README.md index 9ac258176779cd62c17437282016f889b2f252be..84235f8c1f7ba63ba7212ac56e5ae4849c2c7c56 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ -[![Bolt.new: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.new) +[![bolt.diy: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.diy) -# Bolt.new Fork by Cole Medin - oTToDev +# bolt.diy (Previously oTToDev) -This fork of Bolt.new (oTToDev) 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 [oTToDev Docs](https://coleam00.github.io/bolt.new-any-llm/) for more information. +Check the [bolt.diy Docs](https://stackblitz-labs.github.io/bolt.diy/) for more information. This documentation is still being updated after the transfer. -## Join the community for oTToDev! +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! https://thinktank.ottomator.ai @@ -18,7 +20,7 @@ https://thinktank.ottomator.ai - βœ… Autogenerate Ollama models from what is downloaded (@yunatamos) - βœ… Filter models by provider (@jasonm23) - βœ… 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) - βœ… Mistral API Integration (@ArulGandhi) - βœ… "Open AI Like" API Integration (@ZerxZ) @@ -41,8 +43,12 @@ https://thinktank.ottomator.ai - βœ… Mobile friendly (@qwikode) - βœ… Better prompt enhancing (@SujalXplores) - βœ… Attach images to prompts (@atrokhym) -- βœ… Detect package.json and commands to auto install and run preview for folder and git import (@wonderwhy-er) -- ⬜ **HIGH PRIORITY** - Prevent Bolt from rewriting files as often (file locking and diffs) +- βœ… Added Git Clone button (@thecodacus) +- βœ… 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** - Run agents in the backend as opposed to a single model call - ⬜ Deploy directly to Vercel/Netlify/other similar platforms @@ -54,187 +60,180 @@ https://thinktank.ottomator.ai - ⬜ Perplexity Integration - ⬜ Vertex AI Integration -## Bolt.new: AI-Powered Full-Stack Web Development in the Browser - -Bolt.new 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.new Different - -Claude, v0, etc are incredible- but you can't install packages, run backends, or edit code. That’s where Bolt.new stands out: - -- **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: - - 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. - -Whether you’re an experienced developer, a PM, or a designer, Bolt.new allows you to easily build production-grade full-stack applications. +## bolt.diy Features -For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo! +- **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. -## Setup +## Setup bolt.diy -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. +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. -1. Install Git from https://git-scm.com/downloads +### Prerequisites -2. Install Node.js from https://nodejs.org/en/download/ +1. **Install Git**: [Download Git](https://git-scm.com/downloads) +2. **Install Node.js**: [Download Node.js](https://nodejs.org/en/download/) -Pay attention to the installer notes after completion. + - 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 + ``` + Look for `/usr/local/bin` in the output. -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: +### Clone the Repository -``` -echo $PATHΒ . -``` +Clone the repository using Git: -If you see usr/local/bin in the output then you're good to go. +```bash +git clone -b stable https://github.com/stackblitz-labs/bolt.diy +``` -3. Clone the repository (if you haven't already) by opening a Terminal window (or CMD with admin permissions) and then typing in this: +### (Optional) Configure Environment Variables -``` -git clone https://github.com/coleam00/bolt.new-any-llm.git -``` +Most environment variables can be configured directly through the settings menu of the application. However, if you need to manually configure them: -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. +1. Rename `.env.example` to `.env.local`. +2. Add your LLM API keys. For example: -![image](https://github.com/user-attachments/assets/7e6a532c-2268-401f-8310-e8d20c731328) +```env +GROQ_API_KEY=YOUR_GROQ_API_KEY +OPENAI_API_KEY=YOUR_OPENAI_API_KEY +ANTHROPIC_API_KEY=YOUR_ANTHROPIC_API_KEY +``` -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. +**Note**: Ollama does not require an API key as it runs locally. -``` -defaults write com.apple.finder AppleShowAllFiles YES -``` +3. Optionally, set additional configurations: -**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: +```env +# Debugging +VITE_LOG_LEVEL=debug -Get your GROQ API Key here: https://console.groq.com/keys +# Ollama settings (example: 8K context, localhost port 11434) +OLLAMA_API_BASE_URL=http://localhost:11434 +DEFAULT_NUM_CTX=8192 +``` -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 +**Important**: Do not commit your `.env.local` file to version control. This file is already included in `.gitignore`. -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 -``` +## Run the Application -Optionally, you can set the debug level: +### Option 1: Without Docker -``` -VITE_LOG_LEVEL=debug -``` +1. **Install Dependencies**: + ```bash + pnpm install + ``` + If `pnpm` is not installed, install it using: + ```bash + sudo npm install -g pnpm + ``` -And if using Ollama set the DEFAULT_NUM_CTX, the example below uses 8K context and ollama running on localhost port 11434: +2. **Start the Application**: + ```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. -``` -OLLAMA_API_BASE_URL=http://localhost:11434 -DEFAULT_NUM_CTX=8192 -``` +### Option 2: With Docker -**Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore. +#### Prerequisites +- Ensure Git, Node.js, and Docker are installed: [Download Docker](https://www.docker.com/) -## Run with Docker +#### Steps -Prerequisites: +1. **Build the Docker Image**: -Git and Node.js as mentioned above, as well as Docker: https://www.docker.com/ + Use the provided NPM scripts: + ```bash + npm run dockerbuild # Development build + npm run dockerbuild:prod # Production build + ``` -### 1a. Using Helper Scripts + Alternatively, use Docker commands directly: + ```bash + docker build . --target bolt-ai-development # Development build + docker build . --target bolt-ai-production # Production build + ``` -NPM scripts are provided for convenient building: +2. **Run the Container**: + Use Docker Compose profiles to manage environments: + ```bash + docker-compose --profile development up # Development + docker-compose --profile production up # Production + ``` -```bash -# Development build -npm run dockerbuild + - With the development profile, changes to your code will automatically reflect in the running container (hot reloading). -# Production build -npm run dockerbuild:prod -``` +--- -### 1b. Direct Docker Build Commands (alternative to using NPM scripts) +### Update Your Local Version to the Latest -You can use Docker's target feature to specify the build environment instead of using NPM scripts if you wish: +To keep your local version of bolt.diy up to date with the latest changes, follow these steps for your operating system: -```bash -# Development build -docker build . --target bolt-ai-development +#### 1. **Navigate to your project folder** + Navigate to the directory where you cloned the repository and open a terminal: -# Production build -docker build . --target bolt-ai-production -``` +#### 2. **Fetch the Latest Changes** + Use Git to pull the latest changes from the main repository: -### 2. Docker Compose with Profiles to Run the Container + ```bash + git pull origin main + ``` -Use Docker Compose profiles to manage different environments: +#### 3. **Update Dependencies** + After pulling the latest changes, update the project dependencies by running the following command: -```bash -# Development environment -docker-compose --profile development up + ```bash + pnpm install + ``` -# Production environment -docker-compose --profile production up -``` +#### 4. **Run the Application** + Once the updates are complete, you can start the application again with: -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!). + ```bash + pnpm run dev + ``` -## Run Without Docker +This ensures that you're running the latest version of bolt.diy and can take advantage of all the newest features and bug fixes. -1. Install dependencies using Terminal (or CMD in Windows with admin permissions): +--- -``` -pnpm install -``` - -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: - -``` -sudo npm install -g pnpm -``` - -2. Start the application with the command: - -```bash -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: +- **`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. -```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. +## Contributing -## How do I contribute to oTToDev? +We welcome contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started. -[Please check out our dedicated page for contributing to oTToDev here!](CONTRIBUTING.md) +--- -## What are the future plans for oTToDev? +## Roadmap -[Check out our Roadmap here!](https://roadmap.sh/r/ottodev-roadmap-2ovzo) +Explore upcoming features and priorities on our [Roadmap](https://roadmap.sh/r/ottodev-roadmap-2ovzo). -Lot more updates to this roadmap coming soon! +--- ## FAQ -[Please check out our dedicated page for FAQ's related to oTToDev here!](FAQ.md) +For answers to common questions, visit our [FAQ Page](FAQ.md). diff --git a/app/commit.json b/app/commit.json index 953b106a943a93285191cb6f944d4281d997d205..1bdbb289c924561f28f7b371874f49149bc9f416 100644 --- a/app/commit.json +++ b/app/commit.json @@ -1 +1 @@ -{ "commit": "db8c65ec2ba2f28382cb5e792a3f7495fb9a8e03" } +{ "commit": "b304749b21f340e03c94abc0cc91ccf82f559195" } diff --git a/app/components/chat/AssistantMessage.tsx b/app/components/chat/AssistantMessage.tsx index a5698e9756cf692027952b1184464940c3b473fb..be304c7bcf8a5bf01da0fb1f7a4ffe3504d987f8 100644 --- a/app/components/chat/AssistantMessage.tsx +++ b/app/components/chat/AssistantMessage.tsx @@ -1,13 +1,30 @@ import { memo } from 'react'; import { Markdown } from './Markdown'; +import type { JSONValue } from 'ai'; interface AssistantMessageProps { 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 (
+ {usage && ( +
+ Tokens: {usage.totalTokens} (prompt: {usage.promptTokens}, completion: {usage.completionTokens}) +
+ )} {content}
); diff --git a/app/components/chat/BaseChat.module.scss b/app/components/chat/BaseChat.module.scss index cf530a112dadfe17a597e9494c0de2bd892373ff..4908e34e05d90eb08c7da48946631d5a68ee7e2e 100644 --- a/app/components/chat/BaseChat.module.scss +++ b/app/components/chat/BaseChat.module.scss @@ -18,82 +18,6 @@ opacity: 1; } -.RayContainer { - --gradient-opacity: 0.85; - --ray-gradient: radial-gradient(rgba(83, 196, 255, var(--gradient-opacity)) 0%, rgba(43, 166, 255, 0) 100%); - transition: opacity 0.25s linear; - position: fixed; - inset: 0; - pointer-events: none; - user-select: none; -} - -.LightRayOne { - width: 480px; - height: 680px; - transform: rotate(80deg); - top: -540px; - left: 250px; - filter: blur(110px); - position: absolute; - border-radius: 100%; - background: var(--ray-gradient); -} - -.LightRayTwo { - width: 110px; - height: 400px; - transform: rotate(-20deg); - top: -280px; - left: 350px; - mix-blend-mode: overlay; - opacity: 0.6; - filter: blur(60px); - position: absolute; - border-radius: 100%; - background: var(--ray-gradient); -} - -.LightRayThree { - width: 400px; - height: 370px; - top: -350px; - left: 200px; - mix-blend-mode: overlay; - opacity: 0.6; - filter: blur(21px); - position: absolute; - border-radius: 100%; - background: var(--ray-gradient); -} - -.LightRayFour { - position: absolute; - width: 330px; - height: 370px; - top: -330px; - left: 50px; - mix-blend-mode: overlay; - opacity: 0.5; - filter: blur(21px); - border-radius: 100%; - background: var(--ray-gradient); -} - -.LightRayFive { - position: absolute; - width: 110px; - height: 400px; - transform: rotate(-40deg); - top: -280px; - left: -10px; - mix-blend-mode: overlay; - opacity: 0.8; - filter: blur(60px); - border-radius: 100%; - background: var(--ray-gradient); -} - .PromptEffectContainer { --prompt-container-offset: 50px; --prompt-line-stroke-width: 1px; diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index 411da94b8355fc3d7b40ae5061b10387e4b9664f..2084cbb37f63ad8b7062d8792cfefc9c66bfc40a 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -17,7 +17,6 @@ import Cookies from 'js-cookie'; import * as Tooltip from '@radix-ui/react-tooltip'; import styles from './BaseChat.module.scss'; -import type { ProviderInfo } from '~/utils/types'; import { ExportChatButton } from '~/components/chat/chatExportAndImport/ExportChatButton'; import { ImportButtons } from '~/components/chat/chatExportAndImport/ImportButtons'; import { ExamplePrompts } from '~/components/chat/ExamplePrompts'; @@ -26,6 +25,9 @@ import GitCloneButton from './GitCloneButton'; import FilePreview from './FilePreview'; import { ModelSelector } from '~/components/chat/ModelSelector'; import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition'; +import type { IProviderSetting, ProviderInfo } from '~/types/model'; +import { ScreenshotStateManager } from './ScreenshotStateManager'; +import { toast } from 'react-toastify'; const TEXTAREA_MIN_HEIGHT = 76; @@ -45,6 +47,7 @@ interface BaseChatProps { setModel?: (model: string) => void; provider?: ProviderInfo; setProvider?: (provider: ProviderInfo) => void; + providerList?: ProviderInfo[]; handleStop?: () => void; sendMessage?: (event: React.UIEvent, messageInput?: string) => void; handleInputChange?: (event: React.ChangeEvent) => void; @@ -70,10 +73,12 @@ export const BaseChat = React.forwardRef( setModel, provider, setProvider, + providerList, input = '', enhancingPrompt, handleInputChange, - promptEnhanced, + + // promptEnhanced, enhancePrompt, sendMessage, handleStop, @@ -108,46 +113,10 @@ export const BaseChat = React.forwardRef( const [recognition, setRecognition] = useState(null); const [transcript, setTranscript] = useState(''); - // Load enabled providers from cookies - const [enabledProviders, setEnabledProviders] = useState(() => { - const savedProviders = Cookies.get('providers'); - - if (savedProviders) { - try { - const parsedProviders = JSON.parse(savedProviders); - return PROVIDER_LIST.filter((p) => parsedProviders[p.name]); - } catch (error) { - console.error('Failed to parse providers from cookies:', error); - return PROVIDER_LIST; - } - } - - return PROVIDER_LIST; - }); - - // Update enabled providers when cookies change useEffect(() => { - const updateProvidersFromCookies = () => { - const savedProviders = Cookies.get('providers'); - - if (savedProviders) { - try { - const parsedProviders = JSON.parse(savedProviders); - setEnabledProviders(PROVIDER_LIST.filter((p) => parsedProviders[p.name])); - } catch (error) { - console.error('Failed to parse providers from cookies:', error); - } - } - }; - - updateProvidersFromCookies(); + console.log(transcript); + }, [transcript]); - const interval = setInterval(updateProvidersFromCookies, 1000); - - return () => clearInterval(interval); - }, [PROVIDER_LIST]); - - console.log(transcript); useEffect(() => { // Load API keys from cookies on component mount try { @@ -167,7 +136,26 @@ export const BaseChat = React.forwardRef( Cookies.remove('apiKeys'); } - initializeModelList().then((modelList) => { + let providerSettings: Record | undefined = undefined; + + try { + const savedProviderSettings = Cookies.get('providers'); + + if (savedProviderSettings) { + const parsedProviderSettings = JSON.parse(savedProviderSettings); + + if (typeof parsedProviderSettings === 'object' && parsedProviderSettings !== null) { + providerSettings = parsedProviderSettings; + } + } + } catch (error) { + console.error('Error loading Provider Settings from cookies:', error); + + // Clear invalid cookie data + Cookies.remove('providers'); + } + + initializeModelList(providerSettings).then((modelList) => { setModelList(modelList); }); @@ -291,24 +279,14 @@ export const BaseChat = React.forwardRef( const baseChat = (
-
-
-
-
-
-
-
{() => }
{!chatStarted && ( -
+

Where ideas begin

@@ -353,15 +331,15 @@ export const BaseChat = React.forwardRef( gradientUnits="userSpaceOnUse" gradientTransform="rotate(-45)" > - - - - + + + + - - + + @@ -377,10 +355,10 @@ export const BaseChat = React.forwardRef( modelList={modelList} provider={provider} setProvider={setProvider} - providerList={PROVIDER_LIST} + providerList={providerList || PROVIDER_LIST} apiKeys={apiKeys} /> - {enabledProviders.length > 0 && provider && ( + {(providerList || []).length > 0 && provider && ( ( setImageDataList?.(imageDataList.filter((_, i) => i !== index)); }} /> + + {() => ( + + )} +
(