diff --git a/app/commit.json b/app/commit.json index b3f011d2b..d6d6a5997 100644 --- a/app/commit.json +++ b/app/commit.json @@ -1 +1 @@ -{ "commit": "49b02dd885919e24a201f07b1a7b0fd0371b4f85" , "version": "0.0.1" } +{ "commit": "25b80ab267541b6ea290985dde09863f1a29c85c" , "version": "0.0.1" } diff --git a/app/components/chat/Chat.client.tsx b/app/components/chat/Chat.client.tsx index cff4e3676..d9e57f233 100644 --- a/app/components/chat/Chat.client.tsx +++ b/app/components/chat/Chat.client.tsx @@ -20,6 +20,7 @@ import Cookies from 'js-cookie'; import { debounce } from '~/utils/debounce'; import { useSettings } from '~/lib/hooks/useSettings'; import type { ProviderInfo } from '~/types/model'; +import { useSearchParams } from '@remix-run/react'; const toastAnimation = cssTransition({ enter: 'animated fadeInRight', @@ -92,6 +93,7 @@ export const ChatImpl = memo( const [chatStarted, setChatStarted] = useState(initialMessages.length > 0); const [uploadedFiles, setUploadedFiles] = useState([]); // Move here const [imageDataList, setImageDataList] = useState([]); // Move here + const [searchParams, setSearchParams] = useSearchParams(); const files = useStore(workbenchStore.files); const { activeProviders, promptId } = useSettings(); @@ -138,6 +140,24 @@ export const ChatImpl = memo( initialMessages, initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '', }); + useEffect(() => { + const prompt = searchParams.get('prompt'); + console.log(prompt, searchParams, model, provider); + + if (prompt) { + setSearchParams({}); + runAnimation(); + append({ + role: 'user', + content: [ + { + type: 'text', + text: `[Model: ${model}]\n\n[Provider: ${provider.name}]\n\n${prompt}`, + }, + ] as any, // Type assertion to bypass compiler check + }); + } + }, [model, provider, searchParams]); const { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer(); const { parsedMessages, parseMessages } = useMessageParser(); diff --git a/app/components/chat/CodeBlock.tsx b/app/components/chat/CodeBlock.tsx index e48913ce5..bc20dc2cd 100644 --- a/app/components/chat/CodeBlock.tsx +++ b/app/components/chat/CodeBlock.tsx @@ -53,7 +53,7 @@ export const CodeBlock = memo(
{ if (!gitReady && !historyReady) { @@ -109,9 +112,23 @@ ${file.content} return; } - importRepo(url); + importRepo(url).catch((error) => { + console.error('Error importing repo:', error); + toast.error('Failed to import repository'); + setLoading(false); + window.location.href = '/'; + }); setImported(true); }, [searchParams, historyReady, gitReady, imported]); - return }>{() => }; + return ( + }> + {() => ( + <> + + {loading && } + + )} + + ); } diff --git a/app/components/ui/LoadingOverlay.tsx b/app/components/ui/LoadingOverlay.tsx new file mode 100644 index 000000000..6c69798f9 --- /dev/null +++ b/app/components/ui/LoadingOverlay.tsx @@ -0,0 +1,14 @@ +export const LoadingOverlay = ({ message = 'Loading...' }) => { + return ( +
+ {/* Loading content */} +
+
+

{message}

+
+
+ ); +}; diff --git a/app/routes/git.tsx b/app/routes/git.tsx index aa1689a44..5793e2218 100644 --- a/app/routes/git.tsx +++ b/app/routes/git.tsx @@ -4,6 +4,7 @@ import { ClientOnly } from 'remix-utils/client-only'; import { BaseChat } from '~/components/chat/BaseChat'; import { GitUrlImport } from '~/components/git/GitUrlImport.client'; import { Header } from '~/components/header/Header'; +import BackgroundRays from '~/components/ui/BackgroundRays'; export const meta: MetaFunction = () => { return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }]; @@ -15,7 +16,8 @@ export async function loader(args: LoaderFunctionArgs) { export default function Index() { return ( -
+
+
}>{() => }