mirror of https://github.com/kortix-ai/suna.git
fix(ui): functional start chat button in agent dialog
This commit is contained in:
parent
b2a6361e2d
commit
4741e6bced
|
@ -185,7 +185,7 @@ export const AgentsGrid = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChat = (agentId: string) => {
|
const handleChat = (agentId: string) => {
|
||||||
router.push(`/agents/new/${agentId}`);
|
router.push(`/dashboard?agent_id=${agentId}`);
|
||||||
setSelectedAgent(null);
|
setSelectedAgent(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import React, { useState, Suspense, useEffect, useRef } from 'react';
|
import React, { useState, Suspense, useEffect, useRef } from 'react';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { Menu } from 'lucide-react';
|
import { Menu } from 'lucide-react';
|
||||||
import {
|
import {
|
||||||
ChatInput,
|
ChatInput,
|
||||||
|
@ -40,6 +40,7 @@ function DashboardContent() {
|
||||||
const { billingError, handleBillingError, clearBillingError } =
|
const { billingError, handleBillingError, clearBillingError } =
|
||||||
useBillingError();
|
useBillingError();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const { setOpenMobile } = useSidebar();
|
const { setOpenMobile } = useSidebar();
|
||||||
const { data: accounts } = useAccounts();
|
const { data: accounts } = useAccounts();
|
||||||
|
@ -48,6 +49,16 @@ function DashboardContent() {
|
||||||
const initiateAgentMutation = useInitiateAgentWithInvalidation();
|
const initiateAgentMutation = useInitiateAgentWithInvalidation();
|
||||||
const { onOpen } = useModal();
|
const { onOpen } = useModal();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const agentIdFromUrl = searchParams.get('agent_id');
|
||||||
|
if (agentIdFromUrl && agentIdFromUrl !== selectedAgentId) {
|
||||||
|
setSelectedAgentId(agentIdFromUrl);
|
||||||
|
const newUrl = new URL(window.location.href);
|
||||||
|
newUrl.searchParams.delete('agent_id');
|
||||||
|
router.replace(newUrl.pathname + newUrl.search, { scroll: false });
|
||||||
|
}
|
||||||
|
}, [searchParams, selectedAgentId, router]);
|
||||||
|
|
||||||
const secondaryGradient =
|
const secondaryGradient =
|
||||||
'bg-gradient-to-r from-blue-500 to-blue-500 bg-clip-text text-transparent';
|
'bg-gradient-to-r from-blue-500 to-blue-500 bg-clip-text text-transparent';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue