Skip to content

Commit da37d94

Browse files
committed
Merge branch 'main' into context-optimization
2 parents 3c7b125 + bfaa3f7 commit da37d94

File tree

25 files changed

+657
-571
lines changed

25 files changed

+657
-571
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to oTToDev
22

3-
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.
3+
First off, thank you for considering contributing to Bolt.diy! This fork aims to expand the capabilities of the original project by integrating multiple LLM providers and enhancing functionality. Every contribution helps make Bolt.diy a better tool for developers worldwide.
44

55
## 📋 Table of Contents
66
- [Code of Conduct](#code-of-conduct)

FAQ.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
[![Bolt.new: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.new)
22

3-
# Bolt.new Fork by Cole Medin - oTToDev
3+
# Bolt.new Fork by Cole Medin - Bolt.diy
44

55
## FAQ
66

7-
### How do I get the best results with oTToDev?
7+
### How do I get the best results with Bolt.diy?
88

99
- **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.
1010

1111
- **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.
1212

13-
- **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.
13+
- **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.
1414

15-
- **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.
15+
- **Batch simple instructions**: Save time by combining simple instructions into one message. For example, you can ask Bolt.diy to change the color scheme, add mobile responsiveness, and restart the dev server, all in one go saving you time and reducing API credit consumption significantly.
1616

17-
### Do you plan on merging oTToDev back into the official Bolt.new repo?
17+
### Do you plan on merging Bolt.diy back into the official Bolt.new repo?
1818

1919
More news coming on this coming early next month - stay tuned!
2020

2121
### Why are there so many open issues/pull requests?
2222

23-
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
23+
Bolt.diy was started simply to showcase how to edit an open source project and to do something cool with local LLMs on my (@ColeMedin) YouTube channel! However, it quickly
2424
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.
2525
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
2626
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!
2727

28-
### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for oTToDev/Bolt.new?
28+
### How do local LLMs fair compared to larger models like Claude 3.5 Sonnet for Bolt.diy/Bolt.new?
2929

3030
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!
3131

3232
### I'm getting the error: "There was an error processing this request"
3333

34-
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.
34+
If you see this error within Bolt.diy, that is just the application telling you there is a problem at a high level, and this could mean a number of different things. To find the actual error, please check BOTH the terminal where you started the application (with Docker or pnpm) and the developer console in the browser. For most browsers, you can access the developer console by pressing F12 or right clicking anywhere in the browser and selecting “Inspect”. Then go to the “console” tab in the top right.
3535

3636
### I'm getting the error: "x-api-key header missing"
3737

38-
We have seen this error a couple times and for some reason just restarting the Docker container has fixed it. This seems to be Ollama specific. Another thing to try is try to run 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!
38+
We have seen this error a couple times and for some reason just restarting the Docker container has fixed it. This seems to be Ollama specific. Another thing to try is try to run Bolt.diy with Docker or pnpm, whichever you didn’t run first. We are still on the hunt for why this happens once and a while!
3939

40-
### I'm getting a blank preview when oTToDev runs my app!
40+
### I'm getting a blank preview when Bolt.diy runs my app!
4141

42-
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.
42+
We promise you that we are constantly testing new PRs coming into Bolt.diy and the preview is core functionality, so the application is not broken! When you get a blank preview or don’t get a preview, this is generally because the LLM hallucinated bad code or incorrect commands. We are working on making this more transparent so it is obvious. Sometimes the error will appear in developer console too so check that as well.
4343

4444
### How to add a LLM:
4545

app/commit.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "commit": "154935cdeb054d2cc22dfb0c7e6cf084f02b95d0" }
1+
{ "commit": "8f3b4cd08249d26b14397e66241b9d099d3eb205" }

app/components/chat/BaseChat.tsx

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Cookies from 'js-cookie';
1717
import * as Tooltip from '@radix-ui/react-tooltip';
1818

1919
import styles from './BaseChat.module.scss';
20-
import type { ProviderInfo } from '~/utils/types';
2120
import { ExportChatButton } from '~/components/chat/chatExportAndImport/ExportChatButton';
2221
import { ImportButtons } from '~/components/chat/chatExportAndImport/ImportButtons';
2322
import { ExamplePrompts } from '~/components/chat/ExamplePrompts';
@@ -26,6 +25,7 @@ import GitCloneButton from './GitCloneButton';
2625
import FilePreview from './FilePreview';
2726
import { ModelSelector } from '~/components/chat/ModelSelector';
2827
import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition';
28+
import type { IProviderSetting, ProviderInfo } from '~/types/model';
2929

3030
const TEXTAREA_MIN_HEIGHT = 76;
3131

@@ -45,6 +45,7 @@ interface BaseChatProps {
4545
setModel?: (model: string) => void;
4646
provider?: ProviderInfo;
4747
setProvider?: (provider: ProviderInfo) => void;
48+
providerList?: ProviderInfo[];
4849
handleStop?: () => void;
4950
sendMessage?: (event: React.UIEvent, messageInput?: string) => void;
5051
handleInputChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
@@ -70,6 +71,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
7071
setModel,
7172
provider,
7273
setProvider,
74+
providerList,
7375
input = '',
7476
enhancingPrompt,
7577
handleInputChange,
@@ -108,48 +110,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
108110
const [recognition, setRecognition] = useState<SpeechRecognition | null>(null);
109111
const [transcript, setTranscript] = useState('');
110112

111-
// Load enabled providers from cookies
112-
const [enabledProviders, setEnabledProviders] = useState(() => {
113-
const savedProviders = Cookies.get('providers');
114-
115-
if (savedProviders) {
116-
try {
117-
const parsedProviders = JSON.parse(savedProviders);
118-
return PROVIDER_LIST.filter((p) => parsedProviders[p.name]);
119-
} catch (error) {
120-
console.error('Failed to parse providers from cookies:', error);
121-
return PROVIDER_LIST;
122-
}
123-
}
124-
125-
return PROVIDER_LIST;
126-
});
127-
128-
// Update enabled providers when cookies change
129-
useEffect(() => {
130-
const updateProvidersFromCookies = () => {
131-
const savedProviders = Cookies.get('providers');
132-
133-
if (savedProviders) {
134-
try {
135-
const parsedProviders = JSON.parse(savedProviders);
136-
setEnabledProviders(PROVIDER_LIST.filter((p) => parsedProviders[p.name]));
137-
} catch (error) {
138-
console.error('Failed to parse providers from cookies:', error);
139-
}
140-
}
141-
};
142-
143-
updateProvidersFromCookies();
144-
145-
const interval = setInterval(updateProvidersFromCookies, 1000);
146-
147-
return () => clearInterval(interval);
148-
}, [PROVIDER_LIST]);
149-
150113
useEffect(() => {
151114
console.log(transcript);
152115
}, [transcript]);
116+
153117
useEffect(() => {
154118
// Load API keys from cookies on component mount
155119
try {
@@ -169,7 +133,26 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
169133
Cookies.remove('apiKeys');
170134
}
171135

172-
initializeModelList().then((modelList) => {
136+
let providerSettings: Record<string, IProviderSetting> | undefined = undefined;
137+
138+
try {
139+
const savedProviderSettings = Cookies.get('providers');
140+
141+
if (savedProviderSettings) {
142+
const parsedProviderSettings = JSON.parse(savedProviderSettings);
143+
144+
if (typeof parsedProviderSettings === 'object' && parsedProviderSettings !== null) {
145+
providerSettings = parsedProviderSettings;
146+
}
147+
}
148+
} catch (error) {
149+
console.error('Error loading Provider Settings from cookies:', error);
150+
151+
// Clear invalid cookie data
152+
Cookies.remove('providers');
153+
}
154+
155+
initializeModelList(providerSettings).then((modelList) => {
173156
setModelList(modelList);
174157
});
175158

@@ -369,10 +352,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
369352
modelList={modelList}
370353
provider={provider}
371354
setProvider={setProvider}
372-
providerList={PROVIDER_LIST}
355+
providerList={providerList || PROVIDER_LIST}
373356
apiKeys={apiKeys}
374357
/>
375-
{enabledProviders.length > 0 && provider && (
358+
{(providerList || []).length > 0 && provider && (
376359
<APIKeyManager
377360
provider={provider}
378361
apiKey={apiKeys[provider.name] || ''}
@@ -468,7 +451,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
468451
<SendButton
469452
show={input.length > 0 || isStreaming || uploadedFiles.length > 0}
470453
isStreaming={isStreaming}
471-
disabled={enabledProviders.length === 0}
454+
disabled={!providerList || providerList.length === 0}
472455
onClick={(event) => {
473456
if (isStreaming) {
474457
handleStop?.();
@@ -528,7 +511,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
528511
!isModelSettingsCollapsed,
529512
})}
530513
onClick={() => setIsModelSettingsCollapsed(!isModelSettingsCollapsed)}
531-
disabled={enabledProviders.length === 0}
514+
disabled={!providerList || providerList.length === 0}
532515
>
533516
<div className={`i-ph:caret-${isModelSettingsCollapsed ? 'right' : 'down'} text-lg`} />
534517
{isModelSettingsCollapsed ? <span className="text-xs">{model}</span> : <span />}

app/components/chat/Chat.client.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ import { cubicEasingFn } from '~/utils/easings';
1717
import { createScopedLogger, renderLogger } from '~/utils/logger';
1818
import { BaseChat } from './BaseChat';
1919
import Cookies from 'js-cookie';
20-
import type { ProviderInfo } from '~/utils/types';
2120
import { debounce } from '~/utils/debounce';
21+
import { useSettings } from '~/lib/hooks/useSettings';
22+
import type { ProviderInfo } from '~/types/model';
2223

2324
const toastAnimation = cssTransition({
2425
enter: 'animated fadeInRight',
@@ -92,6 +93,8 @@ export const ChatImpl = memo(
9293
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
9394
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
9495
const files = useStore(workbenchStore.files);
96+
const { activeProviders } = useSettings();
97+
9598
const [model, setModel] = useState(() => {
9699
const savedModel = Cookies.get('selectedModel');
97100
return savedModel || DEFAULT_MODEL;
@@ -317,6 +320,7 @@ export const ChatImpl = memo(
317320
setModel={handleModelChange}
318321
provider={provider}
319322
setProvider={handleProviderChange}
323+
providerList={activeProviders}
320324
messageRef={messageRef}
321325
scrollRef={scrollRef}
322326
handleInputChange={(e) => {

app/components/settings/Settings.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
padding: 1rem;
4747
margin-bottom: 1rem;
4848
border-style: solid;
49-
border-color: var(--bolt-elements-button-danger-backgroundHover) ;
49+
border-color: var(--bolt-elements-button-danger-backgroundHover);
5050
border-width: thin;
5151

5252
button {
@@ -60,4 +60,4 @@
6060
background-color: var(--bolt-elements-button-danger-backgroundHover);
6161
}
6262
}
63-
}
63+
}

0 commit comments

Comments
 (0)