mirror of
https://github.com/coleam00/bolt.new-any-llm
synced 2024-12-27 22:33:03 +00:00
Merge pull request #669 from thecodacus/prompt-url-params
feat(url-prompt) added prompt url params
This commit is contained in:
commit
43e1f436f5
@ -1 +1 @@
|
||||
{ "commit": "49b02dd885919e24a201f07b1a7b0fd0371b4f85" , "version": "0.0.1" }
|
||||
{ "commit": "e3bdd6944be8e4b4a6bb6c81f569fb3d5f444942" }
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user