diff --git a/app/commit.json b/app/commit.json index f348318..f6a4335 100644 --- a/app/commit.json +++ b/app/commit.json @@ -1 +1 @@ -{ "commit": "960f532f8234663d0b3630d18033c959fac6882c" } +{ "commit": "0a4ef117ae5d3687b04415e64a22794ea55841d1" , "version": "0.0.1" } \ No newline at end of file diff --git a/app/components/chat/Chat.client.tsx b/app/components/chat/Chat.client.tsx index cff4e36..d9e57f2 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/git/GitUrlImport.client.tsx b/app/components/git/GitUrlImport.client.tsx index cbdeaa5..c2c949e 100644 --- a/app/components/git/GitUrlImport.client.tsx +++ b/app/components/git/GitUrlImport.client.tsx @@ -8,6 +8,8 @@ import { Chat } from '~/components/chat/Chat.client'; import { useGit } from '~/lib/hooks/useGit'; import { useChatHistory } from '~/lib/persistence'; import { createCommandsMessage, detectProjectCommands } from '~/utils/projectCommands'; +import { LoadingOverlay } from '~/components/ui/LoadingOverlay'; +import { toast } from 'react-toastify'; const IGNORE_PATTERNS = [ 'node_modules/**', @@ -38,6 +40,7 @@ export function GitUrlImport() { const { ready: historyReady, importChat } = useChatHistory(); const { ready: gitReady, gitClone } = useGit(); const [imported, setImported] = useState(false); + const [loading, setLoading] = useState(true); const importRepo = async (repoUrl?: string) => { 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 0000000..6c69798 --- /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 aa1689a..5793e22 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 ( -
+
+
}>{() => }