@pickaxeproject/react 0.0.71 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
  3. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -1
  4. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.js +1 -1
  5. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.js +1 -1
  6. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +1 -1
  7. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +1 -1
  8. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/common/TextModal.js +1 -1
  9. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  10. package/dist/cjs/prose.css +1 -0
  11. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Renderer.d.ts +2 -1
  12. package/dist/cjs/src/index.d.ts +1 -0
  13. package/dist/cjs/src/types/pickaxe.d.ts +1 -1
  14. package/dist/esm/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
  15. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -1
  16. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.js +1 -1
  17. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Iframe/index.js +1 -1
  18. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +1 -1
  19. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +1 -1
  20. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/common/TextModal.js +1 -1
  21. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  22. package/dist/esm/prose.css +1 -0
  23. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Renderer.d.ts +2 -1
  24. package/dist/esm/src/index.d.ts +1 -0
  25. package/dist/esm/src/types/pickaxe.d.ts +1 -1
  26. package/package.json +3 -2
package/README.md CHANGED
@@ -14,4 +14,5 @@
14
14
 
15
15
  ## Notes
16
16
 
17
+ - must import `import "@pickaxeproject/react/dist/prose.css";`
17
18
  - must import `import "katex/dist/katex.min.css";`
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),t=require("react"),o=require("../../../../../hooks/pickaxe/usePickaxeContext.js"),s=require("../../../../../hooks/pickaxe/useSubmitDocument.js"),n=require("./useDocumentContext.js"),i=require("../../../../../common/documents.js"),r=require("../../../../../common/error.js");const a=["gpt-4o","gpt-4o-mini"];exports.useDocument=({onQuestionChange:u}={})=>{const{formId:d,chatId:l,pickaxe:c}=o.usePickaxeContext(),m=n.useDocumentContext(),p=s.useSubmitDocument(),f=t.useMemo((()=>{var e;return a.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},m),{isImageUploadAllowed:f,onFileUpload:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(m.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i.allowedFileMimeTypes,...f?i.allowedImageMimeTypes:[]],s=t.some((e=>!o.includes(e.type)));if(s){throw new Error(f?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}m.setIsUploading(!0),m.setIsShowList(!0),m.upsertDocuments([{type:"document",id:e.name,name:e.name,status:"uploading"}]);const n=yield p.document({formId:d,responseId:l,file:e}),{success:r,documentId:a,error:c}=n;if(!r)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:a});const y=a.startsWith("IMAGE-")?"image":"document";return m.upsertDocuments([{type:y,id:e.name,name:e.name,status:"finished",documentId:a}]),{type:y,id:e.name,name:e.name,status:"finished",documentId:a}}catch(t){const o=r.default(t);return console.log("[onFileUpload] Error",o),o.includes("You can only upload")?(m.setDocumentError(o),null):(m.editDocument({type:"document",id:e.name,name:e.name,status:"failed",error:o}),{type:"document",id:e.name,name:e.name,status:"failed",error:o})}finally{m.setIsUploading(!1)}})),onWebsiteUpload:t=>e.__awaiter(void 0,void 0,void 0,(function*(){m.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");m.setIsUploading(!0),m.setIsShowList(!0),m.setWebsiteLink(""),m.upsertDocuments([{type:"website",id:e,name:e,status:"uploading"}]);const t=yield p.website({formId:d,responseId:l,website:e}),{success:o,documentId:s}=t;if(!o)throw new Error("Website processing failed, please try again.");return m.upsertDocuments([{type:"website",id:e,name:e,status:"finished",documentId:s}]),{type:"website",id:e,name:e,status:"finished",documentId:s}}catch(t){const o=r.default(t);return console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL")?(m.setDocumentError(o),null):(m.editDocument({type:"website",id:e,name:e,status:"failed",error:o}),{type:"website",id:e,name:e,status:"failed",error:o})}finally{m.setIsUploading(!1)}})),onEditDocumentByDocId:m.editDocumentByDocId})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),t=require("react"),o=require("../../../../../hooks/pickaxe/usePickaxeContext.js"),s=require("../../../../../hooks/pickaxe/useSubmitDocument.js"),n=require("./useDocumentContext.js"),i=require("../../../../../common/documents.js"),r=require("../../../../../common/error.js");const a=["gpt-4o-mini","gpt-4o","gpt-4.5-preview","o1"];exports.useDocument=({onQuestionChange:u}={})=>{const{formId:d,chatId:l,pickaxe:c}=o.usePickaxeContext(),m=n.useDocumentContext(),p=s.useSubmitDocument(),f=t.useMemo((()=>{var e;return a.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},m),{isImageUploadAllowed:f,onFileUpload:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(m.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i.allowedFileMimeTypes,...f?i.allowedImageMimeTypes:[]],s=t.some((e=>!o.includes(e.type)));if(s){throw new Error(f?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}m.setIsUploading(!0),m.setIsShowList(!0),m.upsertDocuments([{type:"document",id:e.name,name:e.name,status:"uploading"}]);const n=yield p.document({formId:d,responseId:l,file:e}),{success:r,documentId:a,error:c}=n;if(!r)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:a});const y=a.startsWith("IMAGE-")?"image":"document";return m.upsertDocuments([{type:y,id:e.name,name:e.name,status:"finished",documentId:a}]),{type:y,id:e.name,name:e.name,status:"finished",documentId:a}}catch(t){const o=r.default(t);return console.log("[onFileUpload] Error",o),o.includes("You can only upload")?(m.setDocumentError(o),null):(m.editDocument({type:"document",id:e.name,name:e.name,status:"failed",error:o}),{type:"document",id:e.name,name:e.name,status:"failed",error:o})}finally{m.setIsUploading(!1)}})),onWebsiteUpload:t=>e.__awaiter(void 0,void 0,void 0,(function*(){m.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");m.setIsUploading(!0),m.setIsShowList(!0),m.setWebsiteLink(""),m.upsertDocuments([{type:"website",id:e,name:e,status:"uploading"}]);const t=yield p.website({formId:d,responseId:l,website:e}),{success:o,documentId:s}=t;if(!o)throw new Error("Website processing failed, please try again.");return m.upsertDocuments([{type:"website",id:e,name:e,status:"finished",documentId:s}]),{type:"website",id:e,name:e,status:"finished",documentId:s}}catch(t){const o=r.default(t);return console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL")?(m.setDocumentError(o),null):(m.editDocument({type:"website",id:e,name:e,status:"failed",error:o}),{type:"website",id:e,name:e,status:"failed",error:o})}finally{m.setIsUploading(!1)}})),onEditDocumentByDocId:m.editDocumentByDocId})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),i=require("../../hooks/usePickaxeMarkdownContext.js"),a=require("../common/Action.js"),n=require("../Img/index.js"),o=require("../common/Audio.js"),u=require("../common/Html/index.js"),l=require("../../../../../../common/api/utils.js"),c=require("../../../../../../common/error.js");exports.default=({node:d,href:f="",children:m})=>{const{accentColor:p,websiteMetadatas:h,linkPreviews:w,actions:j,setWebsiteMetadatas:x}=i.usePickaxeMarkdownContext(),[g,b]=r.useState("");r.useEffect((()=>{if(!f)return;const e=f.startsWith("http://")?`https://${f.slice(7)}`:f.startsWith("www.")?`https://${f}`:f;e!==g&&b(e)}),[f,g]),s.useQuery({queryKey:["website-metadata",g],queryFn:()=>{return t=g,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield l.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=c.default(e);console.error("[getJobResult]",t)}return null}}));var t},enabled:"undefined"!=typeof window&&w&&Boolean(g)&&!h.some((e=>e.href===g))&&g.includes(".")&&!g.includes("https://prod-pickaxe-assets")&&!g.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t&&t.title&&(h.some((e=>e.href===t.href))||x((e=>[...e,t])))}))});const v=g.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(v&&(null==v?void 0:v[1]))return t.jsx("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${v[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(g.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t.jsx(n.default,{src:g,alt:"string"==typeof m?m:"Markdown Image"});if(g.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t.jsx(o.default,{url:g});return g.includes("action_generated_files")&&g.match(/\.html$/)?t.jsx(u.default,{url:g}):j&&g.includes("pickaxe")&&(g.includes("/api/fn/result")||g.includes("/api/function_call_results"))?t.jsx(a.default,{jobUrl:g}):t.jsx("a",Object.assign({href:g,target:"_blank",rel:"noopener noreferrer",style:{color:p,fontWeight:600,textDecoration:"underline",textUnderlineOffset:"0.2rem"}},{children:m}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),i=require("../../hooks/usePickaxeMarkdownContext.js"),a=require("../common/Action.js"),n=require("../Img/index.js"),o=require("../common/Audio.js"),u=require("../common/Html/index.js"),c=require("../../../../../../common/api/utils.js"),l=require("../../../../../../common/error.js");exports.default=({node:d,href:f="",children:p})=>{const{accentColor:m,websiteMetadatas:h,linkPreviews:w,actions:j,setWebsiteMetadatas:x}=i.usePickaxeMarkdownContext(),[b,v]=r.useState("");r.useEffect((()=>{if(!f)return;const e=f.startsWith("http://")?`https://${f.slice(7)}`:f.startsWith("www.")?`https://${f}`:f;e!==b&&v(e)}),[f,b]),s.useQuery({queryKey:["website-metadata",b],queryFn:()=>{return t=b,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield c.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=l.default(e);console.error("[getJobResult]",t)}return null}}));var t},enabled:"undefined"!=typeof window&&w&&Boolean(b)&&!h.some((e=>e.href===b))&&b.includes(".")&&!b.includes("https://prod-pickaxe-assets")&&!b.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t&&t.title&&(h.some((e=>e.href===t.href))||x((e=>[...e,t])))}))});const g=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(g&&(null==g?void 0:g[1]))return t.jsx("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${g[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t.jsx(n.default,{src:b,alt:"string"==typeof p?p:"Markdown Image"});if(b.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t.jsx(o.default,{url:b});return b.includes("action_generated_files")&&b.match(/\.html$/)?t.jsx(u.default,{url:b}):j&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))?t.jsx(a.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:m}},{children:p}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),s=require("react-syntax-highlighter"),a=require("../../hooks/usePickaxeMarkdownContext.js"),l=require("../../../PickaxeCopyButton.js");exports.default=t=>{var i,{node:c,children:o,className:n}=t,u=e.__rest(t,["node","children","className"]);const{syntaxTheme:d,accentColor:x}=a.usePickaxeMarkdownContext(),b=/language-(\w+)/.exec(n||"");return r.jsxs("div",Object.assign({className:"relative"},{children:[r.jsx("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:r.jsx(l.default,{color:x,text:null!==(i=null==o?void 0:o.toString())&&void 0!==i?i:"",iconClassName:"w-4 h-4"})})),r.jsx("div",Object.assign({className:"overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:r.jsx(s.Prism,Object.assign({},u,{PreTag:"div",language:b?b[1]:"js",style:d,showLineNumbers:!0},{children:String(o).replace(/\n$/,"")}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),s=require("react-syntax-highlighter"),a=require("../../hooks/usePickaxeMarkdownContext.js"),l=require("../../../PickaxeCopyButton.js");exports.default=t=>{var i,{node:c,children:o,className:n}=t,u=e.__rest(t,["node","children","className"]);const{syntaxTheme:d,accentColor:x}=a.usePickaxeMarkdownContext(),b=/language-(\w+)/.exec(n||"");return r.jsxs("div",Object.assign({className:"pxe-markdown-code relative"},{children:[r.jsx("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:r.jsx(l.default,{color:x,text:null!==(i=null==o?void 0:o.toString())&&void 0!==i?i:"",iconClassName:"w-4 h-4"})})),r.jsx("div",Object.assign({className:"overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:r.jsx(s.Prism,Object.assign({},u,{PreTag:"div",language:b?b[1]:"js",style:d,showLineNumbers:!0},{children:String(o).replace(/\n$/,"")}))}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime");exports.default=t=>{var{node:i,title:l="Random Iframe",children:s,style:a}=t,n=e.__rest(t,["node","title","children","style"]);return r.jsx("iframe",Object.assign({title:l,style:Object.assign({borderRadius:"8px",width:"100%",marginBottom:"1.5rem"},a),allowFullScreen:!0},n,{children:s}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime");exports.default=t=>{var{node:i,title:l="Random Iframe",children:s,style:a}=t,d=e.__rest(t,["node","title","children","style"]);return r.jsx("iframe",Object.assign({title:l,style:Object.assign({borderRadius:"8px",width:"100%"},a),allowFullScreen:!0},d,{children:s}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../../../../../../hooks/core/useHover.js"),i=require("framer-motion"),n=require("../../../../../../common/utils.js"),a=require("../../../../../Icons/download.svg.js"),l=require("../../../PickaxeCopyButton.js"),d=require("./ImgModal.js");exports.default=({node:c,src:p,alt:u})=>{const{accentColor:x}=r.usePickaxeMarkdownContext(),[b,h]=t.useState(!1),[g,j]=t.useState(!1),m=s.useHover(),{isHover:y}=m,v=e.__rest(m,["isHover"]);return o.jsxs("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:y?"translateY(-5px)":"translateY(0)"}},v,{children:[g&&o.jsx(d.default,{src:p,isOpen:g,onChangeIsOpen:j}),b?o.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):o.jsxs("div",Object.assign({style:{position:"relative"}},{children:[o.jsxs(i.motion.div,Object.assign({initial:"hidden",animate:y?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[o.jsx(i.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>{e.stopPropagation(),window.open(p,"_blank")}},{children:o.jsx(a.default,{width:24,height:24,style:{color:n.getContrastColor(x),flexShrink:0}})})),o.jsx(i.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>e.stopPropagation()},{children:o.jsx(l.default,{color:n.getContrastColor(x),iconClassName:"w-6 h-6",text:p||""})}))]})),o.jsx("img",{src:p,alt:u,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:y?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>h(!0),onClick:()=>j(!0)})]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),t=require("react"),s=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../../../../../../hooks/core/useHover.js"),r=require("framer-motion"),n=require("../../../../../../common/utils.js"),a=require("../../../../../Icons/download.svg.js"),l=require("../../../PickaxeCopyButton.js"),d=require("./ImgModal.js");exports.default=({node:c,src:p,alt:u})=>{const{accentColor:x}=s.usePickaxeMarkdownContext(),[b,h]=t.useState(!1),[g,j]=t.useState(!1),m=i.useHover(),{isHover:y}=m,v=e.__rest(m,["isHover"]);return o.jsxs("div",Object.assign({className:"pxe-markdown-image",style:{display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:y?"translateY(-5px)":"translateY(0)"}},v,{children:[g&&o.jsx(d.default,{src:p,isOpen:g,onChangeIsOpen:j}),b?o.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):o.jsxs("div",Object.assign({style:{position:"relative"}},{children:[o.jsxs(r.motion.div,Object.assign({initial:"hidden",animate:y?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[o.jsx(r.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>{e.stopPropagation(),window.open(p,"_blank")}},{children:o.jsx(a.default,{width:24,height:24,style:{color:n.getContrastColor(x),flexShrink:0}})})),o.jsx(r.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>e.stopPropagation()},{children:o.jsx(l.default,{color:n.getContrastColor(x),iconClassName:"w-6 h-6",text:p||""})}))]})),o.jsx("img",{src:p,alt:u,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:y?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>h(!0),onClick:()=>j(!0)})]}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../common/Action.js");exports.default=({node:i,children:n})=>{const{actions:r}=t.usePickaxeMarkdownContext(),l="string"==typeof n&&n.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(l&&(null==l?void 0:l[1]))return e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${l[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(r&&"string"==typeof n&&n.includes("pickaxe")&&(n.includes("/api/fn/result")||n.includes("/api/function_call_results"))){const t=n.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=n.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("p",Object.assign({style:{fontWeight:350,marginBottom:"0.75rem"}},{children:t})),e.jsx(s.default,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e.jsx("p",Object.assign({style:{fontWeight:350,marginBottom:"0.75rem"}},{children:n}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../common/Action.js");exports.default=({node:i,children:n})=>{const{actions:r}=t.usePickaxeMarkdownContext(),l="string"==typeof n&&n.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(l&&(null==l?void 0:l[1]))return e.jsx("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${l[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(r&&"string"==typeof n&&n.includes("pickaxe")&&(n.includes("/api/fn/result")||n.includes("/api/function_call_results"))){const t=n.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=n.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e.jsx("p",{children:t}),e.jsx(s.default,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e.jsx("p",{children:n})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("./Modal/index.js"),r=require("./Modal/Body.js"),l=require("./Modal/CloseButton.js");exports.default=({value:a,isOpen:i,onChangeIsOpen:x})=>{const{colors:o}=s.usePickaxeContext();return e.jsx(t.default,Object.assign({isOpen:i,onChange:x},{children:e.jsxs(r.default,Object.assign({className:"relative flex flex-col px-8 pt-[26px] pb-8 w-full min-[767px]:max-w-[600px] max-[767px]:border-0",style:{backgroundColor:o.primary,color:o.text,borderColor:o.text+"4D"},avoidOverflow:!0},{children:[e.jsx("div",Object.assign({className:"flex items-start justify-end gap-4"},{children:e.jsx(l.default,{})})),e.jsx("div",Object.assign({className:"mt-6 flex flex-col items-center"},{children:e.jsx("div",Object.assign({className:"flex w-full max-w-[550px] flex-col items-center text-center"},{children:e.jsx("p",{children:a})}))}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../Renderer.js"),t=require("./Modal/index.js"),l=require("./Modal/Body.js"),a=require("./Modal/CloseButton.js");exports.default=({value:i,isOpen:x,onChangeIsOpen:n})=>{const{colors:o}=s.usePickaxeContext();return e.jsx(t.default,Object.assign({isOpen:x,onChange:n},{children:e.jsxs(l.default,Object.assign({className:"relative flex flex-col px-8 pt-[26px] pb-8 w-full min-[767px]:max-w-[600px] max-[767px]:border-0",style:{backgroundColor:o.primary,color:o.text,borderColor:o.text+"4D"},avoidOverflow:!0},{children:[e.jsx("div",Object.assign({className:"flex items-start justify-end gap-4"},{children:e.jsx(a.default,{})})),e.jsx("div",Object.assign({className:"mt-6 flex flex-col items-center"},{children:e.jsx("div",Object.assign({className:"flex w-full max-w-[550px] flex-col items-center text-center"},{children:e.jsx(r.PickaxeMarkdownRenderer,{value:i})}))}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),i=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),n=require("react-markdown"),s=require("remark-gfm"),l=require("remark-math"),a=require("rehype-katex"),o=require("rehype-raw"),d=require("./Custom/A/index.js"),m=require("./Custom/P/index.js"),c=require("./Custom/Img/index.js"),u=require("./Custom/Iframe/index.js"),h=require("./Custom/Code/index.js"),g=require("./Custom/common/LinkPreview.js"),j=require("./Custom/common/TextModal.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=x(n),f=x(s),b=x(l),y=x(a),O=x(o);exports.PickaxeMarkdownRenderer=({className:n,style:s,value:l,recursion:a=!1,children:o,maxChar:x})=>{const{theme:k,accentColor:q,websiteMetadatas:v}=t.usePickaxeMarkdownContext(),[C,B]=i.useState(!1),D=i.useRef(null),S=i.useMemo((()=>{if(!l)return"";let e=l;return e=l.replace(/<!--[\s\S]*?-->/g,""),e=l.replace(/\u200B/g,""),x&&(e=e.slice(0,x)),e}),[l,x]),w={h1:({node:e,children:i})=>r.jsx("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem",marginBottom:"1.5rem"}},{children:i})),h2:({node:e,children:i})=>r.jsx("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem",marginBottom:"1.5rem"}},{children:i})),h3:({node:e,children:i})=>r.jsx("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"0.5rem"}},{children:i})),h4:({node:e,children:i})=>r.jsx("h4",Object.assign({className:"mt-2",style:{fontSize:"1.25rem",lineHeight:"1.75rem",marginBottom:"0.5rem"}},{children:i})),h5:({node:e,children:i})=>r.jsx("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem",marginBottom:"0.5rem"}},{children:i})),p:m.default,a:d.default,ol:({node:e,children:i})=>r.jsx("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"1.5rem"}},{children:i})),ul:({node:e,children:i})=>r.jsx("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"1.5rem"}},{children:i})),li:({node:e,children:i})=>r.jsx("li",Object.assign({style:{margin:"10px"}},{children:i})),table:({children:e})=>r.jsx("div",Object.assign({style:{position:"relative",overflow:"auto",marginBottom:"1.5rem"}},{children:r.jsx("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:e}))})),th:({node:e,children:i})=>r.jsx("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:i})),tr:({node:e,children:i})=>r.jsx("tr",Object.assign({style:{border:"dark"===k?"1px solid #30363D":"1px solid #D0D7DE"}},{children:i})),td:({node:e,children:i})=>r.jsx("td",Object.assign({style:{padding:"0.75em 1em"}},{children:i})),code:h.default,blockquote:({node:e,children:i})=>r.jsx("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===k?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===k?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:i})),img:c.default,iframe:u.default,hr:()=>r.jsx("hr",{style:{border:0,borderTop:"dark"===k?"1px solid #30363D":"1px solid #D0D7DE",marginBottom:"1.5rem"}}),span:i=>{var{node:t,children:n}=i,s=e.__rest(i,["node","children"]);return"intro-msg-expand-btn"===s.className?r.jsx("span",Object.assign({},s,{style:{display:"inline",fontWeight:500,color:q,cursor:"pointer"},onClick:()=>B(!0)},{children:n})):r.jsx("span",Object.assign({},s,{children:n}))}};return r.jsxs("div",Object.assign({className:"pxe-markdown",ref:D,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},s)},{children:[C&&r.jsx(j.default,{value:S,isOpen:C,onChangeIsOpen:B}),r.jsx(p.default,Object.assign({},n&&{className:n},{components:w,remarkPlugins:[f.default,b.default],rehypePlugins:[y.default,O.default]},{children:`${S}${!a&&v.length>0?"\n\n---":""}${"number"==typeof x&&S.length>=x?'<span class="intro-msg-expand-btn">...</span>':""}`})),!a&&v.length>0&&r.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:v.map(((e,i)=>r.jsx(g.default,{data:e},i)))})),o]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),s=require("./hooks/usePickaxeMarkdownContext.js"),i=require("react-markdown"),l=require("remark-gfm"),t=require("remark-math"),d=require("rehype-katex"),a=require("rehype-raw"),o=require("./Custom/A/index.js"),c=require("./Custom/P/index.js"),u=require("./Custom/Img/index.js"),h=require("./Custom/Iframe/index.js"),x=require("./Custom/Code/index.js"),m=require("./Custom/common/LinkPreview.js"),p=require("./Custom/common/TextModal.js"),j=require("../../../../common/cn.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=f(i),b=f(l),k=f(t),q=f(d),y=f(a);exports.PickaxeMarkdownRenderer=({className:i,style:l,value:t,recursion:d=!1,children:a,maxChar:f,multiLineBreaks:C})=>{const{theme:D,accentColor:v,websiteMetadatas:O}=s.usePickaxeMarkdownContext(),[w,P]=n.useState(!1),M=n.useRef(null),_=n.useMemo((()=>{if(!t)return"";let e=t;if(e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),C&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),f&&e.length>f){const r=/(https?:\/\/[^\s)]+)/g,n=[];let s;for(;null!==(s=r.exec(e));)n.push({start:s.index,end:s.index+s[0].length});let i=f;for(const e of n)if(f>e.start&&f<e.end){i=e.end+1;break}e=e.slice(0,i)}return e}),[t,f,C]),B={h1:({node:e,children:n})=>r.jsx("h1",{children:n}),h2:({node:e,children:n})=>r.jsx("h2",{children:n}),h3:({node:e,children:n})=>r.jsx("h3",{children:n}),h4:({node:e,children:n})=>r.jsx("h4",{children:n}),h5:({node:e,children:n})=>r.jsx("h5",{children:n}),p:c.default,a:o.default,ol:({node:e,children:n})=>r.jsx("ol",{children:n}),ul:({node:e,children:n})=>r.jsx("ul",{children:n}),li:({node:e,children:n})=>r.jsx("li",{children:n}),table:({children:e})=>r.jsx("div",Object.assign({className:"pxe-markdown-table"},{children:r.jsx("table",{children:e})})),th:({node:e,children:n})=>r.jsx("th",{children:n}),tr:({node:e,children:n})=>r.jsx("tr",Object.assign({style:{border:"dark"===D?"1px solid #30363D":"1px solid #D0D7DE"}},{children:n})),td:({node:e,children:n})=>r.jsx("td",{children:n}),code:x.default,blockquote:({node:e,children:n})=>r.jsx("blockquote",Object.assign({style:{borderLeft:"dark"===D?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===D?"#8B8B8B":"#656D76"}},{children:n})),img:u.default,iframe:h.default,hr:()=>r.jsx("hr",{style:{border:0,borderTop:"dark"===D?"1px solid #30363D":"1px solid #D0D7DE"}}),span:n=>{var{node:s,children:i}=n,l=e.__rest(n,["node","children"]);return"intro-msg-expand-btn"===l.className?r.jsx("span",Object.assign({},l,{style:{display:"inline",fontWeight:500,color:v,cursor:"pointer"},onClick:()=>P(!0)},{children:i})):r.jsx("span",Object.assign({},l,{children:i}))},br:()=>r.jsx("br",{})};return r.jsxs("div",Object.assign({className:"pxe-markdown",ref:M,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},l)},{children:[w&&r.jsx(p.default,{value:_,isOpen:w,onChangeIsOpen:P}),r.jsx(g.default,Object.assign({className:j.default("pxe-prose",i),components:B,remarkPlugins:[b.default,k.default],rehypePlugins:[q.default,y.default]},{children:`${_}${!d&&O.length>0?"\n\n---":""}${"number"==typeof f&&_.length>=f?'<span class="intro-msg-expand-btn">...</span>':""}`})),!d&&O.length>0&&r.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:O.map(((e,n)=>r.jsx(m.default,{data:e},n)))})),a]}))};
@@ -0,0 +1 @@
1
+ .pxe-prose p{font-weight:350}.pxe-prose>p{margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-code,.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:2.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child),.pxe-prose>p:not(:first-child) .pxe-markdown-image,.pxe-prose>p:not(:first-child) .pxe-markdown-youtube,.pxe-prose>pre:not(:first-child){margin-top:2.5rem}
@@ -6,8 +6,9 @@ export interface PickaxeMarkdownRendererProps {
6
6
  recursion?: boolean;
7
7
  children?: ReactNode;
8
8
  maxChar?: number;
9
+ multiLineBreaks?: boolean;
9
10
  }
10
11
  export type Node = {
11
12
  node?: any;
12
13
  };
13
- export declare const PickaxeMarkdownRenderer: ({ className, style, value, recursion, children: _children, maxChar, }: PickaxeMarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const PickaxeMarkdownRenderer: ({ className, style, value, recursion, children: _children, maxChar, multiLineBreaks, }: PickaxeMarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import "./styles/prose.css";
1
2
  export * from "./components/Pickaxe";
2
3
  export * from "./components/Pickaxe/Provider";
3
4
  export * from "./components/Pickaxe/ResponseProvider";
@@ -3,7 +3,7 @@ export type PickaxeImageOrText = "text" | "image";
3
3
  export type PickaxePrivacySetting = "public" | "unlisted" | "private" | "deleted";
4
4
  export type PickaxeCloneable = "true" | "false";
5
5
  export type PickaxeDocumentUploadType = "ownerupload" | "enduserupload";
6
- export type PickaxeModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4-1106-preview" | "gpt-4" | "gpt-3.5-turbo" | "mistral-small" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620";
6
+ export type PickaxeModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4-1106-preview" | "gpt-4" | "gpt-3.5-turbo" | "gpt-4.5-preview" | "o1" | "o3-mini" | "deepseek-chat" | "mistral-small" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620" | "claude-3-7-sonnet-20250219" | "llama-3-uncensored";
7
7
  export type Pickaxe = {
8
8
  _id: string;
9
9
  formid: string;
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitDocument as n}from"../../../../../hooks/pickaxe/useSubmitDocument.js";import{useDocumentContext as s}from"./useDocumentContext.js";import{allowedFileMimeTypes as i,allowedImageMimeTypes as r}from"../../../../../common/documents.js";import a from"../../../../../common/error.js";const d=["gpt-4o","gpt-4o-mini"],u=({onQuestionChange:u}={})=>{const{formId:l,chatId:m,pickaxe:c}=o(),p=s(),f=n(),h=t((()=>{var e;return d.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},p),{isImageUploadAllowed:h,onFileUpload:t=>e(void 0,void 0,void 0,(function*(){if(p.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i,...h?r:[]],n=t.some((e=>!o.includes(e.type)));if(n){throw new Error(h?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}p.setIsUploading(!0),p.setIsShowList(!0),p.upsertDocuments([{type:"document",id:e.name,name:e.name,status:"uploading"}]);const s=yield f.document({formId:l,responseId:m,file:e}),{success:a,documentId:d,error:c}=s;if(!a)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:d});const y=d.startsWith("IMAGE-")?"image":"document";return p.upsertDocuments([{type:y,id:e.name,name:e.name,status:"finished",documentId:d}]),{type:y,id:e.name,name:e.name,status:"finished",documentId:d}}catch(t){const o=a(t);return console.log("[onFileUpload] Error",o),o.includes("You can only upload")?(p.setDocumentError(o),null):(p.editDocument({type:"document",id:e.name,name:e.name,status:"failed",error:o}),{type:"document",id:e.name,name:e.name,status:"failed",error:o})}finally{p.setIsUploading(!1)}})),onWebsiteUpload:t=>e(void 0,void 0,void 0,(function*(){p.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");p.setIsUploading(!0),p.setIsShowList(!0),p.setWebsiteLink(""),p.upsertDocuments([{type:"website",id:e,name:e,status:"uploading"}]);const t=yield f.website({formId:l,responseId:m,website:e}),{success:o,documentId:n}=t;if(!o)throw new Error("Website processing failed, please try again.");return p.upsertDocuments([{type:"website",id:e,name:e,status:"finished",documentId:n}]),{type:"website",id:e,name:e,status:"finished",documentId:n}}catch(t){const o=a(t);return console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL")?(p.setDocumentError(o),null):(p.editDocument({type:"website",id:e,name:e,status:"failed",error:o}),{type:"website",id:e,name:e,status:"failed",error:o})}finally{p.setIsUploading(!1)}})),onEditDocumentByDocId:p.editDocumentByDocId})};export{u as useDocument};
1
+ import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitDocument as n}from"../../../../../hooks/pickaxe/useSubmitDocument.js";import{useDocumentContext as s}from"./useDocumentContext.js";import{allowedFileMimeTypes as i,allowedImageMimeTypes as r}from"../../../../../common/documents.js";import a from"../../../../../common/error.js";const d=["gpt-4o-mini","gpt-4o","gpt-4.5-preview","o1"],u=({onQuestionChange:u}={})=>{const{formId:l,chatId:m,pickaxe:c}=o(),p=s(),f=n(),h=t((()=>{var e;return d.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},p),{isImageUploadAllowed:h,onFileUpload:t=>e(void 0,void 0,void 0,(function*(){if(p.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i,...h?r:[]],n=t.some((e=>!o.includes(e.type)));if(n){throw new Error(h?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}p.setIsUploading(!0),p.setIsShowList(!0),p.upsertDocuments([{type:"document",id:e.name,name:e.name,status:"uploading"}]);const s=yield f.document({formId:l,responseId:m,file:e}),{success:a,documentId:d,error:c}=s;if(!a)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:d});const y=d.startsWith("IMAGE-")?"image":"document";return p.upsertDocuments([{type:y,id:e.name,name:e.name,status:"finished",documentId:d}]),{type:y,id:e.name,name:e.name,status:"finished",documentId:d}}catch(t){const o=a(t);return console.log("[onFileUpload] Error",o),o.includes("You can only upload")?(p.setDocumentError(o),null):(p.editDocument({type:"document",id:e.name,name:e.name,status:"failed",error:o}),{type:"document",id:e.name,name:e.name,status:"failed",error:o})}finally{p.setIsUploading(!1)}})),onWebsiteUpload:t=>e(void 0,void 0,void 0,(function*(){p.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");p.setIsUploading(!0),p.setIsShowList(!0),p.setWebsiteLink(""),p.upsertDocuments([{type:"website",id:e,name:e,status:"uploading"}]);const t=yield f.website({formId:l,responseId:m,website:e}),{success:o,documentId:n}=t;if(!o)throw new Error("Website processing failed, please try again.");return p.upsertDocuments([{type:"website",id:e,name:e,status:"finished",documentId:n}]),{type:"website",id:e,name:e,status:"finished",documentId:n}}catch(t){const o=a(t);return console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL")?(p.setDocumentError(o),null):(p.editDocument({type:"website",id:e,name:e,status:"failed",error:o}),{type:"website",id:e,name:e,status:"failed",error:o})}finally{p.setIsUploading(!1)}})),onEditDocumentByDocId:p.editDocumentByDocId})};export{u as useDocument};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import{useQuery as i}from"@tanstack/react-query";import{usePickaxeMarkdownContext as n}from"../../hooks/usePickaxeMarkdownContext.js";import s from"../common/Action.js";import a from"../Img/index.js";import c from"../common/Audio.js";import l from"../common/Html/index.js";import m from"../../../../../../common/api/utils.js";import u from"../../../../../../common/error.js";const d=({node:d,href:p="",children:f})=>{const{accentColor:h,websiteMetadatas:w,linkPreviews:g,actions:b,setWebsiteMetadatas:j}=n(),[v,y]=r("");o((()=>{if(!p)return;const e=p.startsWith("http://")?`https://${p.slice(7)}`:p.startsWith("www.")?`https://${p}`:p;e!==v&&y(e)}),[p,v]),i({queryKey:["website-metadata",v],queryFn:()=>{return t=v,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield m.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=u(e);console.error("[getJobResult]",t)}return null}}));var t},enabled:"undefined"!=typeof window&&g&&Boolean(v)&&!w.some((e=>e.href===v))&&v.includes(".")&&!v.includes("https://prod-pickaxe-assets")&&!v.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e(void 0,void 0,void 0,(function*(){t&&t.title&&(w.some((e=>e.href===t.href))||j((e=>[...e,t])))}))});const x=v.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(x&&(null==x?void 0:x[1]))return t("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${x[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(v.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t(a,{src:v,alt:"string"==typeof f?f:"Markdown Image"});if(v.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t(c,{url:v});return v.includes("action_generated_files")&&v.match(/\.html$/)?t(l,{url:v}):b&&v.includes("pickaxe")&&(v.includes("/api/fn/result")||v.includes("/api/function_call_results"))?t(s,{jobUrl:v}):t("a",Object.assign({href:v,target:"_blank",rel:"noopener noreferrer",style:{color:h,fontWeight:600,textDecoration:"underline",textUnderlineOffset:"0.2rem"}},{children:f}))};export{d as default};
1
+ import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import{useQuery as i}from"@tanstack/react-query";import{usePickaxeMarkdownContext as s}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";import a from"../Img/index.js";import c from"../common/Audio.js";import l from"../common/Html/index.js";import m from"../../../../../../common/api/utils.js";import u from"../../../../../../common/error.js";const p=({node:p,href:d="",children:f})=>{const{accentColor:h,websiteMetadatas:w,linkPreviews:b,actions:g,setWebsiteMetadatas:j}=s(),[v,y]=r("");o((()=>{if(!d)return;const e=d.startsWith("http://")?`https://${d.slice(7)}`:d.startsWith("www.")?`https://${d}`:d;e!==v&&y(e)}),[d,v]),i({queryKey:["website-metadata",v],queryFn:()=>{return t=v,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield m.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=u(e);console.error("[getJobResult]",t)}return null}}));var t},enabled:"undefined"!=typeof window&&b&&Boolean(v)&&!w.some((e=>e.href===v))&&v.includes(".")&&!v.includes("https://prod-pickaxe-assets")&&!v.includes("https://pickaxeproject--v2"),retry:2,onSuccess:t=>e(void 0,void 0,void 0,(function*(){t&&t.title&&(w.some((e=>e.href===t.href))||j((e=>[...e,t])))}))});const x=v.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(x&&(null==x?void 0:x[1]))return t("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${x[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(v.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t(a,{src:v,alt:"string"==typeof f?f:"Markdown Image"});if(v.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t(c,{url:v});return v.includes("action_generated_files")&&v.match(/\.html$/)?t(l,{url:v}):g&&v.includes("pickaxe")&&(v.includes("/api/fn/result")||v.includes("/api/function_call_results"))?t(n,{jobUrl:v}):t("a",Object.assign({href:v,target:"_blank",rel:"noopener noreferrer",style:{color:h}},{children:f}))};export{p as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsxs as r,jsx as a}from"react/jsx-runtime";import{Prism as l}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as t}from"../../hooks/usePickaxeMarkdownContext.js";import s from"../../../PickaxeCopyButton.js";const o=o=>{var c,{node:i,children:n,className:m}=o,d=e(o,["node","children","className"]);const{syntaxTheme:h,accentColor:b}=t(),u=/language-(\w+)/.exec(m||"");return r("div",Object.assign({className:"relative"},{children:[a("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:a(s,{color:b,text:null!==(c=null==n?void 0:n.toString())&&void 0!==c?c:"",iconClassName:"w-4 h-4"})})),a("div",Object.assign({className:"overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:a(l,Object.assign({},d,{PreTag:"div",language:u?u[1]:"js",style:h,showLineNumbers:!0},{children:String(n).replace(/\n$/,"")}))}))]}))};export{o as default};
1
+ import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsxs as r,jsx as a}from"react/jsx-runtime";import{Prism as l}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";import t from"../../../PickaxeCopyButton.js";const s=s=>{var c,{node:i,children:n,className:m}=s,d=e(s,["node","children","className"]);const{syntaxTheme:h,accentColor:b}=o(),u=/language-(\w+)/.exec(m||"");return r("div",Object.assign({className:"pxe-markdown-code relative"},{children:[a("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:a(t,{color:b,text:null!==(c=null==n?void 0:n.toString())&&void 0!==c?c:"",iconClassName:"w-4 h-4"})})),a("div",Object.assign({className:"overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:a(l,Object.assign({},d,{PreTag:"div",language:u?u[1]:"js",style:h,showLineNumbers:!0},{children:String(n).replace(/\n$/,"")}))}))]}))};export{s as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";const r=r=>{var{node:i,title:l="Random Iframe",children:a,style:n}=r,o=e(r,["node","title","children","style"]);return t("iframe",Object.assign({title:l,style:Object.assign({borderRadius:"8px",width:"100%",marginBottom:"1.5rem"},n),allowFullScreen:!0},o,{children:a}))};export{r as default};
1
+ import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";const r=r=>{var{node:i,title:l="Random Iframe",children:s,style:a}=r,n=e(r,["node","title","children","style"]);return t("iframe",Object.assign({title:l,style:Object.assign({borderRadius:"8px",width:"100%"},a),allowFullScreen:!0},n,{children:s}))};export{r as default};
@@ -1 +1 @@
1
- import{__rest as o}from"../../../../../../_virtual/_tslib.js";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";import{useHover as n}from"../../../../../../hooks/core/useHover.js";import{motion as s}from"framer-motion";import{getContrastColor as a}from"../../../../../../common/utils.js";import l from"../../../../../Icons/download.svg.js";import p from"../../../PickaxeCopyButton.js";import c from"./ImgModal.js";const d=({node:d,src:m,alt:b})=>{const{accentColor:h}=r(),[x,g]=t(!1),[u,y]=t(!1),f=n(),{isHover:w}=f,v=o(f,["isHover"]);return e("div",Object.assign({style:{marginTop:"2rem",marginBottom:"2rem",display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:w?"translateY(-5px)":"translateY(0)"}},v,{children:[u&&i(c,{src:m,isOpen:u,onChangeIsOpen:y}),x?i("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e("div",Object.assign({style:{position:"relative"}},{children:[e(s.div,Object.assign({initial:"hidden",animate:w?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[i(s.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:h,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>{o.stopPropagation(),window.open(m,"_blank")}},{children:i(l,{width:24,height:24,style:{color:a(h),flexShrink:0}})})),i(s.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:h,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>o.stopPropagation()},{children:i(p,{color:a(h),iconClassName:"w-6 h-6",text:m||""})}))]})),i("img",{src:m,alt:b,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:w?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>g(!0),onClick:()=>y(!0)})]}))]}))};export{d as default};
1
+ import{__rest as o}from"../../../../../../_virtual/_tslib.js";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";import{useHover as n}from"../../../../../../hooks/core/useHover.js";import{motion as s}from"framer-motion";import{getContrastColor as a}from"../../../../../../common/utils.js";import l from"../../../../../Icons/download.svg.js";import p from"../../../PickaxeCopyButton.js";import c from"./ImgModal.js";const d=({node:d,src:m,alt:x})=>{const{accentColor:b}=r(),[h,g]=t(!1),[u,y]=t(!1),f=n(),{isHover:w}=f,k=o(f,["isHover"]);return e("div",Object.assign({className:"pxe-markdown-image",style:{display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:w?"translateY(-5px)":"translateY(0)"}},k,{children:[u&&i(c,{src:m,isOpen:u,onChangeIsOpen:y}),h?i("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e("div",Object.assign({style:{position:"relative"}},{children:[e(s.div,Object.assign({initial:"hidden",animate:w?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[i(s.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:b,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>{o.stopPropagation(),window.open(m,"_blank")}},{children:i(l,{width:24,height:24,style:{color:a(b),flexShrink:0}})})),i(s.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:b,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>o.stopPropagation()},{children:i(p,{color:a(b),iconClassName:"w-6 h-6",text:m||""})}))]})),i("img",{src:m,alt:x,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:w?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>g(!0),onClick:()=>y(!0)})]}))]}))};export{d as default};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";const s=({node:s,children:o})=>{const{actions:r}=i(),l="string"==typeof o&&o.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(l&&(null==l?void 0:l[1]))return t("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${l[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(r&&"string"==typeof o&&o.includes("pickaxe")&&(o.includes("/api/fn/result")||o.includes("/api/function_call_results"))){const i=o.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),s=o.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e("div",Object.assign({className:"flex flex-col"},{children:[t("p",Object.assign({style:{fontWeight:350,marginBottom:"0.75rem"}},{children:i})),t(n,{jobUrl:(null==s?void 0:s[0])||""})]}))}return t("p",Object.assign({style:{fontWeight:350,marginBottom:"0.75rem"}},{children:o}))};export{s as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";const s=({node:s,children:l})=>{const{actions:r}=i(),o="string"==typeof l&&l.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(o&&(null==o?void 0:o[1]))return e("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${o[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(r&&"string"==typeof l&&l.includes("pickaxe")&&(l.includes("/api/fn/result")||l.includes("/api/function_call_results"))){const i=l.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),s=l.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e("p",{children:i}),e(n,{jobUrl:(null==s?void 0:s[0])||""})]}))}return e("p",{children:l})};export{s as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../../../../../hooks/pickaxe/usePickaxeContext.js";import s from"./Modal/index.js";import r from"./Modal/Body.js";import l from"./Modal/CloseButton.js";const a=({value:a,isOpen:i,onChangeIsOpen:n})=>{const{colors:c}=t();return e(s,Object.assign({isOpen:i,onChange:n},{children:o(r,Object.assign({className:"relative flex flex-col px-8 pt-[26px] pb-8 w-full min-[767px]:max-w-[600px] max-[767px]:border-0",style:{backgroundColor:c.primary,color:c.text,borderColor:c.text+"4D"},avoidOverflow:!0},{children:[e("div",Object.assign({className:"flex items-start justify-end gap-4"},{children:e(l,{})})),e("div",Object.assign({className:"mt-6 flex flex-col items-center"},{children:e("div",Object.assign({className:"flex w-full max-w-[550px] flex-col items-center text-center"},{children:e("p",{children:a})}))}))]}))}))};export{a as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{usePickaxeContext as r}from"../../../../../../hooks/pickaxe/usePickaxeContext.js";import{PickaxeMarkdownRenderer as t}from"../../Renderer.js";import s from"./Modal/index.js";import l from"./Modal/Body.js";import a from"./Modal/CloseButton.js";const i=({value:i,isOpen:n,onChangeIsOpen:c})=>{const{colors:m}=r();return e(s,Object.assign({isOpen:n,onChange:c},{children:o(l,Object.assign({className:"relative flex flex-col px-8 pt-[26px] pb-8 w-full min-[767px]:max-w-[600px] max-[767px]:border-0",style:{backgroundColor:m.primary,color:m.text,borderColor:m.text+"4D"},avoidOverflow:!0},{children:[e("div",Object.assign({className:"flex items-start justify-end gap-4"},{children:e(a,{})})),e("div",Object.assign({className:"mt-6 flex flex-col items-center"},{children:e("div",Object.assign({className:"flex w-full max-w-[550px] flex-col items-center text-center"},{children:e(t,{value:i})}))}))]}))}))};export{i as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import{useState as t,useRef as n,useMemo as o}from"react";import{usePickaxeMarkdownContext as s}from"./hooks/usePickaxeMarkdownContext.js";import l from"react-markdown";import m from"remark-gfm";import a from"remark-math";import d from"rehype-katex";import c from"rehype-raw";import h from"./Custom/A/index.js";import g from"./Custom/P/index.js";import p from"./Custom/Img/index.js";import f from"./Custom/Iframe/index.js";import b from"./Custom/Code/index.js";import y from"./Custom/common/LinkPreview.js";import u from"./Custom/common/TextModal.js";const j=({className:j,style:x,value:O,recursion:k=!1,children:B,maxChar:C})=>{const{theme:D,accentColor:v,websiteMetadatas:S}=s(),[w,H]=t(!1),P=n(null),z=o((()=>{if(!O)return"";let e=O;return e=O.replace(/<!--[\s\S]*?-->/g,""),e=O.replace(/\u200B/g,""),C&&(e=e.slice(0,C)),e}),[O,C]),L={h1:({node:e,children:r})=>i("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem",marginBottom:"1.5rem"}},{children:r})),h2:({node:e,children:r})=>i("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem",marginBottom:"1.5rem"}},{children:r})),h3:({node:e,children:r})=>i("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"0.5rem"}},{children:r})),h4:({node:e,children:r})=>i("h4",Object.assign({className:"mt-2",style:{fontSize:"1.25rem",lineHeight:"1.75rem",marginBottom:"0.5rem"}},{children:r})),h5:({node:e,children:r})=>i("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem",marginBottom:"0.5rem"}},{children:r})),p:g,a:h,ol:({node:e,children:r})=>i("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"1.5rem"}},{children:r})),ul:({node:e,children:r})=>i("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem",marginBottom:"1.5rem"}},{children:r})),li:({node:e,children:r})=>i("li",Object.assign({style:{margin:"10px"}},{children:r})),table:({children:e})=>i("div",Object.assign({style:{position:"relative",overflow:"auto",marginBottom:"1.5rem"}},{children:i("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:e}))})),th:({node:e,children:r})=>i("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:r})),tr:({node:e,children:r})=>i("tr",Object.assign({style:{border:"dark"===D?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>i("td",Object.assign({style:{padding:"0.75em 1em"}},{children:r})),code:b,blockquote:({node:e,children:r})=>i("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===D?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===D?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:r})),img:p,iframe:f,hr:()=>i("hr",{style:{border:0,borderTop:"dark"===D?"1px solid #30363D":"1px solid #D0D7DE",marginBottom:"1.5rem"}}),span:r=>{var{node:t,children:n}=r,o=e(r,["node","children"]);return"intro-msg-expand-btn"===o.className?i("span",Object.assign({},o,{style:{display:"inline",fontWeight:500,color:v,cursor:"pointer"},onClick:()=>H(!0)},{children:n})):i("span",Object.assign({},o,{children:n}))}};return r("div",Object.assign({className:"pxe-markdown",ref:P,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},x)},{children:[w&&i(u,{value:z,isOpen:w,onChangeIsOpen:H}),i(l,Object.assign({},j&&{className:j},{components:L,remarkPlugins:[m,a],rehypePlugins:[d,c]},{children:`${z}${!k&&S.length>0?"\n\n---":""}${"number"==typeof C&&z.length>=C?'<span class="intro-msg-expand-btn">...</span>':""}`})),!k&&S.length>0&&i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:S.map(((e,r)=>i(y,{data:e},r)))})),B]}))};export{j as PickaxeMarkdownRenderer};
1
+ import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as i,useMemo as t}from"react";import{usePickaxeMarkdownContext as l}from"./hooks/usePickaxeMarkdownContext.js";import s from"react-markdown";import d from"remark-gfm";import a from"remark-math";import m from"rehype-katex";import c from"rehype-raw";import h from"./Custom/A/index.js";import p from"./Custom/P/index.js";import f from"./Custom/Img/index.js";import g from"./Custom/Iframe/index.js";import u from"./Custom/Code/index.js";import x from"./Custom/common/LinkPreview.js";import b from"./Custom/common/TextModal.js";import k from"../../../../common/cn.js";const j=({className:j,style:y,value:C,recursion:D=!1,children:O,maxChar:v,multiLineBreaks:w})=>{const{theme:B,accentColor:N,websiteMetadatas:P}=l(),[T,E]=o(!1),I=i(null),L=t((()=>{if(!C)return"";let e=C;if(e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),w&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),v&&e.length>v){const r=/(https?:\/\/[^\s)]+)/g,n=[];let o;for(;null!==(o=r.exec(e));)n.push({start:o.index,end:o.index+o[0].length});let i=v;for(const e of n)if(v>e.start&&v<e.end){i=e.end+1;break}e=e.slice(0,i)}return e}),[C,v,w]),M={h1:({node:e,children:r})=>n("h1",{children:r}),h2:({node:e,children:r})=>n("h2",{children:r}),h3:({node:e,children:r})=>n("h3",{children:r}),h4:({node:e,children:r})=>n("h4",{children:r}),h5:({node:e,children:r})=>n("h5",{children:r}),p:p,a:h,ol:({node:e,children:r})=>n("ol",{children:r}),ul:({node:e,children:r})=>n("ul",{children:r}),li:({node:e,children:r})=>n("li",{children:r}),table:({children:e})=>n("div",Object.assign({className:"pxe-markdown-table"},{children:n("table",{children:e})})),th:({node:e,children:r})=>n("th",{children:r}),tr:({node:e,children:r})=>n("tr",Object.assign({style:{border:"dark"===B?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>n("td",{children:r}),code:u,blockquote:({node:e,children:r})=>n("blockquote",Object.assign({style:{borderLeft:"dark"===B?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===B?"#8B8B8B":"#656D76"}},{children:r})),img:f,iframe:g,hr:()=>n("hr",{style:{border:0,borderTop:"dark"===B?"1px solid #30363D":"1px solid #D0D7DE"}}),span:r=>{var{node:o,children:i}=r,t=e(r,["node","children"]);return"intro-msg-expand-btn"===t.className?n("span",Object.assign({},t,{style:{display:"inline",fontWeight:500,color:N,cursor:"pointer"},onClick:()=>E(!0)},{children:i})):n("span",Object.assign({},t,{children:i}))},br:()=>n("br",{})};return r("div",Object.assign({className:"pxe-markdown",ref:I,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},y)},{children:[T&&n(b,{value:L,isOpen:T,onChangeIsOpen:E}),n(s,Object.assign({className:k("pxe-prose",j),components:M,remarkPlugins:[d,a],rehypePlugins:[m,c]},{children:`${L}${!D&&P.length>0?"\n\n---":""}${"number"==typeof v&&L.length>=v?'<span class="intro-msg-expand-btn">...</span>':""}`})),!D&&P.length>0&&n("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:P.map(((e,r)=>n(x,{data:e},r)))})),O]}))};export{j as PickaxeMarkdownRenderer};
@@ -0,0 +1 @@
1
+ .pxe-prose p{font-weight:350}.pxe-prose>p{margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-code,.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:2.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child),.pxe-prose>p:not(:first-child) .pxe-markdown-image,.pxe-prose>p:not(:first-child) .pxe-markdown-youtube,.pxe-prose>pre:not(:first-child){margin-top:2.5rem}
@@ -6,8 +6,9 @@ export interface PickaxeMarkdownRendererProps {
6
6
  recursion?: boolean;
7
7
  children?: ReactNode;
8
8
  maxChar?: number;
9
+ multiLineBreaks?: boolean;
9
10
  }
10
11
  export type Node = {
11
12
  node?: any;
12
13
  };
13
- export declare const PickaxeMarkdownRenderer: ({ className, style, value, recursion, children: _children, maxChar, }: PickaxeMarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const PickaxeMarkdownRenderer: ({ className, style, value, recursion, children: _children, maxChar, multiLineBreaks, }: PickaxeMarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import "./styles/prose.css";
1
2
  export * from "./components/Pickaxe";
2
3
  export * from "./components/Pickaxe/Provider";
3
4
  export * from "./components/Pickaxe/ResponseProvider";
@@ -3,7 +3,7 @@ export type PickaxeImageOrText = "text" | "image";
3
3
  export type PickaxePrivacySetting = "public" | "unlisted" | "private" | "deleted";
4
4
  export type PickaxeCloneable = "true" | "false";
5
5
  export type PickaxeDocumentUploadType = "ownerupload" | "enduserupload";
6
- export type PickaxeModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4-1106-preview" | "gpt-4" | "gpt-3.5-turbo" | "mistral-small" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620";
6
+ export type PickaxeModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4-1106-preview" | "gpt-4" | "gpt-3.5-turbo" | "gpt-4.5-preview" | "o1" | "o3-mini" | "deepseek-chat" | "mistral-small" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620" | "claude-3-7-sonnet-20250219" | "llama-3-uncensored";
7
7
  export type Pickaxe = {
8
8
  _id: string;
9
9
  formid: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "0.0.71",
3
+ "version": "1.0.0",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,8 @@
15
15
  "module": "dist/esm/index.js",
16
16
  "types": "dist/esm/src/index.d.ts",
17
17
  "files": [
18
- "dist"
18
+ "dist",
19
+ "dist/prose.css"
19
20
  ],
20
21
  "lint-staged": {
21
22
  "*.{js,jsx,ts,tsx}": [