Merge branch 'main' into copyMyFix
Browse files- app/commit.json +1 -1
- app/components/chat/Chat.client.tsx +20 -0
- app/components/git/GitUrlImport.client.tsx +19 -2
- app/components/ui/LoadingOverlay.tsx +14 -0
- app/routes/git.tsx +3 -1
app/commit.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{ "commit": "
|
|
|
1 |
+
{ "commit": "0a4ef117ae5d3687b04415e64a22794ea55841d1" , "version": "0.0.1" }
|
app/components/chat/Chat.client.tsx
CHANGED
@@ -20,6 +20,7 @@ import Cookies from 'js-cookie';
|
|
20 |
import { debounce } from '~/utils/debounce';
|
21 |
import { useSettings } from '~/lib/hooks/useSettings';
|
22 |
import type { ProviderInfo } from '~/types/model';
|
|
|
23 |
|
24 |
const toastAnimation = cssTransition({
|
25 |
enter: 'animated fadeInRight',
|
@@ -92,6 +93,7 @@ export const ChatImpl = memo(
|
|
92 |
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
|
93 |
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
|
94 |
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
|
|
|
95 |
const files = useStore(workbenchStore.files);
|
96 |
const { activeProviders, promptId } = useSettings();
|
97 |
|
@@ -138,6 +140,24 @@ export const ChatImpl = memo(
|
|
138 |
initialMessages,
|
139 |
initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '',
|
140 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
const { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer();
|
143 |
const { parsedMessages, parseMessages } = useMessageParser();
|
|
|
20 |
import { debounce } from '~/utils/debounce';
|
21 |
import { useSettings } from '~/lib/hooks/useSettings';
|
22 |
import type { ProviderInfo } from '~/types/model';
|
23 |
+
import { useSearchParams } from '@remix-run/react';
|
24 |
|
25 |
const toastAnimation = cssTransition({
|
26 |
enter: 'animated fadeInRight',
|
|
|
93 |
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
|
94 |
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
|
95 |
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
|
96 |
+
const [searchParams, setSearchParams] = useSearchParams();
|
97 |
const files = useStore(workbenchStore.files);
|
98 |
const { activeProviders, promptId } = useSettings();
|
99 |
|
|
|
140 |
initialMessages,
|
141 |
initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '',
|
142 |
});
|
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]);
|
161 |
|
162 |
const { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer();
|
163 |
const { parsedMessages, parseMessages } = useMessageParser();
|
app/components/git/GitUrlImport.client.tsx
CHANGED
@@ -8,6 +8,8 @@ import { Chat } from '~/components/chat/Chat.client';
|
|
8 |
import { useGit } from '~/lib/hooks/useGit';
|
9 |
import { useChatHistory } from '~/lib/persistence';
|
10 |
import { createCommandsMessage, detectProjectCommands } from '~/utils/projectCommands';
|
|
|
|
|
11 |
|
12 |
const IGNORE_PATTERNS = [
|
13 |
'node_modules/**',
|
@@ -38,6 +40,7 @@ export function GitUrlImport() {
|
|
38 |
const { ready: historyReady, importChat } = useChatHistory();
|
39 |
const { ready: gitReady, gitClone } = useGit();
|
40 |
const [imported, setImported] = useState(false);
|
|
|
41 |
|
42 |
const importRepo = async (repoUrl?: string) => {
|
43 |
if (!gitReady && !historyReady) {
|
@@ -109,9 +112,23 @@ ${file.content}
|
|
109 |
return;
|
110 |
}
|
111 |
|
112 |
-
importRepo(url)
|
|
|
|
|
|
|
|
|
|
|
113 |
setImported(true);
|
114 |
}, [searchParams, historyReady, gitReady, imported]);
|
115 |
|
116 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
|
|
8 |
import { useGit } from '~/lib/hooks/useGit';
|
9 |
import { useChatHistory } from '~/lib/persistence';
|
10 |
import { createCommandsMessage, detectProjectCommands } from '~/utils/projectCommands';
|
11 |
+
import { LoadingOverlay } from '~/components/ui/LoadingOverlay';
|
12 |
+
import { toast } from 'react-toastify';
|
13 |
|
14 |
const IGNORE_PATTERNS = [
|
15 |
'node_modules/**',
|
|
|
40 |
const { ready: historyReady, importChat } = useChatHistory();
|
41 |
const { ready: gitReady, gitClone } = useGit();
|
42 |
const [imported, setImported] = useState(false);
|
43 |
+
const [loading, setLoading] = useState(true);
|
44 |
|
45 |
const importRepo = async (repoUrl?: string) => {
|
46 |
if (!gitReady && !historyReady) {
|
|
|
112 |
return;
|
113 |
}
|
114 |
|
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 |
+
});
|
121 |
setImported(true);
|
122 |
}, [searchParams, historyReady, gitReady, imported]);
|
123 |
|
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 |
+
);
|
134 |
}
|
app/components/ui/LoadingOverlay.tsx
ADDED
@@ -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
CHANGED
@@ -4,6 +4,7 @@ import { ClientOnly } from 'remix-utils/client-only';
|
|
4 |
import { BaseChat } from '~/components/chat/BaseChat';
|
5 |
import { GitUrlImport } from '~/components/git/GitUrlImport.client';
|
6 |
import { Header } from '~/components/header/Header';
|
|
|
7 |
|
8 |
export const meta: MetaFunction = () => {
|
9 |
return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }];
|
@@ -15,7 +16,8 @@ export async function loader(args: LoaderFunctionArgs) {
|
|
15 |
|
16 |
export default function Index() {
|
17 |
return (
|
18 |
-
<div className="flex flex-col h-full w-full">
|
|
|
19 |
<Header />
|
20 |
<ClientOnly fallback={<BaseChat />}>{() => <GitUrlImport />}</ClientOnly>
|
21 |
</div>
|
|
|
4 |
import { BaseChat } from '~/components/chat/BaseChat';
|
5 |
import { GitUrlImport } from '~/components/git/GitUrlImport.client';
|
6 |
import { Header } from '~/components/header/Header';
|
7 |
+
import BackgroundRays from '~/components/ui/BackgroundRays';
|
8 |
|
9 |
export const meta: MetaFunction = () => {
|
10 |
return [{ title: 'Bolt' }, { name: 'description', content: 'Talk with Bolt, an AI assistant from StackBlitz' }];
|
|
|
16 |
|
17 |
export default function Index() {
|
18 |
return (
|
19 |
+
<div className="flex flex-col h-full w-full bg-bolt-elements-background-depth-1">
|
20 |
+
<BackgroundRays />
|
21 |
<Header />
|
22 |
<ClientOnly fallback={<BaseChat />}>{() => <GitUrlImport />}</ClientOnly>
|
23 |
</div>
|