Merge branch 'main' into add-loading-on-git-import-from-url

This commit is contained in:
Anirban Kar 2024-12-17 00:15:18 +05:30 committed by GitHub
commit bf7e500452
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -1 +1 @@
{ "commit": "7e650af56926d88f03e543c38d2f25280e10baa3" }
{ "commit": "43e1f436f57fc4adb43b5481b403967803d4786d" , "version": "0.0.1" }

View File

@ -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<File[]>([]); // Move here
const [imageDataList, setImageDataList] = useState<string[]>([]); // 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();