From 381ad2f22745bfd4f25c430fe60d8af0331b85e7 Mon Sep 17 00:00:00 2001 From: puke3615 <1129090915@qq.com> Date: Wed, 26 Feb 2025 10:58:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8B=96=E5=8A=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=85=A5=E5=8F=A3=E5=90=8E=E8=A7=A6=E5=8F=91=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/copilot_web/App-CZpp8dzt.js | 6 -- dist/copilot_web/App-aZLaPGhc.js | 6 ++ dist/copilot_web/input.js | 4 +- ...t-sIlF8jkz.js => workflowChat-B1J3SC-R.js} | 2 +- ui/src/App.tsx | 4 +- ui/src/hooks/useDraggable.ts | 56 ++++++++++++------- 6 files changed, 48 insertions(+), 30 deletions(-) delete mode 100644 dist/copilot_web/App-CZpp8dzt.js create mode 100644 dist/copilot_web/App-aZLaPGhc.js rename dist/copilot_web/{workflowChat-sIlF8jkz.js => workflowChat-B1J3SC-R.js} (99%) diff --git a/dist/copilot_web/App-CZpp8dzt.js b/dist/copilot_web/App-CZpp8dzt.js deleted file mode 100644 index afed6cf..0000000 --- a/dist/copilot_web/App-CZpp8dzt.js +++ /dev/null @@ -1,6 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-sIlF8jkz.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DjFRyC2j.js","copilot_web/input.js","copilot_web/assets/input-C17syywN.css"].map(path => { - const apiBase = window.comfyAPI?.api?.api?.api_base; - const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; - return `${prefix}${path}`; - }))))=>i.map(i=>d[i]); -import{_ as x}from"./input.js";import{j as n}from"./vendor-markdown-Dek94WS0.js";import{r as o,R as f}from"./vendor-react-V04_Axys.js";import{C as b}from"./message-components-DjFRyC2j.js";const w=9999999,m={EXPLAIN_NODE:"copilot:explain-node"},E="/copilot_web/assets/logo-BTZhX0BN.png";function v(t={}){const[d,i]=o.useState({x:t.initialX??window.innerWidth-160,y:t.initialY??20}),[r,a]=o.useState(!1),[s,u]=o.useState({x:0,y:0});return o.useEffect(()=>{const e=g=>{if(r){const p=Math.min(Math.max(0,g.clientX-s.x),window.innerWidth-(t.boundaryPadding?.right??100)),h=Math.min(Math.max(0,g.clientY-s.y),window.innerHeight-(t.boundaryPadding?.bottom??40));i({x:p,y:h})}},l=()=>{a(!1)};return r&&(document.addEventListener("mousemove",e),document.addEventListener("mouseup",l)),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",l)}},[r,s,t.boundaryPadding]),{position:d,isDragging:r,handleMouseDown:e=>{e.preventDefault(),a(!0);const l=e.currentTarget.getBoundingClientRect();u({x:e.clientX-l.left,y:e.clientY-l.top})}}}const y=f.lazy(()=>x(()=>import("./workflowChat-sIlF8jkz.js"),__vite__mapDeps([0,1,2,3,4,5])).then(t=>({default:t.default})));function _(){const t=o.useRef(null),[d,i]=o.useState(!1),[r,a]=o.useState(!1),{position:s,isDragging:u,handleMouseDown:c}=v({boundaryPadding:{right:100,bottom:40}});return o.useEffect(()=>{const e=()=>{i(!0),a(!0)};return window.addEventListener(m.EXPLAIN_NODE,e),()=>window.removeEventListener(m.EXPLAIN_NODE,e)},[]),s?n.jsx(b,{children:n.jsx("div",{ref:t,children:n.jsxs("div",{className:"fixed",style:{zIndex:w,left:s.x,top:s.y,cursor:u?"grabbing":"grab"},children:[n.jsxs("button",{onMouseDown:c,onClick:()=>i(!0),className:"px-2 py-1 border border-gray-300 rounded-md bg-white text-black hover:bg-blue-300 hover:font-bold transition-colors select-none w-40 flex items-center space-x-1",style:{marginLeft:"-40px"},children:[n.jsx("img",{src:E,alt:"ComfyUI-Copilot Logo",className:"h-8 w-8"}),n.jsx("span",{className:"text-[14px] font-medium text-gray-800",children:"ComfyUI-Copilot"})]}),n.jsx(f.Suspense,{fallback:n.jsx("div",{children:"Loading..."}),children:n.jsx(y,{onClose:()=>{i(!1),a(!1)},visible:d,triggerUsage:r,onUsageTriggered:()=>a(!1)})})]})})}):null}const j=Object.freeze(Object.defineProperty({__proto__:null,default:_},Symbol.toStringTag,{value:"Module"}));export{j as A,E as l}; diff --git a/dist/copilot_web/App-aZLaPGhc.js b/dist/copilot_web/App-aZLaPGhc.js new file mode 100644 index 0000000..6bfed77 --- /dev/null +++ b/dist/copilot_web/App-aZLaPGhc.js @@ -0,0 +1,6 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-B1J3SC-R.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DjFRyC2j.js","copilot_web/input.js","copilot_web/assets/input-C17syywN.css"].map(path => { + const apiBase = window.comfyAPI?.api?.api?.api_base; + const prefix = apiBase ? `${apiBase.substring(1)}/` : ''; + return `${prefix}${path}`; + }))))=>i.map(i=>d[i]); +import{_ as E}from"./input.js";import{j as s}from"./vendor-markdown-Dek94WS0.js";import{r as t,R as w}from"./vendor-react-V04_Axys.js";import{C as v}from"./message-components-DjFRyC2j.js";const y=9999999,x={EXPLAIN_NODE:"copilot:explain-node"},D="/copilot_web/assets/logo-BTZhX0BN.png";function _(n={}){const[u,l]=t.useState({x:n.initialX??window.innerWidth-160,y:n.initialY??20}),[o,r]=t.useState(!1),[a,m]=t.useState({x:0,y:0}),[d,c]=t.useState(0),[g,b]=t.useState({x:0,y:0}),f=t.useCallback(e=>{if(o){const i=Math.min(Math.max(0,e.clientX-g.x),window.innerWidth-(n.boundaryPadding?.right??100)),h=Math.min(Math.max(0,e.clientY-g.y),window.innerHeight-(n.boundaryPadding?.bottom??40));l({x:i,y:h})}},[o,g,n.boundaryPadding]),p=t.useCallback(e=>{if(o){const i=Math.sqrt(Math.pow(e.clientX-a.x,2)+Math.pow(e.clientY-a.y,2)),h=Date.now()-d;i<5&&h<200&&n.onClick?.()}r(!1)},[o,a,d,n.onClick]);return t.useEffect(()=>(o&&(document.addEventListener("mousemove",f),document.addEventListener("mouseup",p)),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",p)}),[o,f,p]),{position:u,isDragging:o,handleMouseDown:e=>{e.preventDefault(),r(!0),c(Date.now()),m({x:e.clientX,y:e.clientY});const i=e.currentTarget.getBoundingClientRect();b({x:e.clientX-i.left,y:e.clientY-i.top})}}}const C=w.lazy(()=>E(()=>import("./workflowChat-B1J3SC-R.js"),__vite__mapDeps([0,1,2,3,4,5])).then(n=>({default:n.default})));function M(){const n=t.useRef(null),[u,l]=t.useState(!1),[o,r]=t.useState(!1),{position:a,isDragging:m,handleMouseDown:d}=_({boundaryPadding:{right:100,bottom:40},onClick:()=>l(!0)});return t.useEffect(()=>{const c=()=>{l(!0),r(!0)};return window.addEventListener(x.EXPLAIN_NODE,c),()=>window.removeEventListener(x.EXPLAIN_NODE,c)},[]),a?s.jsx(v,{children:s.jsx("div",{ref:n,children:s.jsxs("div",{className:"fixed",style:{zIndex:y,left:a.x,top:a.y,cursor:m?"grabbing":"grab"},children:[s.jsxs("button",{onMouseDown:d,className:"px-2 py-1 border border-gray-300 rounded-md bg-white text-black hover:bg-blue-300 hover:font-bold transition-colors select-none w-40 flex items-center space-x-1",style:{marginLeft:"-40px"},children:[s.jsx("img",{src:D,alt:"ComfyUI-Copilot Logo",className:"h-8 w-8"}),s.jsx("span",{className:"text-[14px] font-medium text-gray-800",children:"ComfyUI-Copilot"})]}),s.jsx(w.Suspense,{fallback:s.jsx("div",{children:"Loading..."}),children:s.jsx(C,{onClose:()=>{l(!1),r(!1)},visible:u,triggerUsage:o,onUsageTriggered:()=>r(!1)})})]})})}):null}const I=Object.freeze(Object.defineProperty({__proto__:null,default:M},Symbol.toStringTag,{value:"Module"}));export{I as A,D as l}; diff --git a/dist/copilot_web/input.js b/dist/copilot_web/input.js index e8895a8..523dfb4 100644 --- a/dist/copilot_web/input.js +++ b/dist/copilot_web/input.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-CZpp8dzt.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DjFRyC2j.js"])))=>i.map(i=>d[i]); -import{j as u}from"./vendor-markdown-Dek94WS0.js";import{a as v,R as p}from"./vendor-react-V04_Axys.js";import{w}from"./message-components-DjFRyC2j.js";const R="modulepreload",b=function(e){return"/"+e},m={},P=function(a,s,S){let d=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(s.map(n=>{if(n=b(n),n in m)return;m[n]=!0;const c=n.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${h}`))return;const o=document.createElement("link");if(o.rel=c?"stylesheet":R,c||(o.as="script"),o.crossOrigin="",o.href=n,t&&o.setAttribute("nonce",t),document.head.appendChild(o),c)return new Promise((y,E)=>{o.addEventListener("load",y),o.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${n}`)))})}))}function l(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&l(t.reason);return a().catch(l)})};var i={},f=v;i.createRoot=f.createRoot,i.hydrateRoot=f.hydrateRoot;const _=p.lazy(()=>P(async()=>{const{default:e}=await import("./App-CZpp8dzt.js").then(a=>a.A);return{default:e}},__vite__mapDeps([0,1,2,3])).then(({default:e})=>({default:e})));function A(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}A().then(()=>w()).then(()=>{const e=document.createElement("div");document.body.append(e),i.createRoot(e).render(u.jsx(p.StrictMode,{children:u.jsx(_,{})}))});export{P as _}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/App-aZLaPGhc.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DjFRyC2j.js"])))=>i.map(i=>d[i]); +import{j as u}from"./vendor-markdown-Dek94WS0.js";import{a as v,R as p}from"./vendor-react-V04_Axys.js";import{w}from"./message-components-DjFRyC2j.js";const R="modulepreload",b=function(e){return"/"+e},m={},P=function(a,s,S){let d=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");d=Promise.allSettled(s.map(n=>{if(n=b(n),n in m)return;m[n]=!0;const c=n.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${h}`))return;const o=document.createElement("link");if(o.rel=c?"stylesheet":R,c||(o.as="script"),o.crossOrigin="",o.href=n,t&&o.setAttribute("nonce",t),document.head.appendChild(o),c)return new Promise((y,E)=>{o.addEventListener("load",y),o.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${n}`)))})}))}function l(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&l(t.reason);return a().catch(l)})};var i={},f=v;i.createRoot=f.createRoot,i.hydrateRoot=f.hydrateRoot;const _=p.lazy(()=>P(async()=>{const{default:e}=await import("./App-aZLaPGhc.js").then(a=>a.A);return{default:e}},__vite__mapDeps([0,1,2,3])).then(({default:e})=>({default:e})));function A(){return new Promise(e=>{if(document.body)return e(document.body);document.addEventListener("DOMContentLoaded",()=>{e(document.body)})})}A().then(()=>w()).then(()=>{const e=document.createElement("div");document.body.append(e),i.createRoot(e).render(u.jsx(p.StrictMode,{children:u.jsx(_,{})}))});export{P as _}; diff --git a/dist/copilot_web/workflowChat-sIlF8jkz.js b/dist/copilot_web/workflowChat-B1J3SC-R.js similarity index 99% rename from dist/copilot_web/workflowChat-sIlF8jkz.js rename to dist/copilot_web/workflowChat-B1J3SC-R.js index 449bc26..f36f9eb 100644 --- a/dist/copilot_web/workflowChat-sIlF8jkz.js +++ b/dist/copilot_web/workflowChat-B1J3SC-R.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/WorkflowOption-BYhdO540.js","copilot_web/vendor-markdown-Dek94WS0.js","copilot_web/vendor-react-V04_Axys.js","copilot_web/message-components-DjFRyC2j.js"])))=>i.map(i=>d[i]); -import{j as v}from"./vendor-markdown-Dek94WS0.js";import{r as D,R as it,c as It}from"./vendor-react-V04_Axys.js";import{a as re,B as vg,U as xg,b as mg,g as xe,A as Xi,c as wg,u as Ts,W as Ji}from"./message-components-DjFRyC2j.js";import{l as yg}from"./App-CZpp8dzt.js";import{_ as br}from"./input.js";/** +import{j as v}from"./vendor-markdown-Dek94WS0.js";import{r as D,R as it,c as It}from"./vendor-react-V04_Axys.js";import{a as re,B as vg,U as xg,b as mg,g as xe,A as Xi,c as wg,u as Ts,W as Ji}from"./message-components-DjFRyC2j.js";import{l as yg}from"./App-aZLaPGhc.js";import{_ as br}from"./input.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 16dda72..31fd6ae 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -18,7 +18,8 @@ export default function App() { const [shouldTriggerUsage, setShouldTriggerUsage] = useState(false); const { position, isDragging, handleMouseDown } = useDraggable({ - boundaryPadding: { right: 100, bottom: 40 } + boundaryPadding: { right: 100, bottom: 40 }, + onClick: () => setShowChat(true) }); useEffect(() => { @@ -47,7 +48,6 @@ export default function App() { >