mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
Merge branch 'coleam00:main' into main
This commit is contained in:
commit
73f43999fa
26
.dockerignore
Normal file
26
.dockerignore
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Ignore Git and GitHub files
|
||||||
|
.git
|
||||||
|
.github/
|
||||||
|
|
||||||
|
# Ignore Husky configuration files
|
||||||
|
.husky/
|
||||||
|
|
||||||
|
# Ignore documentation and metadata files
|
||||||
|
CONTRIBUTING.md
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
|
|
||||||
|
# Ignore environment examples and sensitive info
|
||||||
|
.env
|
||||||
|
*.local
|
||||||
|
*.example
|
||||||
|
|
||||||
|
# Ignore node modules, logs and cache files
|
||||||
|
**/*.log
|
||||||
|
**/node_modules
|
||||||
|
**/dist
|
||||||
|
**/build
|
||||||
|
**/.cache
|
||||||
|
logs
|
||||||
|
dist-ssr
|
||||||
|
.DS_Store
|
10
.env.example
10
.env.example
@ -1,4 +1,4 @@
|
|||||||
# Rename this file to .env.local once you have filled in the below environment variables!
|
# Rename this file to .env once you have filled in the below environment variables!
|
||||||
|
|
||||||
# Get your GROQ API Key here -
|
# Get your GROQ API Key here -
|
||||||
# https://console.groq.com/keys
|
# https://console.groq.com/keys
|
||||||
@ -32,6 +32,9 @@ OLLAMA_API_BASE_URL=http://localhost:11434
|
|||||||
# You only need this environment variable set if you want to use OpenAI Like models
|
# You only need this environment variable set if you want to use OpenAI Like models
|
||||||
OPENAI_LIKE_API_BASE_URL=
|
OPENAI_LIKE_API_BASE_URL=
|
||||||
|
|
||||||
|
# You only need this environment variable set if you want to use DeepSeek models through their API
|
||||||
|
DEEPSEEK_API_KEY=
|
||||||
|
|
||||||
# Get your OpenAI Like API Key
|
# Get your OpenAI Like API Key
|
||||||
OPENAI_LIKE_API_KEY=
|
OPENAI_LIKE_API_KEY=
|
||||||
|
|
||||||
@ -40,5 +43,10 @@ OPENAI_LIKE_API_KEY=
|
|||||||
# You only need this environment variable set if you want to use Mistral models
|
# You only need this environment variable set if you want to use Mistral models
|
||||||
MISTRAL_API_KEY=
|
MISTRAL_API_KEY=
|
||||||
|
|
||||||
|
# Get your xAI API key
|
||||||
|
# https://x.ai/api
|
||||||
|
# You only need this environment variable set if you want to use xAI models
|
||||||
|
XAI_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
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -29,3 +29,6 @@ dist-ssr
|
|||||||
*.vars
|
*.vars
|
||||||
.wrangler
|
.wrangler
|
||||||
_worker.bundle
|
_worker.bundle
|
||||||
|
|
||||||
|
Modelfile
|
||||||
|
modelfiles
|
||||||
|
115
CONTRIBUTING.md
115
CONTRIBUTING.md
@ -8,6 +8,7 @@ First off, thank you for considering contributing to Bolt.new! This fork aims to
|
|||||||
- [Pull Request Guidelines](#pull-request-guidelines)
|
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||||
- [Coding Standards](#coding-standards)
|
- [Coding Standards](#coding-standards)
|
||||||
- [Development Setup](#development-setup)
|
- [Development Setup](#development-setup)
|
||||||
|
- [Deploymnt with Docker](#docker-deployment-documentation)
|
||||||
- [Project Structure](#project-structure)
|
- [Project Structure](#project-structure)
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
@ -88,11 +89,113 @@ 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.
|
||||||
|
|
||||||
## Questions?
|
## Testing
|
||||||
|
|
||||||
For any questions about contributing, please:
|
Run the test suite with:
|
||||||
1. Check existing documentation
|
|
||||||
2. Search through issues
|
|
||||||
3. Create a new issue with the question label
|
|
||||||
|
|
||||||
Thank you for contributing to Bolt.new! 🚀
|
```bash
|
||||||
|
pnpm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
To deploy the application to Cloudflare Pages:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm run deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account.
|
||||||
|
|
||||||
|
# Docker Deployment Documentation
|
||||||
|
|
||||||
|
This guide outlines various methods for building and deploying the application using Docker.
|
||||||
|
|
||||||
|
## Build Methods
|
||||||
|
|
||||||
|
### 1. Using Helper Scripts
|
||||||
|
|
||||||
|
NPM scripts are provided for convenient building:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Development build
|
||||||
|
npm run dockerbuild
|
||||||
|
|
||||||
|
# Production build
|
||||||
|
npm run dockerbuild:prod
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Direct Docker Build Commands
|
||||||
|
|
||||||
|
You can use Docker's target feature to specify the build environment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Development build
|
||||||
|
docker build . --target bolt-ai-development
|
||||||
|
|
||||||
|
# Production build
|
||||||
|
docker build . --target bolt-ai-production
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Docker Compose with Profiles
|
||||||
|
|
||||||
|
Use Docker Compose profiles to manage different environments:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Development environment
|
||||||
|
docker-compose --profile development up
|
||||||
|
|
||||||
|
# Production environment
|
||||||
|
docker-compose --profile production up
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the Application
|
||||||
|
|
||||||
|
After building using any of the methods above, run the container with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Development
|
||||||
|
docker run -p 5173:5173 --env-file .env.local bolt-ai:development
|
||||||
|
|
||||||
|
# Production
|
||||||
|
docker run -p 5173:5173 --env-file .env.local bolt-ai:production
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment with Coolify
|
||||||
|
|
||||||
|
[Coolify](https://github.com/coollabsio/coolify) provides a straightforward deployment process:
|
||||||
|
|
||||||
|
1. Import your Git repository as a new project
|
||||||
|
2. Select your target environment (development/production)
|
||||||
|
3. Choose "Docker Compose" as the Build Pack
|
||||||
|
4. Configure deployment domains
|
||||||
|
5. Set the custom start command:
|
||||||
|
```bash
|
||||||
|
docker compose --profile production up
|
||||||
|
```
|
||||||
|
6. Configure environment variables
|
||||||
|
- Add necessary AI API keys
|
||||||
|
- Adjust other environment variables as needed
|
||||||
|
7. Deploy the application
|
||||||
|
|
||||||
|
## VS Code Integration
|
||||||
|
|
||||||
|
The `docker-compose.yaml` configuration is compatible with VS Code dev containers:
|
||||||
|
|
||||||
|
1. Open the command palette in VS Code
|
||||||
|
2. Select the dev container configuration
|
||||||
|
3. Choose the "development" profile from the context menu
|
||||||
|
|
||||||
|
## Environment Files
|
||||||
|
|
||||||
|
Ensure you have the appropriate `.env.local` file configured before running the containers. This file should contain:
|
||||||
|
- API keys
|
||||||
|
- Environment-specific configurations
|
||||||
|
- Other required environment variables
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Port 5173 is exposed and mapped for both development and production environments
|
||||||
|
- Environment variables are loaded from `.env.local`
|
||||||
|
- Different profiles (development/production) can be used for different deployment scenarios
|
||||||
|
- The configuration supports both local development and production deployment
|
||||||
|
76
Dockerfile
76
Dockerfile
@ -1,29 +1,67 @@
|
|||||||
# Use an official Node.js runtime as the base image
|
ARG BASE=node:20.18.0
|
||||||
FROM node:20.15.1
|
FROM ${BASE} AS base
|
||||||
|
|
||||||
# Set the working directory in the container
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install pnpm
|
# Install dependencies (this step is cached as long as the dependencies don't change)
|
||||||
RUN npm install -g pnpm@9.4.0
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
# Copy package.json and pnpm-lock.yaml (if available)
|
RUN corepack enable pnpm && pnpm install
|
||||||
COPY package.json pnpm-lock.yaml* ./
|
|
||||||
|
|
||||||
# Install dependencies
|
# Copy the rest of your app's source code
|
||||||
RUN pnpm install
|
|
||||||
|
|
||||||
# Copy the rest of the application code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
# Expose the port the app runs on
|
||||||
RUN pnpm run build
|
EXPOSE 5173
|
||||||
|
|
||||||
# Make sure bindings.sh is executable
|
# Production image
|
||||||
RUN chmod +x bindings.sh
|
FROM base AS bolt-ai-production
|
||||||
|
|
||||||
# Expose the port the app runs on (adjust if you specified a different port)
|
# Define environment variables with default values or let them be overridden
|
||||||
EXPOSE 3000
|
ARG GROQ_API_KEY
|
||||||
|
ARG OPENAI_API_KEY
|
||||||
|
ARG ANTHROPIC_API_KEY
|
||||||
|
ARG OPEN_ROUTER_API_KEY
|
||||||
|
ARG GOOGLE_GENERATIVE_AI_API_KEY
|
||||||
|
ARG OLLAMA_API_BASE_URL
|
||||||
|
ARG VITE_LOG_LEVEL=debug
|
||||||
|
|
||||||
# Start the application
|
ENV WRANGLER_SEND_METRICS=false \
|
||||||
CMD ["pnpm", "run", "start"]
|
GROQ_API_KEY=${GROQ_API_KEY} \
|
||||||
|
OPENAI_API_KEY=${OPENAI_API_KEY} \
|
||||||
|
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \
|
||||||
|
OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \
|
||||||
|
GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \
|
||||||
|
OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \
|
||||||
|
VITE_LOG_LEVEL=${VITE_LOG_LEVEL}
|
||||||
|
|
||||||
|
# Pre-configure wrangler to disable metrics
|
||||||
|
RUN mkdir -p /root/.config/.wrangler && \
|
||||||
|
echo '{"enabled":false}' > /root/.config/.wrangler/metrics.json
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
CMD [ "pnpm", "run", "dockerstart"]
|
||||||
|
|
||||||
|
# Development image
|
||||||
|
FROM base AS bolt-ai-development
|
||||||
|
|
||||||
|
# Define the same environment variables for development
|
||||||
|
ARG GROQ_API_KEY
|
||||||
|
ARG OPENAI_API_KEY
|
||||||
|
ARG ANTHROPIC_API_KEY
|
||||||
|
ARG OPEN_ROUTER_API_KEY
|
||||||
|
ARG GOOGLE_GENERATIVE_AI_API_KEY
|
||||||
|
ARG OLLAMA_API_BASE_URL
|
||||||
|
ARG VITE_LOG_LEVEL=debug
|
||||||
|
|
||||||
|
ENV GROQ_API_KEY=${GROQ_API_KEY} \
|
||||||
|
OPENAI_API_KEY=${OPENAI_API_KEY} \
|
||||||
|
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \
|
||||||
|
OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \
|
||||||
|
GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \
|
||||||
|
OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \
|
||||||
|
VITE_LOG_LEVEL=${VITE_LOG_LEVEL}
|
||||||
|
|
||||||
|
RUN mkdir -p ${WORKDIR}/run
|
||||||
|
CMD pnpm run dev --host
|
||||||
|
146
README.md
146
README.md
@ -20,6 +20,7 @@ This fork of Bolt.new allows you to choose the LLM that you use for each prompt!
|
|||||||
- ✅ Publish projects directly to GitHub (@goncaloalves)
|
- ✅ Publish projects directly to GitHub (@goncaloalves)
|
||||||
- ⬜ Prevent Bolt from rewriting files as often (Done but need to review PR still)
|
- ⬜ Prevent Bolt from rewriting files as often (Done but need to review PR still)
|
||||||
- ⬜ **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** Load local projects into the app
|
||||||
- ⬜ **HIGH PRIORITY** - Attach images to prompts
|
- ⬜ **HIGH PRIORITY** - Attach images to prompts
|
||||||
- ⬜ **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
|
||||||
- ⬜ LM Studio Integration
|
- ⬜ LM Studio Integration
|
||||||
@ -27,12 +28,17 @@ This fork of Bolt.new allows you to choose the LLM that you use for each prompt!
|
|||||||
- ⬜ Azure Open AI API Integration
|
- ⬜ Azure Open AI API Integration
|
||||||
- ⬜ HuggingFace Integration
|
- ⬜ HuggingFace Integration
|
||||||
- ⬜ Perplexity Integration
|
- ⬜ Perplexity Integration
|
||||||
|
- ⬜ Vertex AI Integration
|
||||||
|
- ⬜ Cohere Integration
|
||||||
- ⬜ Deploy directly to Vercel/Netlify/other similar platforms
|
- ⬜ Deploy directly to Vercel/Netlify/other similar platforms
|
||||||
- ⬜ Load local projects into the app
|
|
||||||
- ⬜ Ability to revert code to earlier version
|
- ⬜ Ability to revert code to earlier version
|
||||||
- ⬜ Prompt caching
|
- ⬜ Prompt caching
|
||||||
|
- ⬜ Better prompt enhancing
|
||||||
- ⬜ Ability to enter API keys in the UI
|
- ⬜ Ability to enter API keys in the UI
|
||||||
- ⬜ Have LLM plan the project in a MD file for better results/transparency
|
- ⬜ Have LLM plan the project in a MD file for better results/transparency
|
||||||
|
- ⬜ VSCode Integration with git-like confirmations
|
||||||
|
- ⬜ Upload documents for knowledge - UI design templates, a code base to reference coding style, etc.
|
||||||
|
- ⬜ Voice prompting
|
||||||
|
|
||||||
# Bolt.new: AI-Powered Full-Stack Web Development in the Browser
|
# Bolt.new: AI-Powered Full-Stack Web Development in the Browser
|
||||||
|
|
||||||
@ -55,28 +61,47 @@ Whether you’re an experienced developer, a PM, or a designer, Bolt.new allows
|
|||||||
|
|
||||||
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!
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Before you begin, ensure you have the following installed:
|
|
||||||
|
|
||||||
- Node.js (v20.15.1)
|
|
||||||
- pnpm (v9.4.0)
|
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
1. Clone the repository (if you haven't already):
|
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.
|
||||||
|
|
||||||
```bash
|
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:
|
||||||
|
|
||||||
|
```
|
||||||
|
echo $PATH .
|
||||||
|
```
|
||||||
|
|
||||||
|
If you see usr/local/bin in the output then you're good to go.
|
||||||
|
|
||||||
|
3. Clone the repository (if you haven't already) by opening a Terminal window (or CMD with admin permissions) and then typing in this:
|
||||||
|
|
||||||
|
```
|
||||||
git clone https://github.com/coleam00/bolt.new-any-llm.git
|
git clone https://github.com/coleam00/bolt.new-any-llm.git
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install dependencies:
|
3. Rename .env.example to .env 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.
|
||||||
|
|
||||||
```bash
|

|
||||||
pnpm install
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
```
|
||||||
|
defaults write com.apple.finder AppleShowAllFiles YES
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Rename `.env.example` to .env.local and add your LLM API keys (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 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
|
GROQ_API_KEY=XXX
|
||||||
@ -90,7 +115,98 @@ Optionally, you can set the debug level:
|
|||||||
VITE_LOG_LEVEL=debug
|
VITE_LOG_LEVEL=debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore.
|
**Important**: Never commit your `.env` file to version control. It's already included in .gitignore.
|
||||||
|
|
||||||
|
## Run with Docker
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
|
||||||
|
Git and Node.js as mentioned above, as well as Docker: https://www.docker.com/
|
||||||
|
|
||||||
|
### 1a. Using Helper Scripts
|
||||||
|
|
||||||
|
NPM scripts are provided for convenient building:
|
||||||
|
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
## Super Important Note on Running Ollama Models
|
||||||
|
|
||||||
|
Ollama models by default only have 2048 tokens for their context window. Even for large models that can easily handle way more.
|
||||||
|
This is not a large enough window to handle the Bolt.new/oTToDev prompt! You have to create a version of any model you want
|
||||||
|
to use where you specify a larger context window. Luckily it's super easy to do that.
|
||||||
|
|
||||||
|
All you have to do is:
|
||||||
|
|
||||||
|
- Create a file called "Modelfile" (no file extension) anywhere on your computer
|
||||||
|
- Put in the two lines:
|
||||||
|
|
||||||
|
```
|
||||||
|
FROM [Ollama model ID such as qwen2.5-coder:7b]
|
||||||
|
PARAMETER num_ctx 32768
|
||||||
|
```
|
||||||
|
|
||||||
|
- Run the command:
|
||||||
|
|
||||||
|
```
|
||||||
|
ollama create -f Modelfile [your new model ID, can be whatever you want (example: qwen2.5-coder-extra-ctx:7b)]
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you have a new Ollama model that isn't heavily limited in the context length like Ollama models are by default for some reason.
|
||||||
|
You'll see this new model in the list of Ollama models along with all the others you pulled!
|
||||||
|
|
||||||
## Adding New LLMs:
|
## Adding New LLMs:
|
||||||
|
|
||||||
|
49
app/components/chat/APIKeyManager.tsx
Normal file
49
app/components/chat/APIKeyManager.tsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { IconButton } from '~/components/ui/IconButton';
|
||||||
|
|
||||||
|
interface APIKeyManagerProps {
|
||||||
|
provider: string;
|
||||||
|
apiKey: string;
|
||||||
|
setApiKey: (key: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const APIKeyManager: React.FC<APIKeyManagerProps> = ({ provider, apiKey, setApiKey }) => {
|
||||||
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
const [tempKey, setTempKey] = useState(apiKey);
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
setApiKey(tempKey);
|
||||||
|
setIsEditing(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-2 mt-2 mb-2">
|
||||||
|
<span className="text-sm text-bolt-elements-textSecondary">{provider} API Key:</span>
|
||||||
|
{isEditing ? (
|
||||||
|
<>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
value={tempKey}
|
||||||
|
onChange={(e) => setTempKey(e.target.value)}
|
||||||
|
className="flex-1 p-1 text-sm rounded 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"
|
||||||
|
/>
|
||||||
|
<IconButton onClick={handleSave} title="Save API Key">
|
||||||
|
<div className="i-ph:check" />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton onClick={() => setIsEditing(false)} title="Cancel">
|
||||||
|
<div className="i-ph:x" />
|
||||||
|
</IconButton>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<span className="flex-1 text-sm text-bolt-elements-textPrimary">
|
||||||
|
{apiKey ? '••••••••' : 'Not set (will still work if set in .env file)'}
|
||||||
|
</span>
|
||||||
|
<IconButton onClick={() => setIsEditing(true)} title="Edit API Key">
|
||||||
|
<div className="i-ph:pencil-simple" />
|
||||||
|
</IconButton>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// Preventing TS checks with files presented in the video for a better presentation.
|
// Preventing TS checks with files presented in the video for a better presentation.
|
||||||
import type { Message } from 'ai';
|
import type { Message } from 'ai';
|
||||||
import React, { type RefCallback } from 'react';
|
import React, { type RefCallback, useEffect } from 'react';
|
||||||
import { ClientOnly } from 'remix-utils/client-only';
|
import { ClientOnly } from 'remix-utils/client-only';
|
||||||
import { Menu } from '~/components/sidebar/Menu.client';
|
import { Menu } from '~/components/sidebar/Menu.client';
|
||||||
import { IconButton } from '~/components/ui/IconButton';
|
import { IconButton } from '~/components/ui/IconButton';
|
||||||
@ -11,6 +11,8 @@ import { MODEL_LIST, DEFAULT_PROVIDER } from '~/utils/constants';
|
|||||||
import { Messages } from './Messages.client';
|
import { Messages } from './Messages.client';
|
||||||
import { SendButton } from './SendButton.client';
|
import { SendButton } from './SendButton.client';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { APIKeyManager } from './APIKeyManager';
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
import styles from './BaseChat.module.scss';
|
import styles from './BaseChat.module.scss';
|
||||||
|
|
||||||
@ -24,10 +26,9 @@ const EXAMPLE_PROMPTS = [
|
|||||||
|
|
||||||
const providerList = [...new Set(MODEL_LIST.map((model) => model.provider))]
|
const providerList = [...new Set(MODEL_LIST.map((model) => model.provider))]
|
||||||
|
|
||||||
const ModelSelector = ({ model, setModel, modelList, providerList }) => {
|
const ModelSelector = ({ model, setModel, provider, setProvider, modelList, providerList }) => {
|
||||||
const [provider, setProvider] = useState(DEFAULT_PROVIDER);
|
|
||||||
return (
|
return (
|
||||||
<div className="mb-2">
|
<div className="mb-2 flex gap-2">
|
||||||
<select
|
<select
|
||||||
value={provider}
|
value={provider}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
@ -35,7 +36,7 @@ const ModelSelector = ({ model, setModel, modelList, providerList }) => {
|
|||||||
const firstModel = [...modelList].find(m => m.provider == e.target.value);
|
const firstModel = [...modelList].find(m => m.provider == e.target.value);
|
||||||
setModel(firstModel ? firstModel.name : '');
|
setModel(firstModel ? firstModel.name : '');
|
||||||
}}
|
}}
|
||||||
className="w-full p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none"
|
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"
|
||||||
>
|
>
|
||||||
{providerList.map((provider) => (
|
{providerList.map((provider) => (
|
||||||
<option key={provider} value={provider}>
|
<option key={provider} value={provider}>
|
||||||
@ -52,7 +53,7 @@ const ModelSelector = ({ model, setModel, modelList, providerList }) => {
|
|||||||
<select
|
<select
|
||||||
value={model}
|
value={model}
|
||||||
onChange={(e) => setModel(e.target.value)}
|
onChange={(e) => setModel(e.target.value)}
|
||||||
className="w-full p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none"
|
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"
|
||||||
>
|
>
|
||||||
{[...modelList].filter(e => e.provider == provider && e.name).map((modelOption) => (
|
{[...modelList].filter(e => e.provider == provider && e.name).map((modelOption) => (
|
||||||
<option key={modelOption.name} value={modelOption.name}>
|
<option key={modelOption.name} value={modelOption.name}>
|
||||||
@ -79,6 +80,8 @@ interface BaseChatProps {
|
|||||||
input?: string;
|
input?: string;
|
||||||
model: string;
|
model: string;
|
||||||
setModel: (model: string) => void;
|
setModel: (model: string) => void;
|
||||||
|
provider: string;
|
||||||
|
setProvider: (provider: string) => void;
|
||||||
handleStop?: () => void;
|
handleStop?: () => void;
|
||||||
sendMessage?: (event: React.UIEvent, messageInput?: string) => void;
|
sendMessage?: (event: React.UIEvent, messageInput?: string) => void;
|
||||||
handleInputChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
handleInputChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
||||||
@ -100,6 +103,8 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
input = '',
|
input = '',
|
||||||
model,
|
model,
|
||||||
setModel,
|
setModel,
|
||||||
|
provider,
|
||||||
|
setProvider,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
enhancePrompt,
|
enhancePrompt,
|
||||||
@ -108,6 +113,40 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
|
const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
|
||||||
|
const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Load API keys from cookies on component mount
|
||||||
|
try {
|
||||||
|
const storedApiKeys = Cookies.get('apiKeys');
|
||||||
|
if (storedApiKeys) {
|
||||||
|
const parsedKeys = JSON.parse(storedApiKeys);
|
||||||
|
if (typeof parsedKeys === 'object' && parsedKeys !== null) {
|
||||||
|
setApiKeys(parsedKeys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading API keys from cookies:', error);
|
||||||
|
// Clear invalid cookie data
|
||||||
|
Cookies.remove('apiKeys');
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const updateApiKey = (provider: string, key: string) => {
|
||||||
|
try {
|
||||||
|
const updatedApiKeys = { ...apiKeys, [provider]: key };
|
||||||
|
setApiKeys(updatedApiKeys);
|
||||||
|
// Save updated API keys to cookies with 30 day expiry and secure settings
|
||||||
|
Cookies.set('apiKeys', JSON.stringify(updatedApiKeys), {
|
||||||
|
expires: 30, // 30 days
|
||||||
|
secure: true, // Only send over HTTPS
|
||||||
|
sameSite: 'strict', // Protect against CSRF
|
||||||
|
path: '/' // Accessible across the site
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error saving API keys to cookies:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -122,11 +161,11 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
<div ref={scrollRef} className="flex overflow-y-auto w-full h-full">
|
<div ref={scrollRef} className="flex overflow-y-auto w-full h-full">
|
||||||
<div className={classNames(styles.Chat, 'flex flex-col flex-grow min-w-[var(--chat-min-width)] h-full')}>
|
<div className={classNames(styles.Chat, 'flex flex-col flex-grow min-w-[var(--chat-min-width)] h-full')}>
|
||||||
{!chatStarted && (
|
{!chatStarted && (
|
||||||
<div id="intro" className="mt-[26vh] max-w-chat mx-auto">
|
<div id="intro" className="mt-[26vh] max-w-chat mx-auto text-center">
|
||||||
<h1 className="text-5xl text-center font-bold text-bolt-elements-textPrimary mb-2">
|
<h1 className="text-6xl font-bold text-bolt-elements-textPrimary mb-4 animate-fade-in">
|
||||||
Where ideas begin
|
Where ideas begin
|
||||||
</h1>
|
</h1>
|
||||||
<p className="mb-4 text-center text-bolt-elements-textSecondary">
|
<p className="text-xl mb-8 text-bolt-elements-textSecondary animate-fade-in animation-delay-200">
|
||||||
Bring ideas to life in seconds or get help on existing projects.
|
Bring ideas to life in seconds or get help on existing projects.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -157,16 +196,23 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
model={model}
|
model={model}
|
||||||
setModel={setModel}
|
setModel={setModel}
|
||||||
modelList={MODEL_LIST}
|
modelList={MODEL_LIST}
|
||||||
|
provider={provider}
|
||||||
|
setProvider={setProvider}
|
||||||
providerList={providerList}
|
providerList={providerList}
|
||||||
/>
|
/>
|
||||||
|
<APIKeyManager
|
||||||
|
provider={provider}
|
||||||
|
apiKey={apiKeys[provider] || ''}
|
||||||
|
setApiKey={(key) => updateApiKey(provider, key)}
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'shadow-sm border border-bolt-elements-borderColor bg-bolt-elements-prompt-background backdrop-filter backdrop-blur-[8px] rounded-lg overflow-hidden',
|
'shadow-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background backdrop-filter backdrop-blur-[8px] rounded-lg overflow-hidden transition-all',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<textarea
|
<textarea
|
||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
className={`w-full pl-4 pt-4 pr-16 focus:outline-none resize-none text-md text-bolt-elements-textPrimary placeholder-bolt-elements-textTertiary bg-transparent`}
|
className={`w-full pl-4 pt-4 pr-16 focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus resize-none text-md text-bolt-elements-textPrimary placeholder-bolt-elements-textTertiary bg-transparent transition-all`}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
@ -205,12 +251,12 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</ClientOnly>
|
</ClientOnly>
|
||||||
<div className="flex justify-between text-sm p-4 pt-2">
|
<div className="flex justify-between items-center text-sm p-4 pt-2">
|
||||||
<div className="flex gap-1 items-center">
|
<div className="flex gap-1 items-center">
|
||||||
<IconButton
|
<IconButton
|
||||||
title="Enhance prompt"
|
title="Enhance prompt"
|
||||||
disabled={input.length === 0 || enhancingPrompt}
|
disabled={input.length === 0 || enhancingPrompt}
|
||||||
className={classNames({
|
className={classNames('transition-all', {
|
||||||
'opacity-100!': enhancingPrompt,
|
'opacity-100!': enhancingPrompt,
|
||||||
'text-bolt-elements-item-contentAccent! pr-1.5 enabled:hover:bg-bolt-elements-item-backgroundAccent!':
|
'text-bolt-elements-item-contentAccent! pr-1.5 enabled:hover:bg-bolt-elements-item-backgroundAccent!':
|
||||||
promptEnhanced,
|
promptEnhanced,
|
||||||
@ -219,7 +265,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
>
|
>
|
||||||
{enhancingPrompt ? (
|
{enhancingPrompt ? (
|
||||||
<>
|
<>
|
||||||
<div className="i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress text-xl"></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="ml-1.5">Enhancing prompt...</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@ -232,7 +278,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
</div>
|
</div>
|
||||||
{input.length > 3 ? (
|
{input.length > 3 ? (
|
||||||
<div className="text-xs text-bolt-elements-textTertiary">
|
<div className="text-xs text-bolt-elements-textTertiary">
|
||||||
Use <kbd className="kdb">Shift</kbd> + <kbd className="kdb">Return</kbd> for a new line
|
Use <kbd className="kdb px-1.5 py-0.5 rounded bg-bolt-elements-background-depth-2">Shift</kbd> + <kbd className="kdb px-1.5 py-0.5 rounded bg-bolt-elements-background-depth-2">Return</kbd> for a new line
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,10 +11,11 @@ import { useChatHistory } from '~/lib/persistence';
|
|||||||
import { chatStore } from '~/lib/stores/chat';
|
import { chatStore } from '~/lib/stores/chat';
|
||||||
import { workbenchStore } from '~/lib/stores/workbench';
|
import { workbenchStore } from '~/lib/stores/workbench';
|
||||||
import { fileModificationsToHTML } from '~/utils/diff';
|
import { fileModificationsToHTML } from '~/utils/diff';
|
||||||
import { DEFAULT_MODEL } from '~/utils/constants';
|
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from '~/utils/constants';
|
||||||
import { cubicEasingFn } from '~/utils/easings';
|
import { cubicEasingFn } from '~/utils/easings';
|
||||||
import { createScopedLogger, renderLogger } from '~/utils/logger';
|
import { createScopedLogger, renderLogger } from '~/utils/logger';
|
||||||
import { BaseChat } from './BaseChat';
|
import { BaseChat } from './BaseChat';
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
const toastAnimation = cssTransition({
|
const toastAnimation = cssTransition({
|
||||||
enter: 'animated fadeInRight',
|
enter: 'animated fadeInRight',
|
||||||
@ -74,13 +75,19 @@ export const ChatImpl = memo(({ initialMessages, storeMessageHistory }: ChatProp
|
|||||||
|
|
||||||
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
|
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
|
||||||
const [model, setModel] = useState(DEFAULT_MODEL);
|
const [model, setModel] = useState(DEFAULT_MODEL);
|
||||||
|
const [provider, setProvider] = useState(DEFAULT_PROVIDER);
|
||||||
|
|
||||||
const { showChat } = useStore(chatStore);
|
const { showChat } = useStore(chatStore);
|
||||||
|
|
||||||
const [animationScope, animate] = useAnimate();
|
const [animationScope, animate] = useAnimate();
|
||||||
|
|
||||||
|
const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
|
||||||
|
|
||||||
const { messages, isLoading, input, handleInputChange, setInput, stop, append } = useChat({
|
const { messages, isLoading, input, handleInputChange, setInput, stop, append } = useChat({
|
||||||
api: '/api/chat',
|
api: '/api/chat',
|
||||||
|
body: {
|
||||||
|
apiKeys
|
||||||
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
logger.error('Request failed\n\n', error);
|
logger.error('Request failed\n\n', error);
|
||||||
toast.error('There was an error processing your request');
|
toast.error('There was an error processing your request');
|
||||||
@ -182,7 +189,7 @@ export const ChatImpl = memo(({ initialMessages, storeMessageHistory }: ChatProp
|
|||||||
* manually reset the input and we'd have to manually pass in file attachments. However, those
|
* manually reset the input and we'd have to manually pass in file attachments. However, those
|
||||||
* aren't relevant here.
|
* aren't relevant here.
|
||||||
*/
|
*/
|
||||||
append({ role: 'user', content: `[Model: ${model}]\n\n${diff}\n\n${_input}` });
|
append({ role: 'user', content: `[Model: ${model}]\n\n[Provider: ${provider}]\n\n${diff}\n\n${_input}` });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After sending a new message we reset all modifications since the model
|
* After sending a new message we reset all modifications since the model
|
||||||
@ -190,7 +197,7 @@ export const ChatImpl = memo(({ initialMessages, storeMessageHistory }: ChatProp
|
|||||||
*/
|
*/
|
||||||
workbenchStore.resetAllFileModifications();
|
workbenchStore.resetAllFileModifications();
|
||||||
} else {
|
} else {
|
||||||
append({ role: 'user', content: `[Model: ${model}]\n\n${_input}` });
|
append({ role: 'user', content: `[Model: ${model}]\n\n[Provider: ${provider}]\n\n${_input}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
setInput('');
|
setInput('');
|
||||||
@ -202,6 +209,13 @@ export const ChatImpl = memo(({ initialMessages, storeMessageHistory }: ChatProp
|
|||||||
|
|
||||||
const [messageRef, scrollRef] = useSnapScroll();
|
const [messageRef, scrollRef] = useSnapScroll();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const storedApiKeys = Cookies.get('apiKeys');
|
||||||
|
if (storedApiKeys) {
|
||||||
|
setApiKeys(JSON.parse(storedApiKeys));
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseChat
|
<BaseChat
|
||||||
ref={animationScope}
|
ref={animationScope}
|
||||||
@ -215,6 +229,8 @@ export const ChatImpl = memo(({ initialMessages, storeMessageHistory }: ChatProp
|
|||||||
sendMessage={sendMessage}
|
sendMessage={sendMessage}
|
||||||
model={model}
|
model={model}
|
||||||
setModel={setModel}
|
setModel={setModel}
|
||||||
|
provider={provider}
|
||||||
|
setProvider={setProvider}
|
||||||
messageRef={messageRef}
|
messageRef={messageRef}
|
||||||
scrollRef={scrollRef}
|
scrollRef={scrollRef}
|
||||||
handleInputChange={handleInputChange}
|
handleInputChange={handleInputChange}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// Preventing TS checks with files presented in the video for a better presentation.
|
// Preventing TS checks with files presented in the video for a better presentation.
|
||||||
import { modificationsRegex } from '~/utils/diff';
|
import { modificationsRegex } from '~/utils/diff';
|
||||||
import { MODEL_REGEX } from '~/utils/constants';
|
import { MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
|
||||||
import { Markdown } from './Markdown';
|
import { Markdown } from './Markdown';
|
||||||
|
|
||||||
interface UserMessageProps {
|
interface UserMessageProps {
|
||||||
@ -17,5 +17,5 @@ export function UserMessage({ content }: UserMessageProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeUserMessage(content: string) {
|
function sanitizeUserMessage(content: string) {
|
||||||
return content.replace(modificationsRegex, '').replace(MODEL_REGEX, '').trim();
|
return content.replace(modificationsRegex, '').replace(MODEL_REGEX, 'Using: $1').replace(PROVIDER_REGEX, ' ($1)\n\n').trim();
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,18 @@
|
|||||||
// Preventing TS checks with files presented in the video for a better presentation.
|
// Preventing TS checks with files presented in the video for a better presentation.
|
||||||
import { env } from 'node:process';
|
import { env } from 'node:process';
|
||||||
|
|
||||||
export function getAPIKey(cloudflareEnv: Env, provider: string) {
|
export function getAPIKey(cloudflareEnv: Env, provider: string, userApiKeys?: Record<string, string>) {
|
||||||
/**
|
/**
|
||||||
* The `cloudflareEnv` is only used when deployed or when previewing locally.
|
* The `cloudflareEnv` is only used when deployed or when previewing locally.
|
||||||
* In development the environment variables are available through `env`.
|
* In development the environment variables are available through `env`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// First check user-provided API keys
|
||||||
|
if (userApiKeys?.[provider]) {
|
||||||
|
return userApiKeys[provider];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to environment variables
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
case 'Anthropic':
|
case 'Anthropic':
|
||||||
return env.ANTHROPIC_API_KEY || cloudflareEnv.ANTHROPIC_API_KEY;
|
return env.ANTHROPIC_API_KEY || cloudflareEnv.ANTHROPIC_API_KEY;
|
||||||
@ -25,6 +31,8 @@ export function getAPIKey(cloudflareEnv: Env, provider: string) {
|
|||||||
return env.MISTRAL_API_KEY || cloudflareEnv.MISTRAL_API_KEY;
|
return env.MISTRAL_API_KEY || cloudflareEnv.MISTRAL_API_KEY;
|
||||||
case "OpenAILike":
|
case "OpenAILike":
|
||||||
return env.OPENAI_LIKE_API_KEY || cloudflareEnv.OPENAI_LIKE_API_KEY;
|
return env.OPENAI_LIKE_API_KEY || cloudflareEnv.OPENAI_LIKE_API_KEY;
|
||||||
|
case "xAI":
|
||||||
|
return env.XAI_API_KEY || cloudflareEnv.XAI_API_KEY;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -35,7 +43,11 @@ export function getBaseURL(cloudflareEnv: Env, provider: string) {
|
|||||||
case 'OpenAILike':
|
case 'OpenAILike':
|
||||||
return env.OPENAI_LIKE_API_BASE_URL || cloudflareEnv.OPENAI_LIKE_API_BASE_URL;
|
return env.OPENAI_LIKE_API_BASE_URL || cloudflareEnv.OPENAI_LIKE_API_BASE_URL;
|
||||||
case 'Ollama':
|
case 'Ollama':
|
||||||
return env.OLLAMA_API_BASE_URL || cloudflareEnv.OLLAMA_API_BASE_URL || "http://localhost:11434";
|
let baseUrl = env.OLLAMA_API_BASE_URL || cloudflareEnv.OLLAMA_API_BASE_URL || "http://localhost:11434";
|
||||||
|
if (env.RUNNING_IN_DOCKER === 'true') {
|
||||||
|
baseUrl = baseUrl.replace("localhost", "host.docker.internal");
|
||||||
|
}
|
||||||
|
return baseUrl;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,10 @@ export function getGroqModel(apiKey: string, model: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getOllamaModel(baseURL: string, model: string) {
|
export function getOllamaModel(baseURL: string, model: string) {
|
||||||
let Ollama = ollama(model);
|
let Ollama = ollama(model, {
|
||||||
|
numCtx: 32768,
|
||||||
|
});
|
||||||
|
|
||||||
Ollama.config.baseURL = `${baseURL}/api`;
|
Ollama.config.baseURL = `${baseURL}/api`;
|
||||||
return Ollama;
|
return Ollama;
|
||||||
}
|
}
|
||||||
@ -80,8 +83,16 @@ export function getOpenRouterModel(apiKey: string, model: string) {
|
|||||||
return openRouter.chat(model);
|
return openRouter.chat(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModel(provider: string, model: string, env: Env) {
|
export function getXAIModel(apiKey: string, model: string) {
|
||||||
const apiKey = getAPIKey(env, provider);
|
const openai = createOpenAI({
|
||||||
|
baseURL: 'https://api.x.ai/v1',
|
||||||
|
apiKey,
|
||||||
|
});
|
||||||
|
|
||||||
|
return openai(model);
|
||||||
|
}
|
||||||
|
export function getModel(provider: string, model: string, env: Env, apiKeys?: Record<string, string>) {
|
||||||
|
const apiKey = getAPIKey(env, provider, apiKeys);
|
||||||
const baseURL = getBaseURL(env, provider);
|
const baseURL = getBaseURL(env, provider);
|
||||||
|
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
@ -101,6 +112,8 @@ export function getModel(provider: string, model: string, env: Env) {
|
|||||||
return getDeepseekModel(apiKey, model)
|
return getDeepseekModel(apiKey, model)
|
||||||
case 'Mistral':
|
case 'Mistral':
|
||||||
return getMistralModel(apiKey, model);
|
return getMistralModel(apiKey, model);
|
||||||
|
case 'xAI':
|
||||||
|
return getXAIModel(apiKey, model);
|
||||||
default:
|
default:
|
||||||
return getOllamaModel(baseURL, model);
|
return getOllamaModel(baseURL, model);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { streamText as _streamText, convertToCoreMessages } 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 './prompts';
|
||||||
import { MODEL_LIST, DEFAULT_MODEL, DEFAULT_PROVIDER } from '~/utils/constants';
|
import { MODEL_LIST, DEFAULT_MODEL, DEFAULT_PROVIDER, MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
|
||||||
|
|
||||||
interface ToolResult<Name extends string, Args, Result> {
|
interface ToolResult<Name extends string, Args, Result> {
|
||||||
toolCallId: string;
|
toolCallId: string;
|
||||||
@ -24,42 +24,53 @@ export type Messages = Message[];
|
|||||||
|
|
||||||
export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;
|
export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;
|
||||||
|
|
||||||
function extractModelFromMessage(message: Message): { model: string; content: string } {
|
function extractPropertiesFromMessage(message: Message): { model: string; provider: string; content: string } {
|
||||||
const modelRegex = /^\[Model: (.*?)\]\n\n/;
|
// Extract model
|
||||||
const match = message.content.match(modelRegex);
|
const modelMatch = message.content.match(MODEL_REGEX);
|
||||||
|
const model = modelMatch ? modelMatch[1] : DEFAULT_MODEL;
|
||||||
|
|
||||||
if (match) {
|
// Extract provider
|
||||||
const model = match[1];
|
const providerMatch = message.content.match(PROVIDER_REGEX);
|
||||||
const content = message.content.replace(modelRegex, '');
|
const provider = providerMatch ? providerMatch[1] : DEFAULT_PROVIDER;
|
||||||
return { model, content };
|
|
||||||
|
// Remove model and provider lines from content
|
||||||
|
const cleanedContent = message.content
|
||||||
|
.replace(MODEL_REGEX, '')
|
||||||
|
.replace(PROVIDER_REGEX, '')
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
return { model, provider, content: cleanedContent };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default model if not specified
|
export function streamText(
|
||||||
return { model: DEFAULT_MODEL, content: message.content };
|
messages: Messages,
|
||||||
}
|
env: Env,
|
||||||
|
options?: StreamingOptions,
|
||||||
export function streamText(messages: Messages, env: Env, options?: StreamingOptions) {
|
apiKeys?: Record<string, string>
|
||||||
|
) {
|
||||||
let currentModel = DEFAULT_MODEL;
|
let currentModel = DEFAULT_MODEL;
|
||||||
|
let currentProvider = DEFAULT_PROVIDER;
|
||||||
|
|
||||||
const processedMessages = messages.map((message) => {
|
const processedMessages = messages.map((message) => {
|
||||||
if (message.role === 'user') {
|
if (message.role === 'user') {
|
||||||
const { model, content } = extractModelFromMessage(message);
|
const { model, provider, content } = extractPropertiesFromMessage(message);
|
||||||
if (model && MODEL_LIST.find((m) => m.name === model)) {
|
|
||||||
currentModel = model; // Update the current model
|
if (MODEL_LIST.find((m) => m.name === model)) {
|
||||||
|
currentModel = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentProvider = provider;
|
||||||
|
|
||||||
return { ...message, content };
|
return { ...message, content };
|
||||||
}
|
}
|
||||||
return message;
|
|
||||||
|
return message; // No changes for non-user messages
|
||||||
});
|
});
|
||||||
|
|
||||||
const provider = MODEL_LIST.find((model) => model.name === currentModel)?.provider || DEFAULT_PROVIDER;
|
|
||||||
|
|
||||||
return _streamText({
|
return _streamText({
|
||||||
model: getModel(provider, currentModel, env),
|
model: getModel(currentProvider, currentModel, env, apiKeys),
|
||||||
system: getSystemPrompt(),
|
system: getSystemPrompt(),
|
||||||
maxTokens: MAX_TOKENS,
|
maxTokens: MAX_TOKENS,
|
||||||
// headers: {
|
|
||||||
// 'anthropic-beta': 'max-tokens-3-5-sonnet-2024-07-15',
|
|
||||||
// },
|
|
||||||
messages: convertToCoreMessages(processedMessages),
|
messages: convertToCoreMessages(processedMessages),
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
@ -11,13 +11,17 @@ export async function action(args: ActionFunctionArgs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function chatAction({ context, request }: ActionFunctionArgs) {
|
async function chatAction({ context, request }: ActionFunctionArgs) {
|
||||||
const { messages } = await request.json<{ messages: Messages }>();
|
const { messages, apiKeys } = await request.json<{
|
||||||
|
messages: Messages,
|
||||||
|
apiKeys: Record<string, string>
|
||||||
|
}>();
|
||||||
|
|
||||||
const stream = new SwitchableStream();
|
const stream = new SwitchableStream();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options: StreamingOptions = {
|
const options: StreamingOptions = {
|
||||||
toolChoice: 'none',
|
toolChoice: 'none',
|
||||||
|
apiKeys,
|
||||||
onFinish: async ({ text: content, finishReason }) => {
|
onFinish: async ({ text: content, finishReason }) => {
|
||||||
if (finishReason !== 'length') {
|
if (finishReason !== 'length') {
|
||||||
return stream.close();
|
return stream.close();
|
||||||
@ -40,7 +44,7 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await streamText(messages, context.cloudflare.env, options);
|
const result = await streamText(messages, context.cloudflare.env, options, apiKeys);
|
||||||
|
|
||||||
stream.switchSource(result.toAIStream());
|
stream.switchSource(result.toAIStream());
|
||||||
|
|
||||||
@ -53,6 +57,13 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
||||||
|
if (error.message?.includes('API key')) {
|
||||||
|
throw new Response('Invalid or missing API key', {
|
||||||
|
status: 401,
|
||||||
|
statusText: 'Unauthorized'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
throw new Response(null, {
|
throw new Response(null, {
|
||||||
status: 500,
|
status: 500,
|
||||||
statusText: 'Internal Server Error',
|
statusText: 'Internal Server Error',
|
||||||
|
@ -4,6 +4,7 @@ export const WORK_DIR_NAME = 'project';
|
|||||||
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
||||||
export const MODIFICATIONS_TAG_NAME = 'bolt_file_modifications';
|
export const MODIFICATIONS_TAG_NAME = 'bolt_file_modifications';
|
||||||
export const MODEL_REGEX = /^\[Model: (.*?)\]\n\n/;
|
export const MODEL_REGEX = /^\[Model: (.*?)\]\n\n/;
|
||||||
|
export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
|
||||||
export const DEFAULT_MODEL = 'claude-3-5-sonnet-20240620';
|
export const DEFAULT_MODEL = 'claude-3-5-sonnet-20240620';
|
||||||
export const DEFAULT_PROVIDER = 'Anthropic';
|
export const DEFAULT_PROVIDER = 'Anthropic';
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ const staticModels: ModelInfo[] = [
|
|||||||
{ name: 'deepseek/deepseek-coder', label: 'Deepseek-Coder V2 236B (OpenRouter)', provider: 'OpenRouter' },
|
{ name: 'deepseek/deepseek-coder', label: 'Deepseek-Coder V2 236B (OpenRouter)', provider: 'OpenRouter' },
|
||||||
{ name: 'google/gemini-flash-1.5', label: 'Google Gemini Flash 1.5 (OpenRouter)', provider: 'OpenRouter' },
|
{ name: 'google/gemini-flash-1.5', label: 'Google Gemini Flash 1.5 (OpenRouter)', provider: 'OpenRouter' },
|
||||||
{ name: 'google/gemini-pro-1.5', label: 'Google Gemini Pro 1.5 (OpenRouter)', provider: 'OpenRouter' },
|
{ name: 'google/gemini-pro-1.5', label: 'Google Gemini Pro 1.5 (OpenRouter)', provider: 'OpenRouter' },
|
||||||
|
{ name: 'x-ai/grok-beta', label: "xAI Grok Beta (OpenRouter)", provider: 'OpenRouter' },
|
||||||
{ name: 'mistralai/mistral-nemo', label: 'OpenRouter Mistral Nemo (OpenRouter)', provider: 'OpenRouter' },
|
{ name: 'mistralai/mistral-nemo', label: 'OpenRouter Mistral Nemo (OpenRouter)', provider: 'OpenRouter' },
|
||||||
{ name: 'qwen/qwen-110b-chat', label: 'OpenRouter Qwen 110b Chat (OpenRouter)', provider: 'OpenRouter' },
|
{ name: 'qwen/qwen-110b-chat', label: 'OpenRouter Qwen 110b Chat (OpenRouter)', provider: 'OpenRouter' },
|
||||||
{ name: 'cohere/command', label: 'Cohere Command (OpenRouter)', provider: 'OpenRouter' },
|
{ name: 'cohere/command', label: 'Cohere Command (OpenRouter)', provider: 'OpenRouter' },
|
||||||
@ -32,6 +34,7 @@ const staticModels: ModelInfo[] = [
|
|||||||
{ name: 'gpt-4-turbo', label: 'GPT-4 Turbo', provider: 'OpenAI' },
|
{ name: 'gpt-4-turbo', label: 'GPT-4 Turbo', provider: 'OpenAI' },
|
||||||
{ name: 'gpt-4', label: 'GPT-4', provider: 'OpenAI' },
|
{ name: 'gpt-4', label: 'GPT-4', provider: 'OpenAI' },
|
||||||
{ name: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo', provider: 'OpenAI' },
|
{ name: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo', provider: 'OpenAI' },
|
||||||
|
{ name: 'grok-beta', label: "xAI Grok Beta", provider: 'xAI' },
|
||||||
{ name: 'deepseek-coder', label: 'Deepseek-Coder', provider: 'Deepseek'},
|
{ name: 'deepseek-coder', label: 'Deepseek-Coder', provider: 'Deepseek'},
|
||||||
{ name: 'deepseek-chat', label: 'Deepseek-Chat', provider: 'Deepseek'},
|
{ name: 'deepseek-chat', label: 'Deepseek-Chat', provider: 'Deepseek'},
|
||||||
{ name: 'open-mistral-7b', label: 'Mistral 7B', provider: 'Mistral' },
|
{ name: 'open-mistral-7b', label: 'Mistral 7B', provider: 'Mistral' },
|
||||||
@ -47,9 +50,25 @@ const staticModels: ModelInfo[] = [
|
|||||||
|
|
||||||
export let MODEL_LIST: ModelInfo[] = [...staticModels];
|
export let MODEL_LIST: ModelInfo[] = [...staticModels];
|
||||||
|
|
||||||
|
const getOllamaBaseUrl = () => {
|
||||||
|
const defaultBaseUrl = import.meta.env.OLLAMA_API_BASE_URL || 'http://localhost:11434';
|
||||||
|
// Check if we're in the browser
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
// Frontend always uses localhost
|
||||||
|
return defaultBaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Backend: Check if we're running in Docker
|
||||||
|
const isDocker = process.env.RUNNING_IN_DOCKER === 'true';
|
||||||
|
|
||||||
|
return isDocker
|
||||||
|
? defaultBaseUrl.replace("localhost", "host.docker.internal")
|
||||||
|
: defaultBaseUrl;
|
||||||
|
};
|
||||||
|
|
||||||
async function getOllamaModels(): Promise<ModelInfo[]> {
|
async function getOllamaModels(): Promise<ModelInfo[]> {
|
||||||
try {
|
try {
|
||||||
const base_url = import.meta.env.OLLAMA_API_BASE_URL || "http://localhost:11434";
|
const base_url = getOllamaBaseUrl();
|
||||||
const response = await fetch(`${base_url}/api/tags`);
|
const response = await fetch(`${base_url}/api/tags`);
|
||||||
const data = await response.json() as OllamaApiResponse;
|
const data = await response.json() as OllamaApiResponse;
|
||||||
|
|
||||||
|
61
docker-compose.yaml
Normal file
61
docker-compose.yaml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
services:
|
||||||
|
bolt-ai:
|
||||||
|
image: bolt-ai:production
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
target: bolt-ai-production
|
||||||
|
ports:
|
||||||
|
- "5173:5173"
|
||||||
|
env_file: ".env.local"
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- COMPOSE_PROFILES=production
|
||||||
|
# No strictly neded but serving as hints for Coolify
|
||||||
|
- PORT=5173
|
||||||
|
- GROQ_API_KEY=${GROQ_API_KEY}
|
||||||
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||||
|
- OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY}
|
||||||
|
- GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY}
|
||||||
|
- OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL}
|
||||||
|
- VITE_LOG_LEVEL=${VITE_LOG_LEVEL:-debug}
|
||||||
|
- RUNNING_IN_DOCKER=true
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
command: pnpm run dockerstart
|
||||||
|
profiles:
|
||||||
|
- production # This service only runs in the production profile
|
||||||
|
|
||||||
|
bolt-ai-dev:
|
||||||
|
image: bolt-ai:development
|
||||||
|
build:
|
||||||
|
target: bolt-ai-development
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- VITE_HMR_PROTOCOL=ws
|
||||||
|
- VITE_HMR_HOST=localhost
|
||||||
|
- VITE_HMR_PORT=5173
|
||||||
|
- CHOKIDAR_USEPOLLING=true
|
||||||
|
- WATCHPACK_POLLING=true
|
||||||
|
- PORT=5173
|
||||||
|
- GROQ_API_KEY=${GROQ_API_KEY}
|
||||||
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||||
|
- OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY}
|
||||||
|
- GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY}
|
||||||
|
- OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL}
|
||||||
|
- VITE_LOG_LEVEL=${VITE_LOG_LEVEL:-debug}
|
||||||
|
- RUNNING_IN_DOCKER=true
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: .
|
||||||
|
target: /app
|
||||||
|
consistency: cached
|
||||||
|
- /app/node_modules
|
||||||
|
ports:
|
||||||
|
- "5173:5173" # Same port, no conflict as only one runs at a time
|
||||||
|
command: pnpm run dev --host 0.0.0.0
|
||||||
|
profiles: ["development", "default"] # Make development the default profile
|
@ -1,24 +0,0 @@
|
|||||||
services:
|
|
||||||
bolt-app:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
environment:
|
|
||||||
- NODE_ENV=production
|
|
||||||
# Add any other environment variables your app needs
|
|
||||||
# - OPENAI_API_KEY=${OPENAI_API_KEY}
|
|
||||||
# - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
|
||||||
# - GROQ_API_KEY=${GROQ_API_KEY}
|
|
||||||
# - OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY}
|
|
||||||
volumes:
|
|
||||||
# This volume is for development purposes, allowing live code updates
|
|
||||||
# Comment out or remove for production
|
|
||||||
- .:/app
|
|
||||||
# This volume is to prevent node_modules from being overwritten by the above volume
|
|
||||||
- /app/node_modules
|
|
||||||
command: pnpm run start
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
node_modules:
|
|
13
package.json
13
package.json
@ -13,7 +13,11 @@
|
|||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
||||||
"lint:fix": "npm run lint -- --fix",
|
"lint:fix": "npm run lint -- --fix",
|
||||||
"start": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 3000",
|
"start": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings",
|
||||||
|
"dockerstart": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 5173 --no-show-interactive-dev-session",
|
||||||
|
"dockerrun": "docker run -it -d --name bolt-ai-live -p 5173:5173 --env-file .env.local bolt-ai",
|
||||||
|
"dockerbuild:prod": "docker build -t bolt-ai:production bolt-ai:latest --target bolt-ai-production .",
|
||||||
|
"dockerbuild": "docker build -t bolt-ai:development -t bolt-ai:latest --target bolt-ai-development .",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"typegen": "wrangler types",
|
"typegen": "wrangler types",
|
||||||
"preview": "pnpm run build && pnpm run start"
|
"preview": "pnpm run build && pnpm run start"
|
||||||
@ -24,8 +28,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/anthropic": "^0.0.39",
|
"@ai-sdk/anthropic": "^0.0.39",
|
||||||
"@ai-sdk/google": "^0.0.52",
|
"@ai-sdk/google": "^0.0.52",
|
||||||
"@ai-sdk/openai": "^0.0.66",
|
|
||||||
"@ai-sdk/mistral": "^0.0.43",
|
"@ai-sdk/mistral": "^0.0.43",
|
||||||
|
"@ai-sdk/openai": "^0.0.66",
|
||||||
"@codemirror/autocomplete": "^6.17.0",
|
"@codemirror/autocomplete": "^6.17.0",
|
||||||
"@codemirror/commands": "^6.6.0",
|
"@codemirror/commands": "^6.6.0",
|
||||||
"@codemirror/lang-cpp": "^6.0.2",
|
"@codemirror/lang-cpp": "^6.0.2",
|
||||||
@ -67,6 +71,7 @@
|
|||||||
"isbot": "^4.1.0",
|
"isbot": "^4.1.0",
|
||||||
"istextorbinary": "^9.5.0",
|
"istextorbinary": "^9.5.0",
|
||||||
"jose": "^5.6.3",
|
"jose": "^5.6.3",
|
||||||
|
"js-cookie": "^3.0.5",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"nanostores": "^0.10.3",
|
"nanostores": "^0.10.3",
|
||||||
"ollama-ai-provider": "^0.15.2",
|
"ollama-ai-provider": "^0.15.2",
|
||||||
@ -90,6 +95,7 @@
|
|||||||
"@remix-run/dev": "^2.10.0",
|
"@remix-run/dev": "^2.10.0",
|
||||||
"@types/diff": "^5.2.1",
|
"@types/diff": "^5.2.1",
|
||||||
"@types/file-saver": "^2.0.7",
|
"@types/file-saver": "^2.0.7",
|
||||||
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/react": "^18.2.20",
|
"@types/react": "^18.2.20",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
"fast-glob": "^3.3.2",
|
"fast-glob": "^3.3.2",
|
||||||
@ -110,5 +116,6 @@
|
|||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@typescript-eslint/utils": "^8.0.0-alpha.30"
|
"@typescript-eslint/utils": "^8.0.0-alpha.30"
|
||||||
}
|
},
|
||||||
|
"packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,9 @@ importers:
|
|||||||
jose:
|
jose:
|
||||||
specifier: ^5.6.3
|
specifier: ^5.6.3
|
||||||
version: 5.6.3
|
version: 5.6.3
|
||||||
|
js-cookie:
|
||||||
|
specifier: ^3.0.5
|
||||||
|
version: 3.0.5
|
||||||
jszip:
|
jszip:
|
||||||
specifier: ^3.10.1
|
specifier: ^3.10.1
|
||||||
version: 3.10.1
|
version: 3.10.1
|
||||||
@ -210,6 +213,9 @@ importers:
|
|||||||
'@types/file-saver':
|
'@types/file-saver':
|
||||||
specifier: ^2.0.7
|
specifier: ^2.0.7
|
||||||
version: 2.0.7
|
version: 2.0.7
|
||||||
|
'@types/js-cookie':
|
||||||
|
specifier: ^3.0.6
|
||||||
|
version: 3.0.6
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^18.2.20
|
specifier: ^18.2.20
|
||||||
version: 18.3.3
|
version: 18.3.3
|
||||||
@ -1872,6 +1878,9 @@ packages:
|
|||||||
'@types/hast@3.0.4':
|
'@types/hast@3.0.4':
|
||||||
resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
|
resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
|
||||||
|
|
||||||
|
'@types/js-cookie@3.0.6':
|
||||||
|
resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==}
|
||||||
|
|
||||||
'@types/json-schema@7.0.15':
|
'@types/json-schema@7.0.15':
|
||||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||||
|
|
||||||
@ -3455,6 +3464,10 @@ packages:
|
|||||||
jose@5.6.3:
|
jose@5.6.3:
|
||||||
resolution: {integrity: sha512-1Jh//hEEwMhNYPDDLwXHa2ePWgWiFNNUadVmguAAw2IJ6sj9mNxV5tGXJNqlMkJAybF6Lgw1mISDxTePP/187g==}
|
resolution: {integrity: sha512-1Jh//hEEwMhNYPDDLwXHa2ePWgWiFNNUadVmguAAw2IJ6sj9mNxV5tGXJNqlMkJAybF6Lgw1mISDxTePP/187g==}
|
||||||
|
|
||||||
|
js-cookie@3.0.5:
|
||||||
|
resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
|
||||||
js-tokens@4.0.0:
|
js-tokens@4.0.0:
|
||||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||||
|
|
||||||
@ -7248,6 +7261,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/unist': 3.0.2
|
'@types/unist': 3.0.2
|
||||||
|
|
||||||
|
'@types/js-cookie@3.0.6': {}
|
||||||
|
|
||||||
'@types/json-schema@7.0.15': {}
|
'@types/json-schema@7.0.15': {}
|
||||||
|
|
||||||
'@types/mdast@3.0.15':
|
'@types/mdast@3.0.15':
|
||||||
@ -9211,6 +9226,8 @@ snapshots:
|
|||||||
|
|
||||||
jose@5.6.3: {}
|
jose@5.6.3: {}
|
||||||
|
|
||||||
|
js-cookie@3.0.5: {}
|
||||||
|
|
||||||
js-tokens@4.0.0: {}
|
js-tokens@4.0.0: {}
|
||||||
|
|
||||||
js-yaml@4.1.0:
|
js-yaml@4.1.0:
|
||||||
|
@ -3,3 +3,4 @@ name = "bolt"
|
|||||||
compatibility_flags = ["nodejs_compat"]
|
compatibility_flags = ["nodejs_compat"]
|
||||||
compatibility_date = "2024-07-01"
|
compatibility_date = "2024-07-01"
|
||||||
pages_build_output_dir = "./build/client"
|
pages_build_output_dir = "./build/client"
|
||||||
|
send_metrics = false
|
||||||
|
Loading…
Reference in New Issue
Block a user