feat: change to pre
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
function getImportPath(filename) {
|
||||
return `./${filename}`;
|
||||
}
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-CygNe1AV.js","copilot_web/vendor-markdown-BAJQc3l1.js","copilot_web/vendor-react-Dixhfmvb.js","copilot_web/message-components-CX7DIXqq.js","copilot_web/input.js","copilot_web/assets/input-Dx1yyZQD.css","copilot_web/fonts.css"].map(path => {
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-CnxBg5zO.js","copilot_web/vendor-markdown-BAJQc3l1.js","copilot_web/vendor-react-Dixhfmvb.js","copilot_web/message-components-CKrvYJJz.js","copilot_web/input.js","copilot_web/assets/input-Dx1yyZQD.css","copilot_web/fonts.css"].map(path => {
|
||||
const apiBase = window.comfyAPI?.api?.api?.api_base;
|
||||
if (apiBase) {
|
||||
// 有 API base 时,使用完整路径
|
||||
@@ -11,4 +11,4 @@ function getImportPath(filename) {
|
||||
return `./${path}`;
|
||||
}
|
||||
}))))=>i.map(i=>d[i]);
|
||||
import{_ as a}from"./input.js";import{j as o}from"./vendor-markdown-BAJQc3l1.js";import{r as t,R as i}from"./vendor-react-Dixhfmvb.js";import{C as n}from"./message-components-CX7DIXqq.js";const s={EXPLAIN_NODE:"copilot:explain-node",TOOLBOX_USAGE:"copilot:toolbox-usage",TOOLBOX_PARAMETERS:"copilot:toolbox-parameters",TOOLBOX_DOWNSTREAMNODES:"copilot:toolbox-downstreamnodes"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-CygNe1AV.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function c(){const[e,r]=t.useState(!1);return t.useEffect(()=>{const l=()=>{r(!0)};return window.addEventListener(s.EXPLAIN_NODE,l),()=>window.removeEventListener(s.EXPLAIN_NODE,l)},[]),o.jsx(n,{children:o.jsx("div",{className:"h-full w-full flex flex-col",children:o.jsx(t.Suspense,{fallback:o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:o.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>r(!1)})})})})}const O=Object.freeze(Object.defineProperty({__proto__:null,default:c},Symbol.toStringTag,{value:"Module"}));export{O as A,s as C};
|
||||
import{_ as a}from"./input.js";import{j as o}from"./vendor-markdown-BAJQc3l1.js";import{r as t,R as i}from"./vendor-react-Dixhfmvb.js";import{C as n}from"./message-components-CKrvYJJz.js";const s={EXPLAIN_NODE:"copilot:explain-node",TOOLBOX_USAGE:"copilot:toolbox-usage",TOOLBOX_PARAMETERS:"copilot:toolbox-parameters",TOOLBOX_DOWNSTREAMNODES:"copilot:toolbox-downstreamnodes"},d=i.lazy(()=>a(()=>import(getImportPath("workflowChat-CnxBg5zO.js")).then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.default})));function c(){const[e,r]=t.useState(!1);return t.useEffect(()=>{const l=()=>{r(!0)};return window.addEventListener(s.EXPLAIN_NODE,l),()=>window.removeEventListener(s.EXPLAIN_NODE,l)},[]),o.jsx(n,{children:o.jsx("div",{className:"h-full w-full flex flex-col",children:o.jsx(t.Suspense,{fallback:o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:o.jsx(d,{visible:!0,triggerUsage:e,onUsageTriggered:()=>r(!1)})})})})}const O=Object.freeze(Object.defineProperty({__proto__:null,default:c},Symbol.toStringTag,{value:"Module"}));export{O as A,s as C};
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
function getImportPath(filename) {
|
||||
return `./${filename}`;
|
||||
}
|
||||
import{j as s}from"./vendor-markdown-BAJQc3l1.js";import{r as i}from"./vendor-react-Dixhfmvb.js";import{u as A,B as D,R as E,h as x,a as m,W as b}from"./message-components-CX7DIXqq.js";function M({content:f,name:k="Assistant",avatar:O,onAddMessage:y,onUpdateMessage:c,messageId:w}){const{dispatch:u,abortControllerRef:l}=A(),[d,_]=i.useState(!1),[T,G]=i.useState(""),[J,S]=i.useState(!1),[j,N]=i.useState(null),r=i.useMemo(()=>{try{return JSON.parse(f)}catch(e){return console.error("Failed to parse message content:",e),null}},[f]),h=i.useMemo(()=>{if(!r||!r.ext)return null;const e=r.ext.find(t=>t.type==="debug_start_checkpoint"||t.type==="debug_checkpoint"&&t.data?.checkpoint_type==="debug_start");return e&&e.data&&e.data.checkpoint_id?e.data.checkpoint_id:null},[r])||j,C=async()=>{if(d)return;const e=x(),t={id:e,role:"ai",content:JSON.stringify({text:`🔍 Starting workflow analysis...
|
||||
import{j as s}from"./vendor-markdown-BAJQc3l1.js";import{r as i}from"./vendor-react-Dixhfmvb.js";import{u as A,B as D,R as E,h as x,a as m,W as b}from"./message-components-CKrvYJJz.js";function M({content:f,name:k="Assistant",avatar:O,onAddMessage:y,onUpdateMessage:c,messageId:w}){const{dispatch:u,abortControllerRef:l}=A(),[d,_]=i.useState(!1),[T,G]=i.useState(""),[J,S]=i.useState(!1),[j,N]=i.useState(null),r=i.useMemo(()=>{try{return JSON.parse(f)}catch(e){return console.error("Failed to parse message content:",e),null}},[f]),h=i.useMemo(()=>{if(!r||!r.ext)return null;const e=r.ext.find(t=>t.type==="debug_start_checkpoint"||t.type==="debug_checkpoint"&&t.data?.checkpoint_type==="debug_start");return e&&e.data&&e.data.checkpoint_id?e.data.checkpoint_id:null},[r])||j,C=async()=>{if(d)return;const e=x(),t={id:e,role:"ai",content:JSON.stringify({text:`🔍 Starting workflow analysis...
|
||||
`,ext:[]}),format:"markdown",name:"Assistant",finished:!1,debugGuide:!0};y?.(t);try{await v(),u({type:"SET_LOADING",payload:!0}),await I(e)}finally{_(!1)}},v=async()=>{try{const e=await m.graphToPrompt(),t=localStorage.getItem("sessionId")||"";if(t&&e){const n=await b.saveWorkflowCheckpoint(t,e.output,e.workflow,"debug_start");if(N(n.version_id),console.log(`Saved debug start checkpoint: ${n.version_id}`),c&&r){const o=[...r.ext||[]].filter(g=>g.type!=="debug_start_checkpoint"&&!(g.type==="debug_checkpoint"&&g.data?.checkpoint_type==="debug_start"));o.push({type:"debug_start_checkpoint",data:{checkpoint_id:n.version_id,checkpoint_type:"debug_start"}});const p={id:w||x(),role:"ai",content:JSON.stringify({text:r.text,ext:o}),format:"debug_guide",name:"Assistant"};c(p)}}}catch(e){console.error("Failed to save checkpoint before debug:",e)}},I=async e=>{try{const t=await m.graphToPrompt();let n="",a=null;l&&(l.current=new AbortController);for await(const o of b.streamDebugAgent(t,l?.current?.signal||void 0))if(o.text){n=o.text,o.ext&&(a=o.ext);const p={id:e,role:"ai",content:JSON.stringify({text:n,ext:a||[]}),format:"markdown",name:"Assistant",finished:!1,debugGuide:!0};c?.(p)}c?.({id:e,role:"ai",content:JSON.stringify({text:n,ext:a||[]}),format:"markdown",name:"Assistant",finished:!0,debugGuide:!0}),u({type:"SET_LOADING",payload:!1}),l.current=null}catch(t){console.error("Error calling debug agent:",t),S(!1);const a={id:e,role:"ai",content:JSON.stringify({text:`I encountered an error while analyzing your workflow: ${t.message||"Unknown error"}`,ext:[]}),format:"markdown",name:"Assistant",finished:!0};c?.(a),u({type:"SET_LOADING",payload:!1}),l.current=null}};return r?s.jsx(D,{name:k,children:s.jsxs("div",{className:"bg-gray-100 pt-4 px-4 pb-3 rounded-lg",children:[s.jsx("div",{className:"flex justify-between items-start",children:s.jsx("p",{className:"text-gray-700 text-sm flex-1",children:r.text})}),s.jsx("div",{className:"flex justify-end mt-4",children:s.jsx("button",{onClick:C,disabled:d,className:`debug-btn bg-debug-btn text-sm text-[#fff] rounded-lg px-4 py-2 ${d?"cursor-not-allowed":"cursor-pointer"}`,children:d?"Analyzing...":"Debug Errors"})}),s.jsx("div",{className:"flex justify-end mt-2",children:!!h&&s.jsx("div",{className:"ml-2 flex-shrink-0",children:s.jsx(E,{checkpointId:h,onRestore:()=>{console.log("Workflow restored from checkpoint")}})})})]})}):null}export{M as DebugGuide};
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
function getImportPath(filename) {
|
||||
return `./${filename}`;
|
||||
}
|
||||
import{j as e}from"./vendor-markdown-BAJQc3l1.js";import{b as f,c as h,B as m,p as u,R as w}from"./message-components-CX7DIXqq.js";import{r as k}from"./vendor-react-Dixhfmvb.js";import{B as j}from"./workflowChat-CygNe1AV.js";import"./input.js";/* empty css */import"./App-XEhoxo2R.js";const v=i=>{const{title:a="",isWorkflowUpdate:d=!1,className:n="",children:c}=i,[s,r]=k.useState(!1);return e.jsx(j,{className:"rounded-lg ",borderClassName:"rounded-lg",children:e.jsxs("div",{className:`flex flex-col ${n} ${s?"":"max-h-[200px]"}`,children:[e.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-gray-100",children:[e.jsx("div",{children:typeof a=="string"?e.jsx("h3",{className:"text-sm text-[#fff] font-medium",children:a}):a}),e.jsx("button",{onClick:()=>{r(!s)},children:s?e.jsx(f,{className:"text-gray-700"}):e.jsx(h,{className:"text-gray-700"})})]}),e.jsx("div",{className:"overflow-hidden flex-1",children:c})]})})};function B({content:i,name:a="Assistant",avatar:d,format:n="markdown"}){const c=()=>{let s=null,r=!1,o;try{if(o=JSON.parse(i),o.ext){let t=o.ext.find(l=>l.type==="workflow_rewrite_checkpoint"||l.type==="debug_checkpoint"&&l.data?.checkpoint_type==="workflow_rewrite_start");t&&t.data&&t.data.checkpoint_id?(s=t.data.checkpoint_id,r=!0):(t=o.ext.find(l=>l.type==="workflow_rewrite_complete"),t&&t.data&&t.data.version_id?(s=t.data.version_id,r=!0):(t=o.ext.find(l=>l.type==="debug_checkpoint"),t&&t.data&&t.data.checkpoint_id&&(s=t.data.checkpoint_id,r=!1))),o.ext.find(l=>l.type==="workflow_update")&&(r=!0)}}catch(t){return console.error("Failed to parse DebugResult content:",t),null}const x=r?e.jsxs("div",{className:"flex items-center text-green-500",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),e.jsx("h4",{className:"font-bold text-xl",children:"Workflow Updated Successfully"})]}):e.jsxs("div",{className:"flex items-center text-gray-900",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"28108",fill:"currentColor",children:e.jsx("path",{d:"M401.048025 844.855924c0 20.341281 16.643052 36.984333 36.984333 36.984333l147.936307 0c20.341281 0 36.984333-16.643052 36.984333-36.984333L622.952998 807.872614 401.048025 807.872614 401.048025 844.855924zM512 142.159744c-142.943596 0-258.888282 115.944686-258.888282 258.888282 0 88.021729 44.011376 165.503405 110.951975 212.288964l0 83.58365c0 20.341281 16.643052 36.984333 36.984333 36.984333l221.903949 0c20.341281 0 36.984333-16.643052 36.984333-36.984333l0-83.58365c66.941622-46.784536 110.951975-124.266212 110.951975-212.288964C770.888282 258.104429 654.943596 142.159744 512 142.159744zM617.588827 552.682561l-31.621185 22.005176 0 85.248569L438.031335 659.936307l0-85.063351L406.41015 552.866756c-49.743938-34.764781-79.33079-91.350544-79.33079-151.634536 0-101.890598 83.029018-184.92064 184.92064-184.92064s184.92064 83.029018 184.92064 184.92064C696.919617 461.332017 667.332764 517.91778 617.588827 552.682561z","p-id":"28277"})}),e.jsx("h4",{className:"font-bold text-xl",children:"Workflow Updated Finished"})]}),p=r?e.jsx("div",{className:"mt-3 text-xs text-gray-700",children:"💡 If you're not satisfied with the changes, click the restore button to revert to the previous version."}):null;return e.jsxs("div",{className:"sticky top-0 left-0 w-full bg-gray-100 p-4 rounded-lg overflow-hidden",children:[e.jsx(v,{title:x,isWorkflowUpdate:r,className:"p-4",children:e.jsxs("div",{className:"prose prose-sm max-w-none",children:[n==="markdown"?e.jsx(u,{response:o||{}}):e.jsx("pre",{className:"whitespace-pre-wrap text-gray-700 text-sm leading-relaxed h-full",children:o?.text||""}),p]})}),e.jsx("div",{className:"flex justify-end mt-2",children:!!s&&e.jsx("div",{className:"ml-2 flex-shrink-0",children:e.jsx(w,{checkpointId:s,onRestore:()=>{console.log(`Workflow restored from ${r?"workflow update":"debug"} checkpoint`)},title:r?`Restore to this version (Version ${s})`:`Restore checkpoint ${s}`})})})]})};return e.jsx(m,{name:a,children:c()})}export{B as DebugResult};
|
||||
import{j as e}from"./vendor-markdown-BAJQc3l1.js";import{b as f,c as h,B as m,p as u,R as w}from"./message-components-CKrvYJJz.js";import{r as k}from"./vendor-react-Dixhfmvb.js";import{B as j}from"./workflowChat-CnxBg5zO.js";import"./input.js";/* empty css */import"./App-zk26O2-e.js";const v=i=>{const{title:a="",isWorkflowUpdate:d=!1,className:n="",children:c}=i,[s,r]=k.useState(!1);return e.jsx(j,{className:"rounded-lg ",borderClassName:"rounded-lg",children:e.jsxs("div",{className:`flex flex-col ${n} ${s?"":"max-h-[200px]"}`,children:[e.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-gray-100",children:[e.jsx("div",{children:typeof a=="string"?e.jsx("h3",{className:"text-sm text-[#fff] font-medium",children:a}):a}),e.jsx("button",{onClick:()=>{r(!s)},children:s?e.jsx(f,{className:"text-gray-700"}):e.jsx(h,{className:"text-gray-700"})})]}),e.jsx("div",{className:"overflow-hidden flex-1",children:c})]})})};function B({content:i,name:a="Assistant",avatar:d,format:n="markdown"}){const c=()=>{let s=null,r=!1,o;try{if(o=JSON.parse(i),o.ext){let t=o.ext.find(l=>l.type==="workflow_rewrite_checkpoint"||l.type==="debug_checkpoint"&&l.data?.checkpoint_type==="workflow_rewrite_start");t&&t.data&&t.data.checkpoint_id?(s=t.data.checkpoint_id,r=!0):(t=o.ext.find(l=>l.type==="workflow_rewrite_complete"),t&&t.data&&t.data.version_id?(s=t.data.version_id,r=!0):(t=o.ext.find(l=>l.type==="debug_checkpoint"),t&&t.data&&t.data.checkpoint_id&&(s=t.data.checkpoint_id,r=!1))),o.ext.find(l=>l.type==="workflow_update")&&(r=!0)}}catch(t){return console.error("Failed to parse DebugResult content:",t),null}const x=r?e.jsxs("div",{className:"flex items-center text-green-500",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),e.jsx("h4",{className:"font-bold text-xl",children:"Workflow Updated Successfully"})]}):e.jsxs("div",{className:"flex items-center text-gray-900",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"28108",fill:"currentColor",children:e.jsx("path",{d:"M401.048025 844.855924c0 20.341281 16.643052 36.984333 36.984333 36.984333l147.936307 0c20.341281 0 36.984333-16.643052 36.984333-36.984333L622.952998 807.872614 401.048025 807.872614 401.048025 844.855924zM512 142.159744c-142.943596 0-258.888282 115.944686-258.888282 258.888282 0 88.021729 44.011376 165.503405 110.951975 212.288964l0 83.58365c0 20.341281 16.643052 36.984333 36.984333 36.984333l221.903949 0c20.341281 0 36.984333-16.643052 36.984333-36.984333l0-83.58365c66.941622-46.784536 110.951975-124.266212 110.951975-212.288964C770.888282 258.104429 654.943596 142.159744 512 142.159744zM617.588827 552.682561l-31.621185 22.005176 0 85.248569L438.031335 659.936307l0-85.063351L406.41015 552.866756c-49.743938-34.764781-79.33079-91.350544-79.33079-151.634536 0-101.890598 83.029018-184.92064 184.92064-184.92064s184.92064 83.029018 184.92064 184.92064C696.919617 461.332017 667.332764 517.91778 617.588827 552.682561z","p-id":"28277"})}),e.jsx("h4",{className:"font-bold text-xl",children:"Workflow Updated Finished"})]}),p=r?e.jsx("div",{className:"mt-3 text-xs text-gray-700",children:"💡 If you're not satisfied with the changes, click the restore button to revert to the previous version."}):null;return e.jsxs("div",{className:"sticky top-0 left-0 w-full bg-gray-100 p-4 rounded-lg overflow-hidden",children:[e.jsx(v,{title:x,isWorkflowUpdate:r,className:"p-4",children:e.jsxs("div",{className:"prose prose-sm max-w-none",children:[n==="markdown"?e.jsx(u,{response:o||{}}):e.jsx("pre",{className:"whitespace-pre-wrap text-gray-700 text-sm leading-relaxed h-full",children:o?.text||""}),p]})}),e.jsx("div",{className:"flex justify-end mt-2",children:!!s&&e.jsx("div",{className:"ml-2 flex-shrink-0",children:e.jsx(w,{checkpointId:s,onRestore:()=>{console.log(`Workflow restored from ${r?"workflow update":"debug"} checkpoint`)},title:r?`Restore to this version (Version ${s})`:`Restore checkpoint ${s}`})})})]})};return e.jsx(m,{name:a,children:c()})}export{B as DebugResult};
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
function getImportPath(filename) {
|
||||
return `./${filename}`;
|
||||
}
|
||||
import{j as ue}from"./vendor-markdown-BAJQc3l1.js";import{W as Si,h as Wa,a as Wt}from"./message-components-CX7DIXqq.js";import{g as _u,R as Oe,b as Ba,r as h,d as Ca,a as Ou}from"./vendor-react-Dixhfmvb.js";var ns={exports:{}};/*!
|
||||
import{j as ue}from"./vendor-markdown-BAJQc3l1.js";import{W as Si,h as Wa,a as Wt}from"./message-components-CKrvYJJz.js";import{g as _u,R as Oe,b as Ba,r as h,d as Ca,a as Ou}from"./vendor-react-Dixhfmvb.js";var ns={exports:{}};/*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
function getImportPath(filename) {
|
||||
return `./${filename}`;
|
||||
}
|
||||
import{j as E,M as KT,r as GT,a as qT,b as YT,c as XT}from"./vendor-markdown-BAJQc3l1.js";import{r as Q,R as JT}from"./vendor-react-Dixhfmvb.js";let se=null;const qp=location.pathname.split("/").slice(0,-1).join("/");let ri=null;async function xce(){try{await Promise.all([import(qp+"/scripts/api.js").then(i=>{ri=i?.api}),import(qp+"/scripts/app.js").then(i=>{se=i?.app})])}catch(i){console.error("waitForApp error",i)}}const Q1={messages:[],selectedNode:Object.keys(se?.canvas?.selected_nodes??{})?.length?Object.values(se?.canvas?.selected_nodes):null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function ZT(i,e){switch(e.type){case"SET_MESSAGES":return{...i,messages:e.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,e.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(t=>t.id===e.payload.id&&!t.finished?e.payload:t)};case"SET_SELECTED_NODE":return{...i,selectedNode:e.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:e.payload};case"SET_LOADING":return{...i,loading:e.payload};case"SET_SESSION_ID":return{...i,sessionId:e.payload};case"SET_SHOW_CHAT":return{...i,showChat:e.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:e.payload};case"SET_SCREEN_STATE":return{...i,screenState:e.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const e0=Q.createContext({state:Q1,dispatch:()=>null,isAutoScroll:{current:!0},showcasIng:{current:!1},abortControllerRef:{current:null}});function Pce({children:i}){const[e,t]=Q.useReducer(ZT,Q1),r=Q.useRef(!0),n=Q.useRef(!0),o=Q.useRef(null);return JT.useEffect(()=>{e.sessionId&&e.messages.length>0&&localStorage.setItem(`messages_${e.sessionId}`,JSON.stringify(e.messages))},[e.messages,e.sessionId]),E.jsx(e0.Provider,{value:{state:e,dispatch:t,isAutoScroll:r,showcasIng:n,abortControllerRef:o},children:i})}function QT(){const i=Q.useContext(e0);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const t0={apiBaseUrl:"https://comfyui-copilot-server.onrender.com"};function eO(i,e){if(ri==null)throw console.error("api is null!"),new Error("api is null!");return ri.fetchApi(i,e)}function rt(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}var tO="0123456789abcdefghijklmnopqrstuvwxyz";function pr(i){return tO.charAt(i)}function rO(i,e){return i&e}function aa(i,e){return i|e}function Yp(i,e){return i^e}function Xp(i,e){return i&~e}function iO(i){if(i==0)return-1;var e=0;return i&65535||(i>>=16,e+=16),i&255||(i>>=8,e+=8),i&15||(i>>=4,e+=4),i&3||(i>>=2,e+=2),i&1||++e,e}function nO(i){for(var e=0;i!=0;)i&=i-1,++e;return e}var bn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r0="=";function bl(i){var e,t,r="";for(e=0;e+3<=i.length;e+=3)t=parseInt(i.substring(e,e+3),16),r+=bn.charAt(t>>6)+bn.charAt(t&63);for(e+1==i.length?(t=parseInt(i.substring(e,e+1),16),r+=bn.charAt(t<<2)):e+2==i.length&&(t=parseInt(i.substring(e,e+2),16),r+=bn.charAt(t>>2)+bn.charAt((t&3)<<4));(r.length&3)>0;)r+=r0;return r}function Jp(i){var e="",t,r=0,n=0;for(t=0;t<i.length&&i.charAt(t)!=r0;++t){var o=bn.indexOf(i.charAt(t));o<0||(r==0?(e+=pr(o>>2),n=o&3,r=1):r==1?(e+=pr(n<<2|o>>4),n=o&15,r=2):r==2?(e+=pr(n),e+=pr(o>>2),n=o&3,r=3):(e+=pr(n<<2|o>>4),e+=pr(o&15),r=0))}return r==1&&(e+=pr(n<<2)),e}var rn,oO={decode:function(i){var e;if(rn===void 0){var t="0123456789ABCDEF",r=` \f
|
||||
import{j as E,M as KT,r as GT,a as qT,b as YT,c as XT}from"./vendor-markdown-BAJQc3l1.js";import{r as Q,R as JT}from"./vendor-react-Dixhfmvb.js";let se=null;const qp=location.pathname.split("/").slice(0,-1).join("/");let ri=null;async function xce(){try{await Promise.all([import(qp+"/scripts/api.js").then(i=>{ri=i?.api}),import(qp+"/scripts/app.js").then(i=>{se=i?.app})])}catch(i){console.error("waitForApp error",i)}}const Q1={messages:[],selectedNode:Object.keys(se?.canvas?.selected_nodes??{})?.length?Object.values(se?.canvas?.selected_nodes):null,installedNodes:[],loading:!1,sessionId:null,showChat:!1,activeTab:"chat",screenState:null};function ZT(i,e){switch(e.type){case"SET_MESSAGES":return{...i,messages:e.payload};case"ADD_MESSAGE":return{...i,messages:[...i.messages,e.payload]};case"UPDATE_MESSAGE":return{...i,messages:i.messages.map(t=>t.id===e.payload.id&&!t.finished?e.payload:t)};case"SET_SELECTED_NODE":return{...i,selectedNode:e.payload};case"SET_INSTALLED_NODES":return{...i,installedNodes:e.payload};case"SET_LOADING":return{...i,loading:e.payload};case"SET_SESSION_ID":return{...i,sessionId:e.payload};case"SET_SHOW_CHAT":return{...i,showChat:e.payload};case"SET_ACTIVE_TAB":return{...i,activeTab:e.payload};case"SET_SCREEN_STATE":return{...i,screenState:e.payload};case"CLEAR_MESSAGES":return{...i,messages:[]};default:return i}}const e0=Q.createContext({state:Q1,dispatch:()=>null,isAutoScroll:{current:!0},showcasIng:{current:!1},abortControllerRef:{current:null}});function Pce({children:i}){const[e,t]=Q.useReducer(ZT,Q1),r=Q.useRef(!0),n=Q.useRef(!0),o=Q.useRef(null);return JT.useEffect(()=>{e.sessionId&&e.messages.length>0&&localStorage.setItem(`messages_${e.sessionId}`,JSON.stringify(e.messages))},[e.messages,e.sessionId]),E.jsx(e0.Provider,{value:{state:e,dispatch:t,isAutoScroll:r,showcasIng:n,abortControllerRef:o},children:i})}function QT(){const i=Q.useContext(e0);if(!i)throw new Error("useChatContext must be used within a ChatProvider");return i}const t0={apiBaseUrl:"https://comfyui-copilot-server-pre.onrender.com"};function eO(i,e){if(ri==null)throw console.error("api is null!"),new Error("api is null!");return ri.fetchApi(i,e)}function rt(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}var tO="0123456789abcdefghijklmnopqrstuvwxyz";function pr(i){return tO.charAt(i)}function rO(i,e){return i&e}function aa(i,e){return i|e}function Yp(i,e){return i^e}function Xp(i,e){return i&~e}function iO(i){if(i==0)return-1;var e=0;return i&65535||(i>>=16,e+=16),i&255||(i>>=8,e+=8),i&15||(i>>=4,e+=4),i&3||(i>>=2,e+=2),i&1||++e,e}function nO(i){for(var e=0;i!=0;)i&=i-1,++e;return e}var bn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r0="=";function bl(i){var e,t,r="";for(e=0;e+3<=i.length;e+=3)t=parseInt(i.substring(e,e+3),16),r+=bn.charAt(t>>6)+bn.charAt(t&63);for(e+1==i.length?(t=parseInt(i.substring(e,e+1),16),r+=bn.charAt(t<<2)):e+2==i.length&&(t=parseInt(i.substring(e,e+2),16),r+=bn.charAt(t>>2)+bn.charAt((t&3)<<4));(r.length&3)>0;)r+=r0;return r}function Jp(i){var e="",t,r=0,n=0;for(t=0;t<i.length&&i.charAt(t)!=r0;++t){var o=bn.indexOf(i.charAt(t));o<0||(r==0?(e+=pr(o>>2),n=o&3,r=1):r==1?(e+=pr(n<<2|o>>4),n=o&15,r=2):r==2?(e+=pr(n),e+=pr(o>>2),n=o&3,r=3):(e+=pr(n<<2|o>>4),e+=pr(o&15),r=0))}return r==1&&(e+=pr(n<<2)),e}var rn,oO={decode:function(i){var e;if(rn===void 0){var t="0123456789ABCDEF",r=` \f
|
||||
\r \u2028\u2029`;for(rn={},e=0;e<16;++e)rn[t.charAt(e)]=e;for(t=t.toLowerCase(),e=10;e<16;++e)rn[t.charAt(e)]=e;for(e=0;e<r.length;++e)rn[r.charAt(e)]=-1}var n=[],o=0,s=0;for(e=0;e<i.length;++e){var a=i.charAt(e);if(a=="=")break;if(a=rn[a],a!=-1){if(a===void 0)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(n[n.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},gi,lu={decode:function(i){var e;if(gi===void 0){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=`= \f
|
||||
\r \u2028\u2029`;for(gi=Object.create(null),e=0;e<64;++e)gi[t.charAt(e)]=e;for(gi["-"]=62,gi._=63,e=0;e<r.length;++e)gi[r.charAt(e)]=-1}var n=[],o=0,s=0;for(e=0;e<i.length;++e){var a=i.charAt(e);if(a=="=")break;if(a=gi[a],a!=-1){if(a===void 0)throw new Error("Illegal character at offset "+e);o|=a,++s>=4?(n[n.length]=o>>16,n[n.length]=o>>8&255,n[n.length]=o&255,o=0,s=0):o<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=o>>10;break;case 3:n[n.length]=o>>16,n[n.length]=o>>8&255;break}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(i){var e=lu.re.exec(i);if(e)if(e[1])i=e[1];else if(e[2])i=e[2];else throw new Error("RegExp out of sync");return lu.decode(i)}},nn=1e13,Do=function(){function i(e){this.buf=[+e||0]}return i.prototype.mulAdd=function(e,t){var r=this.buf,n=r.length,o,s;for(o=0;o<n;++o)s=r[o]*e+t,s<nn?t=0:(t=0|s/nn,s-=t*nn),r[o]=s;t>0&&(r[o]=t)},i.prototype.sub=function(e){var t=this.buf,r=t.length,n,o;for(n=0;n<r;++n)o=t[n]-e,o<0?(o+=nn,e=1):e=0,t[n]=o;for(;t[t.length-1]===0;)t.pop()},i.prototype.toString=function(e){if((e||10)!=10)throw new Error("only base 10 is supported");for(var t=this.buf,r=t[t.length-1].toString(),n=t.length-2;n>=0;--n)r+=(nn+t[n]).toString().substring(1);return r},i.prototype.valueOf=function(){for(var e=this.buf,t=0,r=e.length-1;r>=0;--r)t=t*nn+e[r];return t},i.prototype.simplify=function(){var e=this.buf;return e.length==1?e[0]:this},i}(),i0="…",sO=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,aO=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Dn(i,e){return i.length>e&&(i=i.substring(0,e)+i0),i}var Gd=function(){function i(e,t){this.hexDigits="0123456789ABCDEF",e instanceof i?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=t)}return i.prototype.get=function(e){if(e===void 0&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return typeof this.enc=="string"?this.enc.charCodeAt(e):this.enc[e]},i.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(e&15)},i.prototype.hexDump=function(e,t,r){for(var n="",o=e;o<t;++o)if(n+=this.hexByte(this.get(o)),r!==!0)switch(o&15){case 7:n+=" ";break;case 15:n+=`
|
||||
`;break;default:n+=" "}return n},i.prototype.isASCII=function(e,t){for(var r=e;r<t;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0},i.prototype.parseStringISO=function(e,t){for(var r="",n=e;n<t;++n)r+=String.fromCharCode(this.get(n));return r},i.prototype.parseStringUTF=function(e,t){for(var r="",n=e;n<t;){var o=this.get(n++);o<128?r+=String.fromCharCode(o):o>191&&o<224?r+=String.fromCharCode((o&31)<<6|this.get(n++)&63):r+=String.fromCharCode((o&15)<<12|(this.get(n++)&63)<<6|this.get(n++)&63)}return r},i.prototype.parseStringBMP=function(e,t){for(var r="",n,o,s=e;s<t;)n=this.get(s++),o=this.get(s++),r+=String.fromCharCode(n<<8|o);return r},i.prototype.parseTime=function(e,t,r){var n=this.parseStringISO(e,t),o=(r?sO:aO).exec(n);return o?(r&&(o[1]=+o[1],o[1]+=+o[1]<70?2e3:1900),n=o[1]+"-"+o[2]+"-"+o[3]+" "+o[4],o[5]&&(n+=":"+o[5],o[6]&&(n+=":"+o[6],o[7]&&(n+="."+o[7]))),o[8]&&(n+=" UTC",o[8]!="Z"&&(n+=o[8],o[9]&&(n+=":"+o[9]))),n):"Unrecognized time: "+n},i.prototype.parseInteger=function(e,t){for(var r=this.get(e),n=r>127,o=n?255:0,s,a="";r==o&&++e<t;)r=this.get(e);if(s=t-e,s===0)return n?-1:0;if(s>4){for(a=r,s<<=3;!((+a^o)&128);)a=+a<<1,--s;a="("+s+` bit)
|
||||
+3
-3
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user