From ed97fc1682bf2700d04475e8e23db880be6fb917 Mon Sep 17 00:00:00 2001 From: Soumyadas15 Date: Fri, 6 Jun 2025 17:01:07 +0530 Subject: [PATCH 1/2] update content length fix - prod --- backend/agentpress/response_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/agentpress/response_processor.py b/backend/agentpress/response_processor.py index 83238af2..62c118e5 100644 --- a/backend/agentpress/response_processor.py +++ b/backend/agentpress/response_processor.py @@ -1711,7 +1711,7 @@ class ResponseProcessor: # "parsing_details": parsing_details # } } - } + } # STRUCTURED_OUTPUT_TOOLS = { # "str_replace", From 2445e0e0c203d7128b0abb701b2a4adbd3af725a Mon Sep 17 00:00:00 2001 From: Soumyadas15 Date: Fri, 6 Jun 2025 17:10:26 +0530 Subject: [PATCH 2/2] fix(bug): agent not starting on landing page - fix --- .../components/home/sections/hero-section.tsx | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/frontend/src/components/home/sections/hero-section.tsx b/frontend/src/components/home/sections/hero-section.tsx index f2ec8206..9209934a 100644 --- a/frontend/src/components/home/sections/hero-section.tsx +++ b/frontend/src/components/home/sections/hero-section.tsx @@ -10,12 +10,10 @@ import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useAuth } from '@/components/AuthProvider'; import { - createProject, - createThread, - addUserMessage, BillingError, } from '@/lib/api'; -import { useStartAgentMutation } from '@/hooks/react-query/threads/use-agent-run'; +import { useInitiateAgentMutation } from '@/hooks/react-query/dashboard/use-initiate-agent'; +import { useThreadQuery } from '@/hooks/react-query/threads/use-threads'; import { generateThreadName } from '@/lib/actions/threads'; import GoogleSignIn from '@/components/GoogleSignIn'; import { Input } from '@/components/ui/input'; @@ -59,7 +57,9 @@ export function HeroSection() { const { data: accounts } = useAccounts(); const personalAccount = accounts?.find((account) => account.personal_account); const { onOpen } = useModal(); - const startAgentMutation = useStartAgentMutation(); + const initiateAgentMutation = useInitiateAgentMutation(); + const [initiatedThreadId, setInitiatedThreadId] = useState(null); + const threadQuery = useThreadQuery(initiatedThreadId || ''); // Auth dialog state const [authDialogOpen, setAuthDialogOpen] = useState(false); @@ -93,14 +93,12 @@ export function HeroSection() { }; }, [scrollY]); - // Store the input value when auth dialog opens useEffect(() => { if (authDialogOpen && inputValue.trim()) { localStorage.setItem(PENDING_PROMPT_KEY, inputValue.trim()); } }, [authDialogOpen, inputValue]); - // Close dialog and redirect when user authenticates useEffect(() => { if (authDialogOpen && user && !isLoading) { setAuthDialogOpen(false); @@ -108,38 +106,40 @@ export function HeroSection() { } }, [user, isLoading, authDialogOpen, router]); - // Create an agent with the provided prompt + useEffect(() => { + if (threadQuery.data && initiatedThreadId) { + const thread = threadQuery.data; + if (thread.project_id) { + router.push(`/projects/${thread.project_id}/thread/${initiatedThreadId}`); + } else { + router.push(`/thread/${initiatedThreadId}`); + } + setInitiatedThreadId(null); + } + }, [threadQuery.data, initiatedThreadId, router]); + const createAgentWithPrompt = async () => { if (!inputValue.trim() || isSubmitting) return; - setIsSubmitting(true); - try { - // Generate a name for the project using GPT - const projectName = await generateThreadName(inputValue); + const formData = new FormData(); + formData.append('prompt', inputValue.trim()); + formData.append('model_name', 'openrouter/deepseek/deepseek-chat'); + formData.append('enable_thinking', 'false'); + formData.append('reasoning_effort', 'low'); + formData.append('stream', 'true'); + formData.append('enable_context_manager', 'false'); - // 1. Create a new project with the GPT-generated name - const newAgent = await createProject({ - name: projectName, - description: '', - }); + const result = await initiateAgentMutation.mutateAsync(formData); - const thread = await createThread(newAgent.id); - await addUserMessage(thread.thread_id, inputValue.trim()); - await startAgentMutation.mutateAsync({ - threadId: thread.thread_id, - options: { - model_name: 'openrouter/deepseek/deepseek-chat', - stream: true, - }, - }); - router.push(`/projects/${newAgent.id}/thread/${thread.thread_id}`); + setInitiatedThreadId(result.thread_id); setInputValue(''); } catch (error: any) { console.error('Error creating agent:', error); if (error instanceof BillingError) { console.log('Handling BillingError from hero section:', error.detail); + onOpen("paymentRequiredDialog"); } else { const isConnectionError = error instanceof TypeError &&