diff --git a/.env.example b/.env.example index 83f29ae..46a21e8 100644 --- a/.env.example +++ b/.env.example @@ -43,6 +43,12 @@ OPENAI_LIKE_API_KEY= # You only need this environment variable set if you want to use Mistral models MISTRAL_API_KEY= + +# Get LMStudio Base URL from LM Studio Developer Console +# Make sure to enable CORS +# Example: http://localhost:1234 +LMSTUDIO_API_BASE_URL= + # Get your xAI API key # https://x.ai/api # You only need this environment variable set if you want to use xAI models diff --git a/.github/workflows/github-build-push.yml b/.github/workflows/github-build-push.yml deleted file mode 100644 index 4d4db05..0000000 --- a/.github/workflows/github-build-push.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build and Push Container - -on: - push: - branches: - - main - # paths: - # - 'Dockerfile' - workflow_dispatch: -jobs: - build-and-push: - runs-on: [ubuntu-latest] - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and Push Containers - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:${{ github.sha }} diff --git a/.github/workflows/semantic-pr.yaml b/.github/workflows/semantic-pr.yaml deleted file mode 100644 index 503b045..0000000 --- a/.github/workflows/semantic-pr.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Semantic Pull Request -on: - pull_request_target: - types: [opened, reopened, edited, synchronize] -permissions: - pull-requests: read -jobs: - main: - name: Validate PR Title - runs-on: ubuntu-latest - steps: - # https://github.com/amannn/action-semantic-pull-request/releases/tag/v5.5.3 - - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - subjectPattern: ^(?![A-Z]).+$ - subjectPatternError: | - The subject "{subject}" found in the pull request title "{title}" - didn't match the configured pattern. Please ensure that the subject - doesn't start with an uppercase character. - types: | - fix - feat - chore - build - ci - perf - docs - refactor - revert - test diff --git a/.gitignore b/.gitignore index 69d2790..b43105b 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ dist-ssr _worker.bundle Modelfile +modelfiles diff --git a/README.md b/README.md index fb70e75..54ae824 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ This fork of Bolt.new allows you to choose the LLM that you use for each prompt! - ✅ Ability to sync files (one way sync) to local folder (@muzafferkadir) - ✅ Containerize the application with Docker for easy installation (@aaronbolton) - ✅ Publish projects directly to GitHub (@goncaloalves) -- ⬜ Prevent Bolt from rewriting files as often (Done but need to review PR still) +- ✅ Ability to enter API keys in the UI (@ali00209) +- ✅ xAI Grok Beta Integration (@milutinke) +- ⬜ **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** Load local projects into the app - ⬜ **HIGH PRIORITY** - Attach images to prompts @@ -34,7 +36,6 @@ This fork of Bolt.new allows you to choose the LLM that you use for each prompt! - ⬜ Ability to revert code to earlier version - ⬜ Prompt caching - ⬜ Better prompt enhancing -- ⬜ Ability to enter API keys in the UI - ⬜ 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. @@ -85,7 +86,7 @@ If you see usr/local/bin in the output then you're good to go. git clone https://github.com/coleam00/bolt.new-any-llm.git ``` -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. +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. ![image](https://github.com/user-attachments/assets/7e6a532c-2268-401f-8310-e8d20c731328) @@ -115,7 +116,7 @@ Optionally, you can set the debug level: VITE_LOG_LEVEL=debug ``` -**Important**: Never commit your `.env` file to version control. It's already included in .gitignore. +**Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore. ## Run with Docker diff --git a/app/components/chat/APIKeyManager.tsx b/app/components/chat/APIKeyManager.tsx new file mode 100644 index 0000000..a35724c --- /dev/null +++ b/app/components/chat/APIKeyManager.tsx @@ -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 = ({ provider, apiKey, setApiKey }) => { + const [isEditing, setIsEditing] = useState(false); + const [tempKey, setTempKey] = useState(apiKey); + + const handleSave = () => { + setApiKey(tempKey); + setIsEditing(false); + }; + + return ( +
+ {provider} API Key: + {isEditing ? ( + <> + 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" + /> + +
+ + setIsEditing(false)} title="Cancel"> +
+ + + ) : ( + <> + + {apiKey ? '••••••••' : 'Not set (will still work if set in .env file)'} + + setIsEditing(true)} title="Edit API Key"> +
+ + + )} +
+ ); +}; diff --git a/app/components/chat/Artifact.tsx b/app/components/chat/Artifact.tsx index 9de52dd..62020fd 100644 --- a/app/components/chat/Artifact.tsx +++ b/app/components/chat/Artifact.tsx @@ -151,7 +151,13 @@ const ActionList = memo(({ actions }: ActionListProps) => {
{status === 'running' ? ( -
+ <> + {type !== 'start' ? ( +
+ ) : ( +
+ )} + ) : status === 'pending' ? (
) : status === 'complete' ? ( @@ -171,9 +177,19 @@ const ActionList = memo(({ actions }: ActionListProps) => {
Run command
+ ) : type === 'start' ? ( + { + e.preventDefault(); + workbenchStore.currentView.set('preview'); + }} + className="flex items-center w-full min-h-[28px]" + > + Start Application + ) : null}
- {type === 'shell' && ( + {(type === 'shell' || type === 'start') && ( model.provider))] -const ModelSelector = ({ model, setModel, modelList, providerList }) => { - const [provider, setProvider] = useState(DEFAULT_PROVIDER); +const ModelSelector = ({ model, setModel, provider, setProvider, modelList, providerList }) => { return ( -
- { setProvider(e.target.value); const firstModel = [...modelList].find(m => m.provider == e.target.value); 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) => ( +