diff --git a/.env.example b/.env.example index 09d3f15b..caaf9d2a 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,5 @@ BACKEND_URL=http://localhost:8000 GUARDRAILS_URL = http://localhost:8001 GUARDRAILS_TOKEN = NEXT_PUBLIC_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com +WEBHOOK_URL=https://your-public-app-url.example.com +WEBHOOK_SECRET= diff --git a/app/(main)/chatbot/[chatbotId]/chat/page.tsx b/app/(main)/chatbot/[chatbotId]/chat/page.tsx new file mode 100644 index 00000000..8a50a10e --- /dev/null +++ b/app/(main)/chatbot/[chatbotId]/chat/page.tsx @@ -0,0 +1,72 @@ +"use client"; + +import { useParams } from "next/navigation"; +import Sidebar from "@/app/components/Sidebar"; +import PageHeader from "@/app/components/PageHeader"; +import { Button } from "@/app/components/ui"; +import { RefreshIcon } from "@/app/components/icons"; +import { + ChatbotBreadcrumb, + ChatbotChatWindow, + ChatbotStatusBadge, +} from "@/app/components/chatbot"; +import type { BreadcrumbItem } from "@/app/components/chatbot/ChatbotBreadcrumb"; +import { useApp } from "@/app/lib/context/AppContext"; +import { useChatbot } from "@/app/hooks/chatbot/useChatbot"; +import { useChatbotSession } from "@/app/hooks/chatbot/useChatbotSession"; + +export default function ChatbotChatPage() { + const { chatbotId } = useParams<{ chatbotId: string }>(); + const { sidebarCollapsed } = useApp(); + const { chatbot } = useChatbot(chatbotId); + const session = useChatbotSession(chatbotId); + + const breadcrumb: BreadcrumbItem[] = [ + { label: chatbot?.name ?? "…", href: `/chatbot/${chatbotId}` }, + ]; + if (session.sessionId) + breadcrumb.push({ label: session.sessionId, muted: true }); + + return ( +
{error}
; + } + if (chatbots.length === 0) { + return ( +No chatbots yet.
+ ++ No chatbots match "{search}". +
+ ); + } + return+ The bot will send the first message. +
+ ++ This session was replaced by a newer one. Restart to continue + testing. +
+ )} + +| Name | +Last updated | +Created | +Actions | +
|---|---|---|---|
| + + {chatbot.name} + + | ++ {formatRelativeTime(chatbot.updated_at)} + | ++ {formatRelativeTime(chatbot.inserted_at)} + | +
+
+ |
+
Onboarding
+{id}
+