mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-23 03:07:05 +00:00
added prompt url params
This commit is contained in:
parent
cf21dde102
commit
e3bdd6944b
@ -20,6 +20,7 @@ import Cookies from 'js-cookie';
|
|||||||
import { debounce } from '~/utils/debounce';
|
import { debounce } from '~/utils/debounce';
|
||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
import type { ProviderInfo } from '~/types/model';
|
import type { ProviderInfo } from '~/types/model';
|
||||||
|
import { useSearchParams } from '@remix-run/react';
|
||||||
|
|
||||||
const toastAnimation = cssTransition({
|
const toastAnimation = cssTransition({
|
||||||
enter: 'animated fadeInRight',
|
enter: 'animated fadeInRight',
|
||||||
@ -93,6 +94,7 @@ export const ChatImpl = memo(
|
|||||||
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
|
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
|
||||||
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
|
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
|
||||||
const { activeProviders } = useSettings();
|
const { activeProviders } = useSettings();
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
const [model, setModel] = useState(() => {
|
const [model, setModel] = useState(() => {
|
||||||
const savedModel = Cookies.get('selectedModel');
|
const savedModel = Cookies.get('selectedModel');
|
||||||
@ -126,6 +128,24 @@ export const ChatImpl = memo(
|
|||||||
initialMessages,
|
initialMessages,
|
||||||
initialInput: Cookies.get(PROMPT_COOKIE_KEY) || '',
|
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 { enhancingPrompt, promptEnhanced, enhancePrompt, resetEnhancer } = usePromptEnhancer();
|
||||||
const { parsedMessages, parseMessages } = useMessageParser();
|
const { parsedMessages, parseMessages } = useMessageParser();
|
||||||
|
Loading…
Reference in New Issue
Block a user