Skip to content

Commit 871aefb

Browse files
authored
Merge pull request #1335 from Toddyclipsgg/diff-view-v2
feat: diff-view-v2-no-conflict
2 parents 8c72ed7 + c24e697 commit 871aefb

File tree

16 files changed

+1354
-381
lines changed

16 files changed

+1354
-381
lines changed

.github/actions/setup-and-build/action.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ runs:
3030
run: |
3131
pnpm install
3232
pnpm run build
33+
34+
- name: Create history directory
35+
shell: bash
36+
run: mkdir -p .history

.tool-versions

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44

55
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.
66

7-
---
8-
7+
-----
98
Check the [bolt.diy Docs](https://stackblitz-labs.github.io/bolt.diy/) for more offical installation instructions and more informations.
109

11-
---
12-
10+
-----
1311
Also [this pinned post in our community](https://thinktank.ottomator.ai/t/videos-tutorial-helpful-content/3243) has a bunch of incredible resources for running and deploying bolt.diy yourself!
1412

1513
We have also launched an experimental agent called the "bolt.diy Expert" that can answer common questions about bolt.diy. Find it here on the [oTTomator Live Agent Studio](https://studio.ottomator.ai/).
@@ -81,6 +79,7 @@ project, please check the [project management guide](./PROJECT.md) to get starte
8179
- ✅ Add Starter Template Options (@thecodacus)
8280
- ✅ Perplexity Integration (@meetpateltech)
8381
- ✅ AWS Bedrock Integration (@kunjabijukchhe)
82+
- ✅ Add a "Diff View" to see the changes (@toddyclipsgg)
8483
-**HIGH PRIORITY** - Prevent bolt from rewriting files as often (file locking and diffs)
8584
-**HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
8685
-**HIGH PRIORITY** - Run agents in the backend as opposed to a single model call

app/components/chat/BaseChat.tsx

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import ChatAlert from './ChatAlert';
3434
import type { ModelInfo } from '~/lib/modules/llm/types';
3535
import ProgressCompilation from './ProgressCompilation';
3636
import type { ProgressAnnotation } from '~/types/context';
37+
import type { ActionRunner } from '~/lib/runtime/action-runner';
3738
import { LOCAL_PROVIDERS } from '~/lib/stores/settings';
3839

3940
const TEXTAREA_MIN_HEIGHT = 76;
@@ -68,6 +69,7 @@ interface BaseChatProps {
6869
actionAlert?: ActionAlert;
6970
clearAlert?: () => void;
7071
data?: JSONValue[] | undefined;
72+
actionRunner?: ActionRunner;
7173
}
7274

7375
export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
@@ -102,6 +104,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
102104
actionAlert,
103105
clearAlert,
104106
data,
107+
actionRunner,
105108
},
106109
ref,
107110
) => {
@@ -304,7 +307,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
304307
data-chat-visible={showChat}
305308
>
306309
<ClientOnly>{() => <Menu />}</ClientOnly>
307-
<div className="flex flex-col lg:flex-row overflow-y-auto w-full h-full">
310+
<div ref={scrollRef} className="flex flex-col lg:flex-row overflow-y-auto w-full h-full">
308311
<div className={classNames(styles.Chat, 'flex flex-col flex-grow lg:min-w-[var(--chat-min-width)] h-full')}>
309312
{!chatStarted && (
310313
<div id="intro" className="mt-[16vh] max-w-chat mx-auto text-center px-4 lg:px-0">
@@ -318,40 +321,39 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
318321
)}
319322
<div
320323
className={classNames('pt-6 px-2 sm:px-6', {
321-
'h-full flex flex-col pb-4 overflow-y-auto': chatStarted,
324+
'h-full flex flex-col': chatStarted,
322325
})}
323326
ref={scrollRef}
324327
>
325328
<ClientOnly>
326329
{() => {
327330
return chatStarted ? (
328-
<div className="flex-1 w-full max-w-chat pb-6 mx-auto z-1">
329-
<Messages
330-
ref={messageRef}
331-
className="flex flex-col "
332-
messages={messages}
333-
isStreaming={isStreaming}
334-
/>
335-
</div>
331+
<Messages
332+
ref={messageRef}
333+
className="flex flex-col w-full flex-1 max-w-chat pb-6 mx-auto z-1"
334+
messages={messages}
335+
isStreaming={isStreaming}
336+
/>
336337
) : null;
337338
}}
338339
</ClientOnly>
339340
<div
340-
className={classNames('flex flex-col gap-4 w-full max-w-chat mx-auto z-prompt', {
341+
className={classNames('flex flex-col gap-4 w-full max-w-chat mx-auto z-prompt mb-6', {
341342
'sticky bottom-2': chatStarted,
342-
'position-absolute': chatStarted,
343343
})}
344344
>
345-
{actionAlert && (
346-
<ChatAlert
347-
alert={actionAlert}
348-
clearAlert={() => clearAlert?.()}
349-
postMessage={(message) => {
350-
sendMessage?.({} as any, message);
351-
clearAlert?.();
352-
}}
353-
/>
354-
)}
345+
<div className="bg-bolt-elements-background-depth-2">
346+
{actionAlert && (
347+
<ChatAlert
348+
alert={actionAlert}
349+
clearAlert={() => clearAlert?.()}
350+
postMessage={(message) => {
351+
sendMessage?.({} as any, message);
352+
clearAlert?.();
353+
}}
354+
/>
355+
)}
356+
</div>
355357
{progressAnnotations && <ProgressCompilation data={progressAnnotations} />}
356358
<div
357359
className={classNames(
@@ -585,28 +587,34 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
585587
</div>
586588
</div>
587589
</div>
588-
{!chatStarted && (
589-
<div className="flex flex-col justify-center mt-6 gap-5">
590+
<div className="flex flex-col justify-center gap-5">
591+
{!chatStarted && (
590592
<div className="flex justify-center gap-2">
591-
<div className="flex items-center gap-2">
592-
{ImportButtons(importChat)}
593-
<GitCloneButton importChat={importChat} className="min-w-[120px]" />
594-
</div>
593+
{ImportButtons(importChat)}
594+
<GitCloneButton importChat={importChat} />
595595
</div>
596-
597-
{ExamplePrompts((event, messageInput) => {
596+
)}
597+
{!chatStarted &&
598+
ExamplePrompts((event, messageInput) => {
598599
if (isStreaming) {
599600
handleStop?.();
600601
return;
601602
}
602603

603604
handleSendMessage?.(event, messageInput);
604605
})}
605-
<StarterTemplates />
606-
</div>
607-
)}
606+
{!chatStarted && <StarterTemplates />}
607+
</div>
608608
</div>
609-
<ClientOnly>{() => <Workbench chatStarted={chatStarted} isStreaming={isStreaming} />}</ClientOnly>
609+
<ClientOnly>
610+
{() => (
611+
<Workbench
612+
actionRunner={actionRunner ?? ({} as ActionRunner)}
613+
chatStarted={chatStarted}
614+
isStreaming={isStreaming}
615+
/>
616+
)}
617+
</ClientOnly>
610618
</div>
611619
</div>
612620
);

app/components/ui/Slider.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ interface SliderOption<T> {
99
text: string;
1010
}
1111

12-
export interface SliderOptions<T> {
13-
left: SliderOption<T>;
14-
right: SliderOption<T>;
15-
}
12+
export type SliderOptions<T> = {
13+
left: { value: T; text: string };
14+
middle?: { value: T; text: string };
15+
right: { value: T; text: string };
16+
};
1617

1718
interface SliderProps<T> {
1819
selected: T;
@@ -21,14 +22,23 @@ interface SliderProps<T> {
2122
}
2223

2324
export const Slider = genericMemo(<T,>({ selected, options, setSelected }: SliderProps<T>) => {
24-
const isLeftSelected = selected === options.left.value;
25+
const hasMiddle = !!options.middle;
26+
const isLeftSelected = hasMiddle ? selected === options.left.value : selected === options.left.value;
27+
const isMiddleSelected = hasMiddle && options.middle ? selected === options.middle.value : false;
2528

2629
return (
2730
<div className="flex items-center flex-wrap shrink-0 gap-1 bg-bolt-elements-background-depth-1 overflow-hidden rounded-full p-1">
2831
<SliderButton selected={isLeftSelected} setSelected={() => setSelected?.(options.left.value)}>
2932
{options.left.text}
3033
</SliderButton>
31-
<SliderButton selected={!isLeftSelected} setSelected={() => setSelected?.(options.right.value)}>
34+
35+
{options.middle && (
36+
<SliderButton selected={isMiddleSelected} setSelected={() => setSelected?.(options.middle!.value)}>
37+
{options.middle.text}
38+
</SliderButton>
39+
)}
40+
41+
<SliderButton selected={!isLeftSelected && !isMiddleSelected} setSelected={() => setSelected?.(options.right.value)}>
3242
{options.right.text}
3343
</SliderButton>
3444
</div>

0 commit comments

Comments
 (0)