diff --git a/.env.example b/.env.example index 09d3f15b..8d0346eb 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 +NEXT_PUBLIC_APP_URL=https://your-public-app-url.example.com +WEBHOOK_SECRET= diff --git a/app/(main)/chatbot/chat/page.tsx b/app/(main)/chatbot/chat/page.tsx new file mode 100644 index 00000000..de3321a9 --- /dev/null +++ b/app/(main)/chatbot/chat/page.tsx @@ -0,0 +1,78 @@ +"use client"; + +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 { useApp } from "@/app/lib/context/AppContext"; +import { useToast } from "@/app/hooks/useToast"; +import { useChatbotSession } from "@/app/hooks/chatbot/useChatbotSession"; +import { useChatbotStore } from "@/app/lib/store/chatbot"; + +export default function ChatbotChatPage() { + const { sidebarCollapsed } = useApp(); + const toast = useToast(); + const session = useChatbotSession(); + const savedFlow = useChatbotStore((s) => s.savedFlow); + + const handleRestart = async () => { + if (!savedFlow) { + toast.error("Save the flow first to start a session."); + return; + } + if (await session.startSession(savedFlow)) { + toast.success("New chat session started."); + } + }; + + return ( +
+ No chatbot session yet. Pick a configuration, write a prompt and save + the flow first. +
+ + Go to the flow + ++ The bot will send the first message. +
+ ++ This session was replaced by a newer one. Restart to continue + testing. +
+ )} + ++ {chatbotRef} +
+ )} +