Correct Sumbit to Submit

pull/389/head
Cioraz 8 months ago
parent 316b8c66db
commit 0f60cd480d

@ -812,7 +812,7 @@ const pr = ({ apiHost: N = "https://gptcloud.arc53.com", selectDocs: w = "defaul
placeholder: "What do you want to do?"
}
),
/* @__PURE__ */ l.jsx("button", { className: "absolute text-gray-400 dark:text-gray-500 text-sm inset-y-0 right-2 -mx-2 px-2", type: "submit", children: "Sumbit" })
/* @__PURE__ */ l.jsx("button", { className: "absolute text-gray-400 dark:text-gray-500 text-sm inset-y-0 right-2 -mx-2 px-2", type: "submit", children: "Submit" })
]
}
),

File diff suppressed because one or more lines are too long

@ -25,5 +25,5 @@ Check the render method of \``+e+"`."}return""}}function ar(e){{if(e!==void 0){v
Check your code at `+r+":"+t+"."}return""}}var je={};function ir(e){{var r=Se();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
Check the top-level render call using <`+t+">.")}return r}}function Pe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ir(r);if(je[t])return;je[t]=!0;var n="";e&&e._owner&&e._owner!==ne.current&&(n=" It was passed a child from "+k(e._owner.type)+"."),W(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),W(null)}}function ke(e,r){{if(typeof e!="object")return;if(re(e))for(var t=0;t<e.length;t++){var n=e[t];ie(n)&&Pe(n,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var o=H(e);if(typeof o=="function"&&o!==e.entries)for(var s=o.call(e),i;!(i=s.next()).done;)ie(i.value)&&Pe(i.value,r)}}}function or(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===h))t=r.propTypes;else return;if(t){var n=k(r);Je(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ae){ae=!0;var o=k(r);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){W(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),W(null);break}}e.ref!==null&&(W(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}function Ce(e,r,t,n,o,s){{var i=Ve(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var y=ar(o);y?a+=y:a+=Se();var c;e===null?c="null":re(e)?c="array":e!==void 0&&e.$$typeof===T?(c="<"+(k(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):c=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,a)}var f=nr(e,r,t,o,s);if(f==null)return f;if(i){var _=r.children;if(_!==void 0)if(n)if(re(_)){for(var Y=0;Y<_.length;Y++)ke(_[Y],e);Object.freeze&&Object.freeze(_)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ke(_,e)}return e===u?sr(f):or(f),f}}function lr(e,r,t){return Ce(e,r,t,!0)}function ur(e,r,t){return Ce(e,r,t,!1)}var cr=ur,fr=lr;L.Fragment=u,L.jsx=cr,L.jsxs=fr}()),L}process.env.NODE_ENV==="production"?q.exports=De():q.exports=Ne();var l=q.exports;function Ae({question:A="",apiKey:T="",selectedDocs:O="",history:u=[],conversationId:E=null,apiHost:j="",onEvent:S=()=>{console.log("Event triggered, but no handler provided.")}}){let b="default";return O&&(b=O),new Promise((d,v)=>{const m={question:A,api_key:T,embeddings_key:T,active_docs:b,history:JSON.stringify(u),conversation_id:E,model:"default"};fetch(j+"/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}).then(h=>{if(!h.body)throw Error("No response body");const x=h.body.getReader(),p=new TextDecoder("utf-8");let w=0;const P=({done:H,value:D})=>{if(H){console.log(w),d();return}w+=1;const K=p.decode(D).split(`
`);for(let F of K){if(F.trim()=="")continue;F.startsWith("data:")&&(F=F.substring(5));const X=new MessageEvent("message",{data:F});S(X)}x.read().then(P).catch(v)};x.read().then(P).catch(v)}).catch(h=>{console.error("Connection failed:",h),v(h)})})}const Fe=({apiHost:A="https://gptcloud.arc53.com",selectDocs:T="default",apiKey:O="docsgpt-public"})=>{const[u,E]=R.useState(()=>typeof window<"u"&&localStorage.getItem("docsGPTChatState")||"init"),[j,S]=R.useState(""),b=R.useRef(null);R.useEffect(()=>{if(b.current){const v=b.current;v.scrollTop=v.scrollHeight}},[j]),R.useEffect(()=>{localStorage.setItem("docsGPTChatState",u)},[u]);const d=v=>{S(""),v.preventDefault(),E("processing"),setTimeout(()=>{E("answer")},800);const h=v.currentTarget[0].value;Ae({question:h,apiKey:O,selectedDocs:T,history:[],conversationId:null,apiHost:A,onEvent:x=>{const p=JSON.parse(x.data);if(p.type==="end")E("answer");else if(p.type==="source"){let w;if(p.metadata&&p.metadata.title){const P=p.metadata.title.split("/");w={title:P[P.length-1],text:p.doc}}else w={title:p.doc,text:p.doc};console.log(w)}else if(p.type==="id")console.log(p.id);else{const w=p.answer;S(P=>P+w)}}})};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"dark widget-container",children:[l.jsx("div",{onClick:()=>E("init"),className:`${u!=="minimized"?"hidden":""} cursor-pointer`,children:l.jsx("div",{className:"mr-2 mb-2 w-20 h-20 rounded-full overflow-hidden dark:divide-gray-700 border dark:border-gray-700 bg-gradient-to-br from-gray-100/80 via-white to-white dark:from-gray-900/80 dark:via-gray-900 dark:to-gray-900 font-sans shadow backdrop-blur-sm flex items-center justify-center",children:l.jsx("img",{src:"https://d3dg1063dc54p9.cloudfront.net/cute-docsgpt.png",alt:"DocsGPT",className:"cursor-pointer hover:opacity-50 h-14"})})}),l.jsxs("div",{className:` ${u!=="minimized"?"":"hidden"} divide-y dark:divide-gray-700 rounded-md border dark:border-gray-700 bg-gradient-to-br from-gray-100/80 via-white to-white dark:from-gray-900/80 dark:via-gray-900 dark:to-gray-900 font-sans shadow backdrop-blur-sm`,style:{width:"18rem",transform:"translateY(0%) translateZ(0px)"},children:[l.jsxs("div",{children:[l.jsx("img",{src:"https://d3dg1063dc54p9.cloudfront.net/exit.svg",alt:"Exit",className:"cursor-pointer hover:opacity-50 h-2 absolute top-0 right-0 m-2 white-filter",onClick:v=>{v.stopPropagation(),E("minimized")}}),l.jsxs("div",{className:"flex items-center gap-2 p-3",children:[l.jsxs("div",{className:`${u==="init"||u==="processing"||u==="typing"?"":"hidden"} flex-1`,children:[l.jsx("h3",{className:"text-sm font-bold text-gray-700 dark:text-gray-200",children:"Need help with documentation?"}),l.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:"DocsGPT AI assistant will help you with docs"})]}),l.jsx("div",{id:"docsgpt-answer",ref:b,className:`${u!=="answer"?"hidden":""}`,children:l.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-white text-left",children:j})})]})]}),l.jsxs("div",{className:"w-full",children:[l.jsx("button",{onClick:()=>E("typing"),className:`flex w-full justify-center px-5 py-3 text-sm text-gray-800 font-bold dark:text-white transition duration-300 hover:bg-gray-100 rounded-b dark:hover:bg-gray-800/70 ${u!=="init"?"hidden":""}`,children:"Ask DocsGPT"}),(u==="typing"||u==="answer")&&l.jsxs("form",{onSubmit:d,className:"relative w-full m-0",style:{opacity:1},children:[l.jsx("input",{type:"text",className:"w-full bg-transparent px-5 py-3 pr-8 text-sm text-gray-700 dark:text-white focus:outline-none",placeholder:"What do you want to do?"}),l.jsx("button",{className:"absolute text-gray-400 dark:text-gray-500 text-sm inset-y-0 right-2 -mx-2 px-2",type:"submit",children:"Sumbit"})]}),l.jsxs("p",{className:`${u!=="processing"?"hidden":""} flex w-full justify-center px-5 py-3 text-sm text-gray-800 font-bold dark:text-white transition duration-300 rounded-b`,children:["Processing",l.jsx("span",{className:"dot-animation",children:"."}),l.jsx("span",{className:"dot-animation delay-200",children:"."}),l.jsx("span",{className:"dot-animation delay-400",children:"."})]})]})]})]})})};N.DocsGPTWidget=Fe,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
`);for(let F of K){if(F.trim()=="")continue;F.startsWith("data:")&&(F=F.substring(5));const X=new MessageEvent("message",{data:F});S(X)}x.read().then(P).catch(v)};x.read().then(P).catch(v)}).catch(h=>{console.error("Connection failed:",h),v(h)})})}const Fe=({apiHost:A="https://gptcloud.arc53.com",selectDocs:T="default",apiKey:O="docsgpt-public"})=>{const[u,E]=R.useState(()=>typeof window<"u"&&localStorage.getItem("docsGPTChatState")||"init"),[j,S]=R.useState(""),b=R.useRef(null);R.useEffect(()=>{if(b.current){const v=b.current;v.scrollTop=v.scrollHeight}},[j]),R.useEffect(()=>{localStorage.setItem("docsGPTChatState",u)},[u]);const d=v=>{S(""),v.preventDefault(),E("processing"),setTimeout(()=>{E("answer")},800);const h=v.currentTarget[0].value;Ae({question:h,apiKey:O,selectedDocs:T,history:[],conversationId:null,apiHost:A,onEvent:x=>{const p=JSON.parse(x.data);if(p.type==="end")E("answer");else if(p.type==="source"){let w;if(p.metadata&&p.metadata.title){const P=p.metadata.title.split("/");w={title:P[P.length-1],text:p.doc}}else w={title:p.doc,text:p.doc};console.log(w)}else if(p.type==="id")console.log(p.id);else{const w=p.answer;S(P=>P+w)}}})};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"dark widget-container",children:[l.jsx("div",{onClick:()=>E("init"),className:`${u!=="minimized"?"hidden":""} cursor-pointer`,children:l.jsx("div",{className:"mr-2 mb-2 w-20 h-20 rounded-full overflow-hidden dark:divide-gray-700 border dark:border-gray-700 bg-gradient-to-br from-gray-100/80 via-white to-white dark:from-gray-900/80 dark:via-gray-900 dark:to-gray-900 font-sans shadow backdrop-blur-sm flex items-center justify-center",children:l.jsx("img",{src:"https://d3dg1063dc54p9.cloudfront.net/cute-docsgpt.png",alt:"DocsGPT",className:"cursor-pointer hover:opacity-50 h-14"})})}),l.jsxs("div",{className:` ${u!=="minimized"?"":"hidden"} divide-y dark:divide-gray-700 rounded-md border dark:border-gray-700 bg-gradient-to-br from-gray-100/80 via-white to-white dark:from-gray-900/80 dark:via-gray-900 dark:to-gray-900 font-sans shadow backdrop-blur-sm`,style:{width:"18rem",transform:"translateY(0%) translateZ(0px)"},children:[l.jsxs("div",{children:[l.jsx("img",{src:"https://d3dg1063dc54p9.cloudfront.net/exit.svg",alt:"Exit",className:"cursor-pointer hover:opacity-50 h-2 absolute top-0 right-0 m-2 white-filter",onClick:v=>{v.stopPropagation(),E("minimized")}}),l.jsxs("div",{className:"flex items-center gap-2 p-3",children:[l.jsxs("div",{className:`${u==="init"||u==="processing"||u==="typing"?"":"hidden"} flex-1`,children:[l.jsx("h3",{className:"text-sm font-bold text-gray-700 dark:text-gray-200",children:"Need help with documentation?"}),l.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:"DocsGPT AI assistant will help you with docs"})]}),l.jsx("div",{id:"docsgpt-answer",ref:b,className:`${u!=="answer"?"hidden":""}`,children:l.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-white text-left",children:j})})]})]}),l.jsxs("div",{className:"w-full",children:[l.jsx("button",{onClick:()=>E("typing"),className:`flex w-full justify-center px-5 py-3 text-sm text-gray-800 font-bold dark:text-white transition duration-300 hover:bg-gray-100 rounded-b dark:hover:bg-gray-800/70 ${u!=="init"?"hidden":""}`,children:"Ask DocsGPT"}),(u==="typing"||u==="answer")&&l.jsxs("form",{onSubmit:d,className:"relative w-full m-0",style:{opacity:1},children:[l.jsx("input",{type:"text",className:"w-full bg-transparent px-5 py-3 pr-8 text-sm text-gray-700 dark:text-white focus:outline-none",placeholder:"What do you want to do?"}),l.jsx("button",{className:"absolute text-gray-400 dark:text-gray-500 text-sm inset-y-0 right-2 -mx-2 px-2",type:"submit",children:"Submit"})]}),l.jsxs("p",{className:`${u!=="processing"?"hidden":""} flex w-full justify-center px-5 py-3 text-sm text-gray-800 font-bold dark:text-white transition duration-300 rounded-b`,children:["Processing",l.jsx("span",{className:"dot-animation",children:"."}),l.jsx("span",{className:"dot-animation delay-200",children:"."}),l.jsx("span",{className:"dot-animation delay-400",children:"."})]})]})]})]})})};N.DocsGPTWidget=Fe,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=index.umd.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save