Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agentex-ui/components/agentex-ui-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function AgentexUIRoot() {
(taskId: string | null) => {
updateParams({
[SearchParamKey.TASK_ID]: taskId,
[SearchParamKey.VIEW]: null,
});
},
[updateParams]
Expand Down
60 changes: 34 additions & 26 deletions agentex-ui/components/primary-content/primary-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { ArrowDown } from 'lucide-react';
import { ChatView } from '@/components/primary-content/chat-view';
import { HomeView } from '@/components/primary-content/home-view';
import { PromptInput } from '@/components/primary-content/prompt-input';
import { ScheduledTasksPage } from '@/components/scheduled-tasks/scheduled-tasks-page';
import { IconButton } from '@/components/ui/icon-button';
import { useSafeSearchParams } from '@/hooks/use-safe-search-params';
import { AppView, useSafeSearchParams } from '@/hooks/use-safe-search-params';

type ContentAreaProps = {
isTracesSidebarOpen: boolean;
Expand All @@ -18,7 +19,8 @@ export function PrimaryContent({
isTracesSidebarOpen,
toggleTracesSidebar,
}: ContentAreaProps) {
const { taskID } = useSafeSearchParams();
const { taskID, view } = useSafeSearchParams();
const isScheduledTasksView = view === AppView.SCHEDULED_TASKS;

const [prompt, setPrompt] = useState<string>('');
const [showScrollButton, setShowScrollButton] = useState(false);
Expand Down Expand Up @@ -56,20 +58,24 @@ export function PrimaryContent({
}, [scrollContainerRef]);

useEffect(() => {
if (scrollContainerRef.current && taskID) {
if (scrollContainerRef.current && taskID && !isScheduledTasksView) {
setTimeout(() => {
scrollToBottom();
}, 150);
}
}, [scrollToBottom, taskID]);
}, [scrollToBottom, taskID, isScheduledTasksView]);

return (
<motion.div
layout
className={`relative flex h-full flex-1 flex-col ${!taskID ? 'justify-center' : 'justify-between'}`}
className={`relative flex h-full flex-1 flex-col ${
!taskID && !isScheduledTasksView ? 'justify-center' : 'justify-between'
}`}
transition={{ duration: 0.25, ease: 'easeInOut' }}
>
{taskID ? (
{isScheduledTasksView ? (
<ScheduledTasksPage />
) : taskID ? (
<ChatView
taskID={taskID}
isTracesSidebarOpen={isTracesSidebarOpen}
Expand All @@ -81,26 +87,28 @@ export function PrimaryContent({
<HomeView />
)}

<motion.div
layout="position"
className="relative flex w-full justify-center px-4 py-4 sm:px-6 md:px-8"
transition={{
layout: {
type: 'spring',
damping: 40,
stiffness: 300,
mass: 0.8,
},
}}
>
<AnimatePresence>
{taskID && showScrollButton && (
<ScrollToBottomButton scrollToBottom={scrollToBottom} />
)}
</AnimatePresence>

<PromptInput prompt={prompt} setPrompt={setPrompt} />
</motion.div>
{!isScheduledTasksView && (
<motion.div
layout="position"
className="relative flex w-full justify-center px-4 py-4 sm:px-6 md:px-8"
transition={{
layout: {
type: 'spring',
damping: 40,
stiffness: 300,
mass: 0.8,
},
}}
>
<AnimatePresence>
{taskID && showScrollButton && (
<ScrollToBottomButton scrollToBottom={scrollToBottom} />
)}
</AnimatePresence>

<PromptInput prompt={prompt} setPrompt={setPrompt} />
</motion.div>
)}
</motion.div>
);
}
Expand Down
5 changes: 4 additions & 1 deletion agentex-ui/components/providers/agentex-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AgentexSDK from 'agentex';

interface AgentexContextValue {
agentexClient: AgentexSDK;
agentexAPIBaseURL: string;
sgpAppURL: string;
}

Expand Down Expand Up @@ -34,7 +35,9 @@ export function AgentexProvider({
);

return (
<AgentexContext.Provider value={{ agentexClient, sgpAppURL }}>
<AgentexContext.Provider
value={{ agentexClient, agentexAPIBaseURL, sgpAppURL }}
>
{children}
</AgentexContext.Provider>
);
Expand Down
Loading
Loading