Skip to content

Commit ad19d3f

Browse files
authored
Merge branch 'main' into copyMyFix
2 parents 329152f + 7a0223d commit ad19d3f

File tree

5 files changed

+57
-4
lines changed

5 files changed

+57
-4
lines changed

app/commit.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "commit": "960f532f8234663d0b3630d18033c959fac6882c" }
1+
{ "commit": "0a4ef117ae5d3687b04415e64a22794ea55841d1" , "version": "0.0.1" }

app/components/chat/Chat.client.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Cookies from 'js-cookie';
2020
import { debounce } from '~/utils/debounce';
2121
import { useSettings } from '~/lib/hooks/useSettings';
2222
import type { ProviderInfo } from '~/types/model';
23+
import { useSearchParams } from '@remix-run/react';
2324

2425
const toastAnimation = cssTransition({
2526
enter: 'animated fadeInRight',
@@ -92,6 +93,7 @@ export const ChatImpl = memo(
9293
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
9394
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
9495
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
96+
const [searchParams, setSearchParams] = useSearchParams();
9597
const files = useStore(workbenchStore.files);
9698
const { activeProviders, promptId } = useSettings();
9799

@@ -138,6 +140,24 @@ export const ChatImpl = memo(
138140
initialMessages,
139141
initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '',
140142
});
143+
useEffect(() => {
144+
const prompt = searchParams.get('prompt');
145+
console.log(prompt, searchParams, model, provider);
146+
147+
if (prompt) {
148+
setSearchParams({});
149+
runAnimation();
150+
append({
151+
role: 'user',
152+
content: [
153+
{
154+
type: 'text',
155+
text: `[Model: ${model}]\n\n[Provider: ${provider.name}]\n\n${prompt}`,
156+
},
157+
] as any, // Type assertion to bypass compiler check
158+
});
159+
}
160+
}, [model, provider, searchParams]);
141161

142162
const { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer();
143163
const { parsedMessages, parseMessages } = useMessageParser();

app/components/git/GitUrlImport.client.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { Chat } from '~/components/chat/Chat.client';
88
import { useGit } from '~/lib/hooks/useGit';
99
import { useChatHistory } from '~/lib/persistence';
1010
import { createCommandsMessage, detectProjectCommands } from '~/utils/projectCommands';
11+
import { LoadingOverlay } from '~/components/ui/LoadingOverlay';
12+
import { toast } from 'react-toastify';
1113

1214
const IGNORE_PATTERNS = [
1315
'node_modules/**',
@@ -38,6 +40,7 @@ export function GitUrlImport() {
3840
const { ready: historyReady, importChat } = useChatHistory();
3941
const { ready: gitReady, gitClone } = useGit();
4042
const [imported, setImported] = useState(false);
43+
const [loading, setLoading] = useState(true);
4144

4245
const importRepo = async (repoUrl?: string) => {
4346
if (!gitReady && !historyReady) {
@@ -109,9 +112,23 @@ ${file.content}
109112
return;
110113
}
111114

112-
importRepo(url);
115+
importRepo(url).catch((error) => {
116+
console.error('Error importing repo:', error);
117+
toast.error('Failed to import repository');
118+
setLoading(false);
119+
window.location.href = '/';
120+
});
113121
setImported(true);
114122
}, [searchParams, historyReady, gitReady, imported]);
115123

116-
return <ClientOnly fallback={<BaseChat />}>{() => <Chat />}</ClientOnly>;
124+
return (
125+
<ClientOnly fallback={<BaseChat />}>
126+
{() => (
127+
<>
128+
<Chat />
129+
{loading && <LoadingOverlay message="Please wait while we clone the repository..." />}
130+
</>
131+
)}
132+
</ClientOnly>
133+
);
117134
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const LoadingOverlay = ({ message = 'Loading...' }) => {
2+
return (
3+
<div className="fixed inset-0 flex items-center justify-center bg-black/80 z-50 backdrop-blur-sm">
4+
{/* Loading content */}
5+
<div className="relative flex flex-col items-center gap-4 p-8 rounded-lg bg-bolt-elements-background-depth-2 shadow-lg">
6+
<div
7+
className={'i-svg-spinners:90-ring-with-bg text-bolt-elements-loader-progress'}
8+
style={{ fontSize: '2rem' }}
9+
></div>
10+
<p className="text-lg text-bolt-elements-textTertiary">{message}</p>
11+
</div>
12+
</div>
13+
);
14+
};

app/routes/git.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ClientOnly } from 'remix-utils/client-only';
44
import { BaseChat } from '~/components/chat/BaseChat';
55
import { GitUrlImport } from '~/components/git/GitUrlImport.client';
66
import { Header } from '~/components/header/Header';
7+
import BackgroundRays from '~/components/ui/BackgroundRays';
78

89
export const meta: MetaFunction = () => {
910
return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }];
@@ -15,7 +16,8 @@ export async function loader(args: LoaderFunctionArgs) {
1516

1617
export default function Index() {
1718
return (
18-
<div className="flex flex-col h-full w-full">
19+
<div className="flex flex-col h-full w-full bg-bolt-elements-background-depth-1">
20+
<BackgroundRays />
1921
<Header />
2022
<ClientOnly fallback={<BaseChat />}>{() => <GitUrlImport />}</ClientOnly>
2123
</div>

0 commit comments

Comments
 (0)