dify/web/features/agent-v2/agent-detail/layout.tsx

37 lines
892 B
TypeScript

'use client'
import type { ReactNode } from 'react'
import { useQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import useDocumentTitle from '@/hooks/use-document-title'
import { consoleQuery } from '@/service/client'
type AgentDetailLayoutProps = {
agentId: string
children: ReactNode
}
export function AgentDetailLayout({
agentId,
children,
}: AgentDetailLayoutProps) {
const { t } = useTranslation('agentV2')
const agentQuery = useQuery(consoleQuery.agent.byAgentId.get.queryOptions({
input: {
params: {
agent_id: agentId,
},
},
}))
useDocumentTitle(agentQuery.data?.name ?? t('agentDetail.documentTitle'))
return (
<div className="relative flex h-full min-w-0 flex-col overflow-hidden">
<div className="min-h-0 min-w-0 flex-1 overflow-auto">
{children}
</div>
</div>
)
}