diff --git a/build/404.html b/build/404.html index d980a3c..b75fe3b 100644 --- a/build/404.html +++ b/build/404.html @@ -1 +1 @@ -404: This page could not be found.Lake AI - A chatbot Intregation using ChatGPT

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.Lake AI - A chatbot Intregation using ChatGPT

404

This page could not be found.

\ No newline at end of file diff --git a/build/_next/static/Dh46PL5DqXexCV7uhVlKw/_buildManifest.js b/build/_next/static/UdlQRROhlqiIr_wixzJmK/_buildManifest.js similarity index 100% rename from build/_next/static/Dh46PL5DqXexCV7uhVlKw/_buildManifest.js rename to build/_next/static/UdlQRROhlqiIr_wixzJmK/_buildManifest.js diff --git a/build/_next/static/Dh46PL5DqXexCV7uhVlKw/_ssgManifest.js b/build/_next/static/UdlQRROhlqiIr_wixzJmK/_ssgManifest.js similarity index 100% rename from build/_next/static/Dh46PL5DqXexCV7uhVlKw/_ssgManifest.js rename to build/_next/static/UdlQRROhlqiIr_wixzJmK/_ssgManifest.js diff --git a/build/_next/static/chunks/app/trychatbot/page-91cde2b5e44500d8.js b/build/_next/static/chunks/app/trychatbot/page-b554a968326f9d9d.js similarity index 51% rename from build/_next/static/chunks/app/trychatbot/page-91cde2b5e44500d8.js rename to build/_next/static/chunks/app/trychatbot/page-b554a968326f9d9d.js index dc02ea8..3884e69 100644 --- a/build/_next/static/chunks/app/trychatbot/page-91cde2b5e44500d8.js +++ b/build/_next/static/chunks/app/trychatbot/page-b554a968326f9d9d.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[819],{848:function(e,t,n){Promise.resolve().then(n.bind(n,6011))},7832:function(e,t,n){"use strict";n.d(t,{Z:function(){return Components_Navbar}});var s=n(7437),a=n(1396),r=n.n(a);n(2265);var l=n(4606),Components_Logout=()=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("li",{children:(0,s.jsx)("div",{onClick:()=>{localStorage.removeItem("UserId"),window.location.reload()},className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"Log Out"})})}),Components_Navbar=()=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{children:(0,s.jsx)("nav",{className:"fixed top-0 left-0 w-full border-gray-200 px-2 sm:px-4 py-2.5 rounded",children:(0,s.jsxs)("div",{className:"container flex flex-wrap justify-between items-center mx-auto",children:[(0,s.jsx)(r(),{href:"/dashboard",className:"flex items-center",children:(0,s.jsx)("span",{className:"self-center text-xl font-semibold font-serif px-3 whitespace-nowrap text-gray-700",children:"Chit Chat"})}),(0,s.jsx)("div",{className:"w-full md:w-auto",id:"navbar-default",children:(0,s.jsxs)("ul",{className:"flex flex-row flex-wrap p-4 mt-4 rounded-lg border border-gray-100 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium md:border-0 dark:border-gray-400",children:[(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"/organization",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"Organizations"})}),(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"/addAIData",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"Train Data"})}),(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"https://github.com/apurvjha123",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"About"})}),(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"https://github.com/Lake-ai",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)(l.rFR,{className:"p-1 text-xl"}),"Contribute"]})})}),(0,s.jsx)(Components_Logout,{})]})})]})})})})},4608:function(e,t,n){"use strict";var s=n(7437);n(2265);var a=n(1396),r=n.n(a);t.Z=()=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,s.jsxs)("div",{className:"bg-white bg-opacity-10 rounded-xl p-8 w-96 shadow-lg backdrop-blur-md",children:[(0,s.jsx)("h2",{className:"text-xl font-bold mb-4",children:"Login Is Require !"}),(0,s.jsx)(r(),{href:"/login",className:"px-4 py-2 rounded bg-white bg-opacity-20 hover:bg-opacity-30 focus:outline-none",children:"Sign Up"})]})})})},3396:function(e,t,n){"use strict";n.d(t,{K:function(){return serverUrl}});let serverUrl=e=>(e.Production,"https://chit-chat.fun")},6011:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return page}});var s=n(7437),a=n(2265),r=n(1678),l=n(3396);let o=(0,l.K)({Production:!0});var trychatbot_ChatBotComponent=e=>{let{initialMessage:t="Hello! How Can I Assist You ?",chatbotTitle:n="Chat bot",LLM:l,brandImage:i="https://www.kindpng.com/picc/m/179-1798038_chatbots-builder-pricing-crozdesk-free-chatbot-hd-png.png",apiKey:c,switchAPI:d=!1,suggestions:u=[],rateLimitDuration:p=5e3}=e,[h,m]=(0,a.useState)(!1),[x,g]=(0,a.useState)([]),[b,f]=(0,a.useState)(""),[j,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=(0,a.useRef)(null),[k,N]=(0,a.useState)(!1),[C,S]=(0,a.useState)(u),handleSuggestionClick=e=>{f(e),sendMessage(),S([])};async function generateAnswers(e){try{let t=o+"/api/v0.1/QnARetrieval?key=".concat(c);d&&(t="https://your-hosted-domain/api/v1/organization/generateCompletion?key=".concat(c));let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,llm:l})}),s=await n.json();g(e=>[...e,{type:"bot",text:s.message}]),v(!1)}catch(e){console.error(e),g(e=>[...e,{type:"bot",text:"OOPs! something went wrong"}]),v(!1)}}(0,a.useEffect)(()=>{t&&g([{type:"bot",text:t}])},[t]),(0,a.useEffect)(()=>{if(h){var e;null===(e=y.current)||void 0===e||e.focus()}},[h]),(0,a.useEffect)(()=>{var e;null===(e=w.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[x]),(0,a.useEffect)(()=>{S(u)},[u]);let sendMessage=()=>{if(b.trim()&&!k){let e={type:"user",text:b};g(t=>[...t,e]),f(""),v(!0),S([]),generateAnswers(b),N(!0),setTimeout(()=>N(!1),p)}};return(0,s.jsx)("div",{className:"fixed bottom-10 right-10",children:h?(0,s.jsxs)("div",{className:"w-80 h-96 border p-4 bg-white rounded-lg flex flex-col shadow-lg",children:[(0,s.jsxs)("div",{className:"mb-4 font-bold flex justify-between items-center text-black p-2 rounded-t-lg",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:i,alt:"brand",className:"w-6 h-6 rounded-full object-cover mr-2"}),(0,s.jsx)("span",{children:n})]}),(0,s.jsx)("button",{onClick:()=>m(!1),children:(0,s.jsx)(r.ZCS,{})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto mb-4",children:[x.map((e,t)=>(0,s.jsxs)("div",{className:"p-2 my-2 ".concat("user"===e.type?"ml-auto":""),children:["bot"===e.type&&(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:i,alt:"Bot",className:"w-6 h-6 rounded-full mr-2"}),(0,s.jsx)("span",{className:"text-black bg-gray-300 rounded-md pr-4 p-2",children:e.text})]}),"user"===e.type&&(0,s.jsxs)("div",{className:"flex flex-col items-end",children:[(0,s.jsx)("span",{className:"text-gray-600 text-sm mb-1",children:"You"}),(0,s.jsx)("span",{className:"bg-gray-300 pr-4 p-2 rounded-md text-black",children:e.text})]})]},t)),j&&(0,s.jsx)("div",{className:"text-gray-600",children:"Bot is typing..."}),(0,s.jsx)("div",{ref:w}),C.length>0&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex overflow-y-auto",children:[(0,s.jsx)("img",{src:i,alt:"Bot",className:"w-6 h-6 rounded-full mr-2"}),(0,s.jsxs)("div",{className:"bg-gray-300 p-2 rounded-lg",children:[(0,s.jsx)("div",{className:"mt-2",children:"Here are Some Suggestions"}),C.map((e,t)=>(0,s.jsx)("div",{className:"flex items-center mt-2",children:(0,s.jsx)("button",{className:"chatbot-suggestion-label bg-white hover:bg-gray-500 text-black rounded-md px-2 py-1",onClick:()=>handleSuggestionClick(e),children:e})},t))]})]})})]}),(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("input",{ref:y,type:"text",value:b,onChange:e=>f(e.target.value),onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),sendMessage())},className:"flex-1 p-2 border rounded-md"}),(0,s.jsx)("button",{onClick:sendMessage,disabled:j||k,className:"px-1 py-1 bg-blue-500 hover:bg-blue-600 active:bg-blue-700 text-white rounded-md",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",height:"30px",width:"30px",children:(0,s.jsx)("path",{fill:"#d7d7d7",d:"M22,11.7V12h-0.1c-0.1,1-17.7,9.5-18.8,9.1c-1.1-0.4,2.4-6.7,3-7.5C6.8,12.9,17.1,12,17.1,12H17c0,0,0-0.2,0-0.2c0,0,0,0,0,0c0-0.4-10.2-1-10.8-1.7c-0.6-0.7-4-7.1-3-7.5C4.3,2.1,22,10.5,22,11.7z"})})})]})]}):(0,s.jsx)("div",{onClick:()=>m(!0),className:"w-16 h-16 bg-white rounded-full flex items-center justify-center cursor-pointer shadow-lg",children:(0,s.jsx)("img",{src:i,alt:"Chat Icon",className:"w-full h-full rounded-full object-cover"})})})},i=n(7832),c=n(4608);n(4741);var d=n(6820),u=n(2686),p=n.n(u),Docs_DocsModal=e=>{let{apiKey:t,initialMessage:n,chatbotTitle:r,LLM:l,brandImage:o,suggestions:i,rateLimitDuration:c,onClick:u}=e,h='async function generateAnswer(userQuestion) {\n let chatAPIUrl = "https://chit-chat.fun/api/v0.1/QnARetrieval?key='.concat(t,'";\n \n const payloadBody = {\n prompt: userQuestion,\n llm: "').concat(l,'"\n };\n \n try {\n const response = await fetch(chatAPIUrl, {\n method: "POST",\n headers: {\n "Content-Type": "application/json",\n },\n body: JSON.stringify(payloadBody),\n });\n \n if (!response.ok) {\n throw new Error("HTTP error! Status:",response.status);\n }\n \n const jsonData = await response.json();\n return jsonData;\n } catch (error) {\n console.error("Error fetching data:", error);\n throw error; \n }\n }\n \n //generateAnswer("ask your question").then(\n //answer=> console.log(answer)\n //).catch(error=> console.log(error))\n '),[m,x]=(0,a.useState)(h),handleButtonClick=e=>{switch(e){case"API":x("".concat(h));break;case"JS":x('\n\n\n \n \n \n Chat Bot\n\n\n
\n\n\n\n\n\n\n\n "));break;case"REACTJS":x("\n`1. Install this Dependency:`\nnpm i lake-ai-npm\n\n`2. Configuration & Usage:`\n\nimport ChatBot from 'lake-ai-npm';\n\nexport default function YourComponent() {\n return '"'.concat(e,'"')).join(", "),"]}\n rateLimitDuration = {").concat(c,"} />;\n}\n\n "));break;case"PYTHON":x('\n`1. Install this library:`\npip install requests\n\n`2. Usage:`\n\nimport requests\n\ndef generate_answer(user_question):\n chat_api_url = "http://chit-chat.fun/api/v0.1/QnARetrieval?key='.concat(t,'"\n\n payload_body = {\n "prompt": user_question,\n "llm":').concat(l,'\n }\n\n try:\n response = requests.post(chat_api_url, json=payload_body, headers={"Content-Type": "application/json"})\n\n if response.status_code != 200:\n raise Exception(f"HTTP error! Status: {response.status_code}")\n\n json_data = response.json()\n return json_data\n\n except Exception as e:\n print("Error fetching data:", e)\n raise e\n\n# Usage example\n\nuser_question = "How does this work?"\n\ntry:\n result = generate_answer(user_question)\n print(result)\nexcept Exception as e:\n print("An error occurred:", e)\n '));break;default:x("")}},g=(0,a.useRef)(null);return(0,a.useEffect)(()=>{g.current&&p().highlightAllUnder(g.current)},[m]),(0,s.jsx)("div",{onClick:u,className:"absolute inset-0 flex items-center justify-center p-4 sm:p-28 md:p-32 lg:p-16 xl:p-12",children:(0,s.jsxs)("div",{onClick:e=>{e.stopPropagation()},className:"relative bg-white bg-opacity-20 backdrop-blur-md p-4 sm:p-6 rounded-lg w-full max-w-2xl h-full max-h-screen overflow-y-auto",children:[(0,s.jsxs)("div",{className:"flex space-x-4 mb-4",children:[(0,s.jsx)("button",{onClick:()=>handleButtonClick("API"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"API"}),(0,s.jsx)("button",{onClick:()=>handleButtonClick("JS"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"JS"}),(0,s.jsx)("button",{onClick:()=>handleButtonClick("REACTJS"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"REACTJS"}),(0,s.jsx)("button",{onClick:()=>handleButtonClick("PYTHON"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"PYTHON"})]}),(0,s.jsx)("button",{onClick:()=>{if(g.current){let e=g.current.innerText;navigator.clipboard.writeText(e)}},className:"absolute top-2 right-2 bg-white p-2 rounded-full active:bg-pink-500 hover:bg-gray-200 transition duration-300 ease-in-out z-10",children:(0,s.jsx)(d.fwS,{className:"text-pink-200 active:text-black"})}),(0,s.jsx)("div",{className:"relative z-0",children:(0,s.jsx)("pre",{ref:g,className:"language-javascript overflow-x-auto rounded-lg shadow-xl hljs p-2 sm:text-base text-sm w-full",children:(0,s.jsx)("code",{children:m})})})]})})};n(171);var page=()=>{var e;let[t,n]=(0,a.useState)(null);(0,a.useEffect)(()=>{{let e=localStorage.getItem("UserId");n(e)}},[]);let[r,l]=(0,a.useState)({apiKey:null!==(e=localStorage.getItem("apiKey"))&&void 0!==e?e:"",initialMessage:"Hello! How Can I Assist You ?",chatbotTitle:"Chat bot",LLM:"Gemini",brandImage:"https://cdn.jsdelivr.net/gh/Lake-ai/cdn-interface/chatbot.png",suggestions:[],rateLimitDuration:5e3}),[o,d]=(0,a.useState)({apiKey:"",initialMessage:"Hello! How Can I Assist You ?",chatbotTitle:"Chat bot",LLM:"Gemini",brandImage:"https://www.kindpng.com/picc/m/179-1798038_chatbots-builder-pricing-crozdesk-free-chatbot-hd-png.png",suggestions:[],rateLimitDuration:5e3}),[u,p]=(0,a.useState)(!1),closeModal=()=>{p(!1)};return(0,a.useRef)(),(0,a.useEffect)(()=>{let handleClickOutside=e=>{e.target.classList.contains("modal-background")&&closeModal()};return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{}),t?(0,s.jsxs)(s.Fragment,{children:[u&&(0,s.jsx)(Docs_DocsModal,{onClick:closeModal,...o}),(0,s.jsxs)("div",{className:"sm:pt-20 pt-48 overflow-y-auto flex items-center justify-center",children:[(0,s.jsx)("div",{className:"bg-white bg-opacity-50 rounded p-8 w-96",children:(0,s.jsxs)("form",{className:"space-y-4",onSubmit:e=>{e.preventDefault(),console.log(r),p(!0),d(r)},children:[(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Chatbot Title:"}),(0,s.jsx)("input",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Chatbot Title",value:r.chatbotTitle,onChange:e=>l(t=>({...t,chatbotTitle:e.target.value}))})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Chatbot LLM:"}),(0,s.jsxs)("select",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",value:r.LLM,onChange:e=>{l(t=>({...t,LLM:e.target.value}))},children:[(0,s.jsx)("option",{value:"OpenAI",children:"OpenAI"}),(0,s.jsx)("option",{value:"Gemini",children:"Gemini"})]})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Brand Image URL:"}),(0,s.jsx)("input",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Brand Image URL",value:r.brandImage,onChange:e=>l(t=>({...t,brandImage:e.target.value}))})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Suggestions:"}),(0,s.jsx)("textarea",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Enter suggestions (one per line)",value:r.suggestions.join("\n"),onChange:e=>l(t=>({...t,suggestions:e.target.value.split("\n")}))})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Rate Limit Duration (in MS):"}),(0,s.jsx)("input",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Rate Limit Duration",type:"number",value:r.rateLimitDuration,onChange:e=>l(t=>({...t,rateLimitDuration:Number(e.target.value)}))})]}),(0,s.jsx)("button",{type:"submit",className:"mt-4 bg-pink-500 text-white rounded p-2",children:"Integrate"})]})}),(0,s.jsx)(trychatbot_ChatBotComponent,{...r})]})]}):(0,s.jsx)(c.Z,{})]})}}},function(e){e.O(0,[447,115,724,438,900,971,864,744],function(){return e(e.s=848)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[819],{848:function(e,t,n){Promise.resolve().then(n.bind(n,6011))},7832:function(e,t,n){"use strict";n.d(t,{Z:function(){return Components_Navbar}});var s=n(7437),a=n(1396),r=n.n(a);n(2265);var l=n(4606),Components_Logout=()=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("li",{children:(0,s.jsx)("div",{onClick:()=>{localStorage.removeItem("UserId"),window.location.reload()},className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"Log Out"})})}),Components_Navbar=()=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{children:(0,s.jsx)("nav",{className:"fixed top-0 left-0 w-full border-gray-200 px-2 sm:px-4 py-2.5 rounded",children:(0,s.jsxs)("div",{className:"container flex flex-wrap justify-between items-center mx-auto",children:[(0,s.jsx)(r(),{href:"/dashboard",className:"flex items-center",children:(0,s.jsx)("span",{className:"self-center text-xl font-semibold font-serif px-3 whitespace-nowrap text-gray-700",children:"Chit Chat"})}),(0,s.jsx)("div",{className:"w-full md:w-auto",id:"navbar-default",children:(0,s.jsxs)("ul",{className:"flex flex-row flex-wrap p-4 mt-4 rounded-lg border border-gray-100 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium md:border-0 dark:border-gray-400",children:[(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"/organization",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"Organizations"})}),(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"/addAIData",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"Train Data"})}),(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"https://github.com/apurvjha123",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:"About"})}),(0,s.jsx)("li",{children:(0,s.jsx)(r(),{href:"https://github.com/Lake-ai",className:"block py-2 pr-4 pl-3 text-gray-700 hover:text-sky-600 rounded md:bg-transparent md:p-0",children:(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)(l.rFR,{className:"p-1 text-xl"}),"Contribute"]})})}),(0,s.jsx)(Components_Logout,{})]})})]})})})})},4608:function(e,t,n){"use strict";var s=n(7437);n(2265);var a=n(1396),r=n.n(a);t.Z=()=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,s.jsxs)("div",{className:"bg-white bg-opacity-10 rounded-xl p-8 w-96 shadow-lg backdrop-blur-md",children:[(0,s.jsx)("h2",{className:"text-xl font-bold mb-4",children:"Login Is Require !"}),(0,s.jsx)(r(),{href:"/login",className:"px-4 py-2 rounded bg-white bg-opacity-20 hover:bg-opacity-30 focus:outline-none",children:"Sign Up"})]})})})},3396:function(e,t,n){"use strict";n.d(t,{K:function(){return serverUrl}});let serverUrl=e=>(e.Production,"https://chit-chat.fun")},6011:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return page}});var s=n(7437),a=n(2265),r=n(1678),l=n(3396);let o=(0,l.K)({Production:!0});var trychatbot_ChatBotComponent=e=>{let{initialMessage:t="Hello! How Can I Assist You ?",chatbotTitle:n="Chat bot",LLM:l,brandImage:i="https://www.kindpng.com/picc/m/179-1798038_chatbots-builder-pricing-crozdesk-free-chatbot-hd-png.png",apiKey:c,switchAPI:d=!1,suggestions:u=[],rateLimitDuration:h=5e3}=e,[p,m]=(0,a.useState)(!1),[x,g]=(0,a.useState)([]),[b,f]=(0,a.useState)(""),[j,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=(0,a.useRef)(null),[k,N]=(0,a.useState)(!1),[C,S]=(0,a.useState)(u),handleSuggestionClick=e=>{f(e),sendMessage(),S([])};async function generateAnswers(e){try{let t=o+"/api/v0.1/QnARetrieval?key=".concat(c);d&&(t="https://your-hosted-domain/api/v1/organization/generateCompletion?key=".concat(c));let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,llm:l})}),s=await n.json();g(e=>[...e,{type:"bot",text:s.message}]),v(!1)}catch(e){console.error(e),g(e=>[...e,{type:"bot",text:"OOPs! something went wrong"}]),v(!1)}}(0,a.useEffect)(()=>{t&&g([{type:"bot",text:t}])},[t]),(0,a.useEffect)(()=>{if(p){var e;null===(e=y.current)||void 0===e||e.focus()}},[p]),(0,a.useEffect)(()=>{var e;null===(e=w.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[x]),(0,a.useEffect)(()=>{S(u)},[u]);let sendMessage=()=>{if(b.trim()&&!k){let e={type:"user",text:b};g(t=>[...t,e]),f(""),v(!0),S([]),generateAnswers(b),N(!0),setTimeout(()=>N(!1),h)}};return(0,s.jsx)("div",{className:"fixed bottom-10 right-10",children:p?(0,s.jsxs)("div",{className:"w-80 h-96 border p-4 bg-white rounded-lg flex flex-col shadow-lg",children:[(0,s.jsxs)("div",{className:"mb-4 font-bold flex justify-between items-center text-black p-2 rounded-t-lg",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:i,alt:"brand",className:"w-6 h-6 rounded-full object-cover mr-2"}),(0,s.jsx)("span",{children:n})]}),(0,s.jsx)("button",{onClick:()=>m(!1),children:(0,s.jsx)(r.ZCS,{})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto mb-4",children:[x.map((e,t)=>(0,s.jsxs)("div",{className:"p-2 my-2 ".concat("user"===e.type?"ml-auto":""),children:["bot"===e.type&&(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{src:i,alt:"Bot",className:"w-6 h-6 rounded-full mr-2"}),(0,s.jsx)("span",{className:"text-black bg-gray-300 rounded-md pr-4 p-2",children:e.text})]}),"user"===e.type&&(0,s.jsxs)("div",{className:"flex flex-col items-end",children:[(0,s.jsx)("span",{className:"text-gray-600 text-sm mb-1",children:"You"}),(0,s.jsx)("span",{className:"bg-gray-300 pr-4 p-2 rounded-md text-black",children:e.text})]})]},t)),j&&(0,s.jsx)("div",{className:"text-gray-600",children:"Bot is typing..."}),(0,s.jsx)("div",{ref:w}),C.length>0&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex overflow-y-auto",children:[(0,s.jsx)("img",{src:i,alt:"Bot",className:"w-6 h-6 rounded-full mr-2"}),(0,s.jsxs)("div",{className:"bg-gray-300 p-2 rounded-lg",children:[(0,s.jsx)("div",{className:"mt-2",children:"Here are Some Suggestions"}),C.map((e,t)=>(0,s.jsx)("div",{className:"flex items-center mt-2",children:(0,s.jsx)("button",{className:"chatbot-suggestion-label bg-white hover:bg-gray-500 text-black rounded-md px-2 py-1",onClick:()=>handleSuggestionClick(e),children:e})},t))]})]})})]}),(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("input",{ref:y,type:"text",value:b,onChange:e=>f(e.target.value),onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),sendMessage())},className:"flex-1 p-2 border rounded-md"}),(0,s.jsx)("button",{onClick:sendMessage,disabled:j||k,className:"px-1 py-1 bg-blue-500 hover:bg-blue-600 active:bg-blue-700 text-white rounded-md",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",height:"30px",width:"30px",children:(0,s.jsx)("path",{fill:"#d7d7d7",d:"M22,11.7V12h-0.1c-0.1,1-17.7,9.5-18.8,9.1c-1.1-0.4,2.4-6.7,3-7.5C6.8,12.9,17.1,12,17.1,12H17c0,0,0-0.2,0-0.2c0,0,0,0,0,0c0-0.4-10.2-1-10.8-1.7c-0.6-0.7-4-7.1-3-7.5C4.3,2.1,22,10.5,22,11.7z"})})})]})]}):(0,s.jsx)("div",{onClick:()=>m(!0),className:"w-16 h-16 bg-white rounded-full flex items-center justify-center cursor-pointer shadow-lg",children:(0,s.jsx)("img",{src:i,alt:"Chat Icon",className:"w-full h-full rounded-full object-cover"})})})},i=n(7832),c=n(4608);n(4741);var d=n(6820),u=n(2686),h=n.n(u),Docs_DocsModal=e=>{let{apiKey:t,initialMessage:n,chatbotTitle:r,LLM:l,brandImage:o,suggestions:i,rateLimitDuration:c,onClick:u}=e,p='async function generateAnswer(userQuestion) {\n let chatAPIUrl = "https://chit-chat.fun/api/v0.1/QnARetrieval?key='.concat(t,'";\n \n const payloadBody = {\n prompt: userQuestion,\n llm: "').concat(l,'"\n };\n \n try {\n const response = await fetch(chatAPIUrl, {\n method: "POST",\n headers: {\n "Content-Type": "application/json",\n },\n body: JSON.stringify(payloadBody),\n });\n \n if (!response.ok) {\n throw new Error("HTTP error! Status:",response.status);\n }\n \n const jsonData = await response.json();\n return jsonData;\n } catch (error) {\n console.error("Error fetching data:", error);\n throw error; \n }\n }\n \n //generateAnswer("ask your question").then(\n //answer=> console.log(answer)\n //).catch(error=> console.log(error))\n '),[m,x]=(0,a.useState)(p),handleButtonClick=e=>{switch(e){case"API":x("".concat(p));break;case"JS":x('\n\n\n \n \n \n Chat Bot\n\n\n
\n\n\n\n\n\n\n\n "));break;case"REACTJS":x("\n`1. Install this Dependency:`\nnpm i chit-chat-react\n\n`2. Configuration & Usage:`\n\nimport ChatBot from 'chit-chat-react';\n\nexport default function YourComponent() {\n return '"'.concat(e,'"')).join(", "),"]}\n rateLimitDuration = {").concat(c,"} />;\n}\n\n "));break;case"PYTHON":x('\n`1. Install this library:`\npip install requests\n\n`2. Usage:`\n\nimport requests\n\ndef generate_answer(user_question):\n chat_api_url = "http://chit-chat.fun/api/v0.1/QnARetrieval?key='.concat(t,'"\n\n payload_body = {\n "prompt": user_question,\n "llm":').concat(l,'\n }\n\n try:\n response = requests.post(chat_api_url, json=payload_body, headers={"Content-Type": "application/json"})\n\n if response.status_code != 200:\n raise Exception(f"HTTP error! Status: {response.status_code}")\n\n json_data = response.json()\n return json_data\n\n except Exception as e:\n print("Error fetching data:", e)\n raise e\n\n# Usage example\n\nuser_question = "How does this work?"\n\ntry:\n result = generate_answer(user_question)\n print(result)\nexcept Exception as e:\n print("An error occurred:", e)\n '));break;default:x("")}},g=(0,a.useRef)(null);return(0,a.useEffect)(()=>{g.current&&h().highlightAllUnder(g.current)},[m]),(0,s.jsx)("div",{onClick:u,className:"absolute inset-0 flex items-center justify-center p-4 sm:p-28 md:p-32 lg:p-16 xl:p-12",children:(0,s.jsxs)("div",{onClick:e=>{e.stopPropagation()},className:"relative bg-white bg-opacity-20 backdrop-blur-md p-4 sm:p-6 rounded-lg w-full max-w-2xl h-full max-h-screen overflow-y-auto",children:[(0,s.jsxs)("div",{className:"flex space-x-4 mb-4",children:[(0,s.jsx)("button",{onClick:()=>handleButtonClick("API"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"API"}),(0,s.jsx)("button",{onClick:()=>handleButtonClick("JS"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"JS"}),(0,s.jsx)("button",{onClick:()=>handleButtonClick("REACTJS"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"REACTJS"}),(0,s.jsx)("button",{onClick:()=>handleButtonClick("PYTHON"),className:"px-3 py-2 bg-pink-500 text-white rounded",children:"PYTHON"})]}),(0,s.jsx)("button",{onClick:()=>{if(g.current){let e=g.current.innerText;navigator.clipboard.writeText(e)}},className:"absolute top-2 right-2 bg-white p-2 rounded-full active:bg-pink-500 hover:bg-gray-200 transition duration-300 ease-in-out z-10",children:(0,s.jsx)(d.fwS,{className:"text-pink-200 active:text-black"})}),(0,s.jsx)("div",{className:"relative z-0",children:(0,s.jsx)("pre",{ref:g,className:"language-javascript overflow-x-auto rounded-lg shadow-xl hljs p-2 sm:text-base text-sm w-full",children:(0,s.jsx)("code",{children:m})})})]})})};n(171);var page=()=>{var e;let[t,n]=(0,a.useState)(null);(0,a.useEffect)(()=>{{let e=localStorage.getItem("UserId");n(e)}},[]);let[r,l]=(0,a.useState)({apiKey:null!==(e=localStorage.getItem("apiKey"))&&void 0!==e?e:"",initialMessage:"Hello! How Can I Assist You ?",chatbotTitle:"Chat bot",LLM:"Gemini",brandImage:"https://cdn.jsdelivr.net/gh/Lake-ai/cdn-interface/chatbot.png",suggestions:[],rateLimitDuration:5e3}),[o,d]=(0,a.useState)({apiKey:"",initialMessage:"Hello! How Can I Assist You ?",chatbotTitle:"Chat bot",LLM:"Gemini",brandImage:"https://www.kindpng.com/picc/m/179-1798038_chatbots-builder-pricing-crozdesk-free-chatbot-hd-png.png",suggestions:[],rateLimitDuration:5e3}),[u,h]=(0,a.useState)(!1),closeModal=()=>{h(!1)};return(0,a.useRef)(),(0,a.useEffect)(()=>{let handleClickOutside=e=>{e.target.classList.contains("modal-background")&&closeModal()};return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{}),t?(0,s.jsxs)(s.Fragment,{children:[u&&(0,s.jsx)(Docs_DocsModal,{onClick:closeModal,...o}),(0,s.jsxs)("div",{className:"sm:pt-20 pt-48 overflow-y-auto flex items-center justify-center",children:[(0,s.jsx)("div",{className:"bg-white bg-opacity-50 rounded p-8 w-96",children:(0,s.jsxs)("form",{className:"space-y-4",onSubmit:e=>{e.preventDefault(),console.log(r),h(!0),d(r)},children:[(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Chatbot Title:"}),(0,s.jsx)("input",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Chatbot Title",value:r.chatbotTitle,onChange:e=>l(t=>({...t,chatbotTitle:e.target.value}))})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Chatbot LLM:"}),(0,s.jsxs)("select",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",value:r.LLM,onChange:e=>{l(t=>({...t,LLM:e.target.value}))},children:[(0,s.jsx)("option",{value:"OpenAI",children:"OpenAI"}),(0,s.jsx)("option",{value:"Gemini",children:"Gemini"})]})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Brand Image URL:"}),(0,s.jsx)("input",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Brand Image URL",value:r.brandImage,onChange:e=>l(t=>({...t,brandImage:e.target.value}))})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Suggestions:"}),(0,s.jsx)("textarea",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Enter suggestions (one per line)",value:r.suggestions.join("\n"),onChange:e=>l(t=>({...t,suggestions:e.target.value.split("\n")}))})]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-md p-2",children:"Rate Limit Duration (in MS):"}),(0,s.jsx)("input",{className:"block bg-pink-400 bg-opacity-10 rounded p-2 w-full",placeholder:"Rate Limit Duration",type:"number",value:r.rateLimitDuration,onChange:e=>l(t=>({...t,rateLimitDuration:Number(e.target.value)}))})]}),(0,s.jsx)("button",{type:"submit",className:"mt-4 bg-pink-500 text-white rounded p-2",children:"Integrate"})]})}),(0,s.jsx)(trychatbot_ChatBotComponent,{...r})]})]}):(0,s.jsx)(c.Z,{})]})}}},function(e){e.O(0,[447,115,724,438,900,971,864,744],function(){return e(e.s=848)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/build/addAIData.html b/build/addAIData.html index fcb5d44..6464ea3 100644 --- a/build/addAIData.html +++ b/build/addAIData.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file diff --git a/build/addAIData.txt b/build/addAIData.txt index 83a2834..466a86d 100644 --- a/build/addAIData.txt +++ b/build/addAIData.txt @@ -1,5 +1,5 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["addAIData",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["addAIData",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 5:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 7:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} diff --git a/build/dashboard.html b/build/dashboard.html index f76be1a..e00b726 100644 --- a/build/dashboard.html +++ b/build/dashboard.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file diff --git a/build/dashboard.txt b/build/dashboard.txt index 8cfbaca..c973467 100644 --- a/build/dashboard.txt +++ b/build/dashboard.txt @@ -1,5 +1,5 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["dashboard",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["dashboard",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 5:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 7:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} diff --git a/build/index.html b/build/index.html index 169c5e4..800aa9a 100644 --- a/build/index.html +++ b/build/index.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT

Create Your Own Chatbot API Endpoint In Seconds

Transform your data into an interactive chatbot with dynamic API endpoints. Seamlessly integrate, engage users, and harness the power of conversational AI. You are one-stop destination for effortlessly bringing intelligent chatbots to your website without any coding hassles in just a few clicks.
\ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT

Create Your Own Chatbot API Endpoint In Seconds

Transform your data into an interactive chatbot with dynamic API endpoints. Seamlessly integrate, engage users, and harness the power of conversational AI. You are one-stop destination for effortlessly bringing intelligent chatbots to your website without any coding hassles in just a few clicks.
\ No newline at end of file diff --git a/build/index.txt b/build/index.txt index 691c305..9f5360e 100644 --- a/build/index.txt +++ b/build/index.txt @@ -1,5 +1,5 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 5:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 7:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} diff --git a/build/login.html b/build/login.html index 00a77f8..472b04a 100644 --- a/build/login.html +++ b/build/login.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT
Log In

Create An Account Sign Up

\ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT
Log In

Create An Account Sign Up

\ No newline at end of file diff --git a/build/login.txt b/build/login.txt index 0174015..90ab234 100644 --- a/build/login.txt +++ b/build/login.txt @@ -1,5 +1,5 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["login",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["login",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 5:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 7:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} diff --git a/build/organization.html b/build/organization.html index d28421d..f68f65c 100644 --- a/build/organization.html +++ b/build/organization.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file diff --git a/build/organization.txt b/build/organization.txt index 154432a..d90d222 100644 --- a/build/organization.txt +++ b/build/organization.txt @@ -1,5 +1,5 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["organization",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["organization",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 5:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 7:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} diff --git a/build/sign-up.html b/build/sign-up.html index 182f10e..088d290 100644 --- a/build/sign-up.html +++ b/build/sign-up.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT
Sign Up

Already Have Account Login

\ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT
Sign Up

Already Have Account Login

\ No newline at end of file diff --git a/build/sign-up.txt b/build/sign-up.txt index 8482504..a2a3d2e 100644 --- a/build/sign-up.txt +++ b/build/sign-up.txt @@ -1,5 +1,5 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["sign-up",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["sign-up",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 5:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 7:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} diff --git a/build/trychatbot.html b/build/trychatbot.html index bba948e..3d9f02b 100644 --- a/build/trychatbot.html +++ b/build/trychatbot.html @@ -1 +1 @@ -Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file +Lake AI - A chatbot Intregation using ChatGPT \ No newline at end of file diff --git a/build/trychatbot.txt b/build/trychatbot.txt index 43d7b5c..baa11e2 100644 --- a/build/trychatbot.txt +++ b/build/trychatbot.txt @@ -1,10 +1,10 @@ 1:HL["/_next/static/css/b1239f0ee366fb18.css","style",{"crossOrigin":""}] -0:["Dh46PL5DqXexCV7uhVlKw",[[["",{"children":["trychatbot",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] +0:["UdlQRROhlqiIr_wixzJmK",[[["",{"children":["trychatbot",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b1239f0ee366fb18.css","precedence":"next","crossOrigin":""}]],"$L3"]]]] 4:HL["/_next/static/css/01def51f7bdb826d.css","style",{"crossOrigin":""}] 5:I{"id":1443,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 6:I{"id":8639,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} 8:I{"id":5146,"chunks":["272:static/chunks/webpack-f78508767184d005.js","971:static/chunks/fd9d1056-b49804a1e6f1a9b7.js","864:static/chunks/864-126ae77cc240a619.js"],"name":"","async":false} -9:I{"id":6011,"chunks":["447:static/chunks/00cbbcb7-e0bdca9dee4a6665.js","115:static/chunks/8dc5345f-0793b9dc01619ce7.js","724:static/chunks/358ff52d-05be8d4fe687e9db.js","438:static/chunks/438-e3882425300b2931.js","900:static/chunks/900-f251ec4b02f2deb2.js","819:static/chunks/app/trychatbot/page-91cde2b5e44500d8.js"],"name":"","async":false} +9:I{"id":6011,"chunks":["447:static/chunks/00cbbcb7-e0bdca9dee4a6665.js","115:static/chunks/8dc5345f-0793b9dc01619ce7.js","724:static/chunks/358ff52d-05be8d4fe687e9db.js","438:static/chunks/438-e3882425300b2931.js","900:static/chunks/900-f251ec4b02f2deb2.js","819:static/chunks/app/trychatbot/page-b554a968326f9d9d.js"],"name":"","async":false} a:I{"id":1712,"chunks":["185:static/chunks/app/layout-9d74a3d5729c1333.js"],"name":"","async":false} 2:[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_d65c78","children":["$","div",null,{"className":"w-screen min-h-screen bg-gradient-to-r from-indigo-200 via-red-200 to-yellow-100","children":[["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L6",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children","trychatbot","children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L6",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$L7",["$","$L8",null,{"propsForComponent":{"params":{}},"Component":"$9","isStaticGeneration":true}],null],"segment":"__PAGE__"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/01def51f7bdb826d.css","precedence":"next","crossOrigin":""}]]}],"segment":"trychatbot"},"styles":[]}],["$","$La",null,{}]]}]}]}],null] 3:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Lake AI - A chatbot Intregation using ChatGPT"}],["$","meta","2",{"name":"description","content":"Transform your data into an interactive chatbot with dynamic API endpoints. Seamlessly integrate, engage users, and harness the power of conversational AI. You are one-stop destination for effortlessly bringing intelligent chatbots to your website without any coding hassles in just a few clicks."}],["$","meta","3",{"name":"theme-color","content":"#FFF"}],["$","meta","4",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","5",{"property":"og:title","content":"Lake AI - A chatbot Intregation using ChatGPT"}],["$","meta","6",{"property":"og:description","content":"Transform your data into an interactive chatbot with dynamic API endpoints. Seamlessly integrate, engage users, and harness the power of conversational AI. You are one-stop destination for effortlessly bringing intelligent chatbots to your website without any coding hassles in just a few clicks."}],["$","meta","7",{"property":"og:image","content":"https://avatars.githubusercontent.com/u/169491068?s=200&v=4"}],["$","meta","8",{"name":"twitter:card","content":"summary_large_image"}],["$","meta","9",{"name":"twitter:creator","content":"@Apurvjha_eth"}],["$","meta","10",{"name":"twitter:title","content":"Lake AI - A chatbot Intregation using ChatGPT"}],["$","meta","11",{"name":"twitter:description","content":"Transform your data into an interactive chatbot with dynamic API endpoints. Seamlessly integrate, engage users, and harness the power of conversational AI. You are one-stop destination for effortlessly bringing intelligent chatbots to your website without any coding hassles in just a few clicks."}],["$","meta","12",{"name":"twitter:image","content":"https://avatars.githubusercontent.com/u/169491068?s=200&v=4"}],["$","link","13",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"32x32"}]] diff --git a/js-interface/script.js b/js-interface/script.js new file mode 100644 index 0000000..79fa669 --- /dev/null +++ b/js-interface/script.js @@ -0,0 +1,518 @@ +var userClickCount = 0; +const notificationAlert = new Audio( + "https://cdn.jsdelivr.net/gh/apurvjha123/Chit-Chat-Server/Sound/message-notification.mp3" +); +window.chatbot.chatbotTitle = "AI Chatbot"; +window.chatbot.initialMessage = "Hello! How can i assist you today ?"; +window.chatbot.brandImage = + "https://e7.pngegg.com/pngimages/498/917/png-clipart-computer-icons-desktop-chatbot-icon-blue-angle-thumbnail.png"; +window.chatbot.switchAPI = false; + +const listenEventChanges = function () { + // Trigger action when windows is load + window.addEventListener("load", function () { + loadChatBotUI(); + loadListOfSuggestions(); + + const chatBotMainBtnElement = + document.getElementsByClassName("chatbot-main-btn"); + + if (chatBotMainBtnElement.length == 0) return; + + chatBotMainBtnElement[0].classList.remove("display-none"); + chatBotMainBtnElement[0].classList.remove("animate__infinite"); + chatBotMainBtnElement[0].classList.remove("animate__slower"); + + chatBotMainBtnElement[0].classList.add("animate__faster"); + chatBotMainBtnElement[0].classList.add("animate__slideInUp"); + + setTimeout(() => { + chatBotMainBtnElement[0].classList.add("animate__infinite"); + chatBotMainBtnElement[0].classList.add("animate__slower"); + + chatBotMainBtnElement[0].classList.remove("animate__faster"); + chatBotMainBtnElement[0].classList.remove("animate__slideInUp"); + }, 2000); + + chatMessageSendBtnEnableDisable(); + }); + + // Trigger action when document is click + document.addEventListener("click", function () { + triggerAlert(); + }); +}; + +// load dependencies that required for chatbot +(function () { + const link = document.createElement("link"); + link.rel = "stylesheet"; + + const animationcss = + "https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"; + link.href = animationcss; + + document.head.appendChild(link); + listenEventChanges(); +})(); + +// function listenEventChanges() {} + +function loadChatBotUI() { + const chatbotContainer = document.getElementById("chatbot"); + + if (!chatbotContainer) return; + + chatbotContainer.innerHTML = ` + + + + `; +} + +function hideChatBotPanle() { + const chatBotMainBtnElement = + document.getElementsByClassName("chatbot-main-btn"); + const chatbotPanelElement = + document.getElementsByClassName("chatbot-container"); + + chatbotPanelElement[0].classList?.remove("animate__slideInUp"); + chatBotMainBtnElement[0].classList?.remove("display-none"); + chatBotMainBtnElement[0].classList?.remove("animate__infinite"); + chatBotMainBtnElement[0].classList?.remove("animate__slower"); + + chatbotPanelElement[0].classList?.add("animate__slideOutDown"); + chatbotPanelElement[0].classList?.add("display-none"); + + chatBotMainBtnElement[0].classList?.add("animate__slideInUp"); + chatBotMainBtnElement[0].classList.add("animate__faster"); + + setTimeout(() => { + chatBotMainBtnElement[0].classList.remove("animate__faster"); + chatBotMainBtnElement[0].classList?.remove("animate__slideInUp"); + + chatBotMainBtnElement[0].classList?.add("animate__infinite"); + chatBotMainBtnElement[0].classList.add("animate__slower"); + }, 3000); +} + +function openChatBotPanel() { + const chatBotMainBtnElement = + document.getElementsByClassName("chatbot-main-btn"); + const chatbotPanelElement = + document.getElementsByClassName("chatbot-container"); + + chatbotPanelElement[0]?.classList.remove("animate__slideOutDown"); + chatbotPanelElement[0]?.classList.remove("display-none"); + + chatbotPanelElement[0]?.classList.add("animate__slideInUp"); + + chatBotMainBtnElement[0]?.classList.add("display-none"); + + showNotificationCount(false); +} + +function showNotificationCount(show = false) { + const notificationCount = document.getElementById("notification-count"); + + if (!notificationCount) return; + + if (show) { + notificationCount.classList.add("chatbot-notification-count"); + } else { + notificationCount.classList.remove("chatbot-notification-count"); + } +} + +function triggerAlert() { + if (userClickCount == 0) { + showNotificationCount(true); + + const notificationSound = new Audio( + "https://cdn.jsdelivr.net/gh/apurvjha123/Chit-Chat-Server/Sound/message-notification.mp3" + ); + + notificationSound.play(); + } + userClickCount = 1; +} + +function chatMessageSendBtnEnableDisable() { + const chatBotInputText = document.getElementById("chatbot-input"); + + chatBotInputText.addEventListener("keyup", function (e) { + const chatTextInputValue = e.target.value; + const charCode = e.code; + + if (chatTextInputValue) { + updateSendBtnStatus(true); + + if (charCode == "Enter" || e.keyCode === 13) { + appendUserMessages(chatTextInputValue); + e.target.value = null; + updateSendBtnStatus(false); + } + } else { + updateSendBtnStatus(false); + } + }); +} + +function updateSendBtnStatus(status = false) { + const chatMessageSendBtn = document.getElementById("chatbot-send-btn"); + if (!chatMessageSendBtn) return; + + if (status) { + const svgIconPath = chatMessageSendBtn.getElementsByTagName("path"); + svgIconPath[0].setAttribute("fill", "#343434"); + } else { + const svgIconPath = chatMessageSendBtn.getElementsByTagName("path"); + svgIconPath[0].setAttribute("fill", "#d7d7d7"); + } +} + +function sendMessage() { + const chatBotInputText = document.getElementById("chatbot-input"); + + if (chatBotInputText.value) { + appendUserMessages(chatBotInputText.value); + chatBotInputText.value = ""; + updateSendBtnStatus(false); + } +} + +function appendUserMessages(value) { + const messageListBody = document.getElementById("chatbox-message-history"); + const messageElement = document.createElement("div"); + messageElement.className = "chatbot-margin-bottom chatbot-margin-left-auto"; + + const el = ` +
+
+ +
+
You
+
+
+

+ ${value} +

+
+ `; + + messageElement.innerHTML = el; + + messageListBody.appendChild(messageElement); + + showTypingIndicator(true); + scrollToBottom(); + + generateAnswares(value.toString()); +} + +function appendAssistantMessage(value) { + var chatbotCSS = ` + .chatbot-margin-bottom { margin-bottom: 1rem; } + .chatbot-row { display: flex; flex-direction: row; width: 100%; } + .chatbot-align-item-center { align-items: center; } + .chatbot-header--logo-small { width: 1.2rem; } + .chatbot-margin-right-small { margin-right: 0.3rem; } + .chatbot-message-panel { background: #dedede; padding: 0.9rem; border-radius: 0.4rem; } + .chatbot-paragraph { line-height: 1.3rem; } + .chatbot-margin-0 { margin: 0; } +`; + +// Create a