feat: showcase changed

This commit is contained in:
ai-business-hql
2025-07-30 17:15:47 +08:00
parent 3049a44944
commit cdfe368880
7 changed files with 40 additions and 40 deletions
@@ -1,7 +1,7 @@
function getImportPath(filename) {
return `./${filename}`;
}
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-nsr95Ko6.js","copilot_web/vendor-markdown-CBmlBP6m.js","copilot_web/vendor-react-Dixhfmvb.js","copilot_web/message-components-wGrDwG40.js","copilot_web/input.js","copilot_web/assets/input-CfsjJHJn.css","copilot_web/fonts.css"].map(path => {
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-DP6Ois-Q.js","copilot_web/vendor-markdown-CBmlBP6m.js","copilot_web/vendor-react-Dixhfmvb.js","copilot_web/message-components-wGrDwG40.js","copilot_web/input.js","copilot_web/assets/input-CfsjJHJn.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-CBmlBP6m.js";import{r as t,R as i}from"./vendor-react-Dixhfmvb.js";import{C as n}from"./message-components-wGrDwG40.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-nsr95Ko6.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-CBmlBP6m.js";import{r as t,R as i}from"./vendor-react-Dixhfmvb.js";import{C as n}from"./message-components-wGrDwG40.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-DP6Ois-Q.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,5 +1,5 @@
function getImportPath(filename) {
return `./${filename}`;
}
import{j as s}from"./vendor-markdown-CBmlBP6m.js";import{r as a}from"./vendor-react-Dixhfmvb.js";import{B as I,g as f,a as m,W as h}from"./message-components-wGrDwG40.js";import{R as E}from"./RestoreCheckpoint-DjY-ON6-.js";import"./workflowChat-nsr95Ko6.js";import"./input.js";/* empty css */import"./App-BxOHH2B6.js";function F({content:p,name:x="Assistant",avatar:A,onAddMessage:k,onUpdateMessage:c,onFinishLoad:b,messageId:y}){const[l,w]=a.useState(!1),[D,O]=a.useState(""),[J,_]=a.useState(!1),[S,j]=a.useState(null);a.useEffect(()=>{b?.()},[]);const r=a.useMemo(()=>{try{return JSON.parse(p)}catch(e){return console.error("Failed to parse message content:",e),null}},[p]),g=a.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])||S,v=async()=>{if(l)return;const e=f(),t={id:e,role:"ai",content:JSON.stringify({text:`🔍 Starting workflow analysis...
import{j as s}from"./vendor-markdown-CBmlBP6m.js";import{r as a}from"./vendor-react-Dixhfmvb.js";import{B as I,g as f,a as m,W as h}from"./message-components-wGrDwG40.js";import{R as E}from"./RestoreCheckpoint-C5z5_f1p.js";import"./workflowChat-DP6Ois-Q.js";import"./input.js";/* empty css */import"./App-KLDVqLzq.js";function F({content:p,name:x="Assistant",avatar:A,onAddMessage:k,onUpdateMessage:c,onFinishLoad:b,messageId:y}){const[l,w]=a.useState(!1),[D,O]=a.useState(""),[J,_]=a.useState(!1),[S,j]=a.useState(null);a.useEffect(()=>{b?.()},[]);const r=a.useMemo(()=>{try{return JSON.parse(p)}catch(e){return console.error("Failed to parse message content:",e),null}},[p]),g=a.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])||S,v=async()=>{if(l)return;const e=f(),t={id:e,role:"ai",content:JSON.stringify({text:`🔍 Starting workflow analysis...
`,ext:[]}),format:"markdown",name:"Assistant",finished:!1,debugGuide:!0};k?.(t);try{await N(),await C(e)}finally{w(!1)}},N=async()=>{try{const e=await m.graphToPrompt(),t=localStorage.getItem("sessionId")||"";if(t&&e){const o=await h.saveWorkflowCheckpoint(t,e.output,e.workflow,"debug_start");if(j(o.version_id),console.log(`Saved debug start checkpoint: ${o.version_id}`),c&&r){const n=[...r.ext||[]].filter(u=>u.type!=="debug_start_checkpoint"&&!(u.type==="debug_checkpoint"&&u.data?.checkpoint_type==="debug_start"));n.push({type:"debug_start_checkpoint",data:{checkpoint_id:o.version_id,checkpoint_type:"debug_start"}});const d={id:y||f(),role:"ai",content:JSON.stringify({text:r.text,ext:n}),format:"debug_guide",name:"Assistant"};c(d)}}}catch(e){console.error("Failed to save checkpoint before debug:",e)}},C=async e=>{try{const t=await m.graphToPrompt();let o="",i=null;for await(const n of h.streamDebugAgent(t))if(n.text){o=n.text,n.ext&&(i=n.ext);const d={id:e,role:"ai",content:JSON.stringify({text:o,ext:i||[]}),format:"markdown",name:"Assistant",finished:!1,debugGuide:!0};c?.(d)}c?.({id:e,role:"ai",content:JSON.stringify({text:o,ext:i||[]}),format:"markdown",name:"Assistant",finished:!0,debugGuide:!0})}catch(t){console.error("Error calling debug agent:",t),_(!1);const i={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?.(i)}};return r?s.jsx(I,{name:x,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 mt-4",children:s.jsx("button",{onClick:v,disabled:l,className:`px-4 py-2 text-white text-sm rounded-md transition-colors ${l?"bg-gray-400 cursor-not-allowed":"bg-blue-500 hover:bg-blue-600"}`,children:l?"Analyzing...":"Debug Errors"})}),s.jsx("div",{className:"flex justify-end mt-2",children:!!g&&s.jsx("div",{className:"ml-2 flex-shrink-0",children:s.jsx(E,{checkpointId:g,onRestore:()=>{console.log("Workflow restored from checkpoint")}})})})]})}):null}export{F as DebugGuide};
@@ -1,4 +1,4 @@
function getImportPath(filename) {
return `./${filename}`;
}
import{j as e}from"./vendor-markdown-CBmlBP6m.js";import{r as o}from"./vendor-react-Dixhfmvb.js";import{B as v}from"./message-components-wGrDwG40.js";import{R as b}from"./RestoreCheckpoint-DjY-ON6-.js";import{C as y,a as N}from"./workflowChat-nsr95Ko6.js";import"./input.js";/* empty css */import"./App-BxOHH2B6.js";const _=c=>{const{title:i="",isWorkflowUpdate:u=!1,className:d="",children:x}=c,[n,f]=o.useState(!1),l=u?"#166534":"#E5E7EB";return e.jsxs("div",{className:`relative shadow-gray-200 dark:shadow-gray-600 rounded-lg p-2 overflow-hidden ${d} ${n?"h-auto":"h-[200px]"}`,children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("div",{children:typeof i=="string"?e.jsx("h3",{className:"text-sm text-gray-900 dark:text-white font-medium",children:i}):i}),e.jsx("button",{onClick:()=>f(!n),children:n?e.jsx(y,{color:l}):e.jsx(N,{color:l})})]}),e.jsx("div",{className:"dark:border-gray-700",children:x}),!n&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-40 w-full z-5 bg-gradient-to-t from-[#fff] to-transparent"})]})};function W({content:c,name:i="Assistant",avatar:u,format:d="markdown",onFinishLoad:x}){o.useEffect(()=>{x?.()},[]);const[n,f]=o.useState(null),[l,m]=o.useState(null),[s,p]=o.useState(!1);o.useEffect(()=>{try{const r=JSON.parse(c);if(f(r),r.ext){let t=r.ext.find(a=>a.type==="workflow_rewrite_checkpoint"||a.type==="debug_checkpoint"&&a.data?.checkpoint_type==="workflow_rewrite_start");t&&t.data&&t.data.checkpoint_id?(m(t.data.checkpoint_id),p(!0)):(t=r.ext.find(a=>a.type==="workflow_rewrite_complete"),t&&t.data&&t.data.version_id?(m(t.data.version_id),p(!0)):(t=r.ext.find(a=>a.type==="debug_checkpoint"),t&&t.data&&t.data.checkpoint_id&&(m(t.data.checkpoint_id),p(!1)))),r.ext.find(a=>a.type==="workflow_update")&&p(!0)}}catch(r){console.error("Failed to parse DebugResult content:",r)}},[c]);const g=r=>d==="markdown"?r.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,'<code class="bg-gray-100 px-1 rounded">$1</code>').replace(/\n/g,"<br/>"):r,w=o.useMemo(()=>s?"bg-green-50 border border-green-200":"bg-gray-100",[s]),h=o.useMemo(()=>s?"text-green-700 text-sm leading-relaxed":"text-gray-700 text-sm leading-relaxed",[s]),k=o.useMemo(()=>s?e.jsxs("div",{className:"flex items-center",children:[e.jsx("svg",{className:"w-5 h-5 text-green-600 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:"text-green-800 font-medium",children:"Workflow Updated Successfully"})]}):null,[s]),j=o.useMemo(()=>s?e.jsx("div",{className:"mt-3 text-xs text-green-600",children:"💡 If you're not satisfied with the changes, click the restore button to revert to the previous version."}):null,[s]);return n?e.jsx(v,{name:i,children:e.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[e.jsx(_,{title:k,isWorkflowUpdate:s,className:w,children:e.jsxs("div",{className:"flex-1 prose prose-sm max-w-none",children:[d==="markdown"?e.jsx("div",{className:h,dangerouslySetInnerHTML:{__html:g(n.text||"")}}):e.jsx("pre",{className:`whitespace-pre-wrap ${h}`,children:n.text||""}),j]})}),e.jsx("div",{className:"flex justify-end mt-2",children:!!l&&e.jsx("div",{className:"ml-2 flex-shrink-0",children:e.jsx(b,{checkpointId:l,onRestore:()=>{console.log(`Workflow restored from ${s?"workflow update":"debug"} checkpoint`)},title:s?`Restore to this version (Version ${l})`:`Restore checkpoint ${l}`})})})]})}):null}export{W as DebugResult};
import{j as e}from"./vendor-markdown-CBmlBP6m.js";import{r as o}from"./vendor-react-Dixhfmvb.js";import{B as v}from"./message-components-wGrDwG40.js";import{R as b}from"./RestoreCheckpoint-C5z5_f1p.js";import{C as y,a as N}from"./workflowChat-DP6Ois-Q.js";import"./input.js";/* empty css */import"./App-KLDVqLzq.js";const _=c=>{const{title:i="",isWorkflowUpdate:u=!1,className:d="",children:x}=c,[n,f]=o.useState(!1),l=u?"#166534":"#E5E7EB";return e.jsxs("div",{className:`relative shadow-gray-200 dark:shadow-gray-600 rounded-lg p-2 overflow-hidden ${d} ${n?"h-auto":"h-[200px]"}`,children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("div",{children:typeof i=="string"?e.jsx("h3",{className:"text-sm text-gray-900 dark:text-white font-medium",children:i}):i}),e.jsx("button",{onClick:()=>f(!n),children:n?e.jsx(y,{color:l}):e.jsx(N,{color:l})})]}),e.jsx("div",{className:"dark:border-gray-700",children:x}),!n&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-40 w-full z-5 bg-gradient-to-t from-[#fff] to-transparent"})]})};function W({content:c,name:i="Assistant",avatar:u,format:d="markdown",onFinishLoad:x}){o.useEffect(()=>{x?.()},[]);const[n,f]=o.useState(null),[l,m]=o.useState(null),[s,p]=o.useState(!1);o.useEffect(()=>{try{const r=JSON.parse(c);if(f(r),r.ext){let t=r.ext.find(a=>a.type==="workflow_rewrite_checkpoint"||a.type==="debug_checkpoint"&&a.data?.checkpoint_type==="workflow_rewrite_start");t&&t.data&&t.data.checkpoint_id?(m(t.data.checkpoint_id),p(!0)):(t=r.ext.find(a=>a.type==="workflow_rewrite_complete"),t&&t.data&&t.data.version_id?(m(t.data.version_id),p(!0)):(t=r.ext.find(a=>a.type==="debug_checkpoint"),t&&t.data&&t.data.checkpoint_id&&(m(t.data.checkpoint_id),p(!1)))),r.ext.find(a=>a.type==="workflow_update")&&p(!0)}}catch(r){console.error("Failed to parse DebugResult content:",r)}},[c]);const g=r=>d==="markdown"?r.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,'<code class="bg-gray-100 px-1 rounded">$1</code>').replace(/\n/g,"<br/>"):r,w=o.useMemo(()=>s?"bg-green-50 border border-green-200":"bg-gray-100",[s]),h=o.useMemo(()=>s?"text-green-700 text-sm leading-relaxed":"text-gray-700 text-sm leading-relaxed",[s]),k=o.useMemo(()=>s?e.jsxs("div",{className:"flex items-center",children:[e.jsx("svg",{className:"w-5 h-5 text-green-600 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:"text-green-800 font-medium",children:"Workflow Updated Successfully"})]}):null,[s]),j=o.useMemo(()=>s?e.jsx("div",{className:"mt-3 text-xs text-green-600",children:"💡 If you're not satisfied with the changes, click the restore button to revert to the previous version."}):null,[s]);return n?e.jsx(v,{name:i,children:e.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[e.jsx(_,{title:k,isWorkflowUpdate:s,className:w,children:e.jsxs("div",{className:"flex-1 prose prose-sm max-w-none",children:[d==="markdown"?e.jsx("div",{className:h,dangerouslySetInnerHTML:{__html:g(n.text||"")}}):e.jsx("pre",{className:`whitespace-pre-wrap ${h}`,children:n.text||""}),j]})}),e.jsx("div",{className:"flex justify-end mt-2",children:!!l&&e.jsx("div",{className:"ml-2 flex-shrink-0",children:e.jsx(b,{checkpointId:l,onRestore:()=>{console.log(`Workflow restored from ${s?"workflow update":"debug"} checkpoint`)},title:s?`Restore to this version (Version ${l})`:`Restore checkpoint ${l}`})})})]})}):null}export{W as DebugResult};
@@ -1,7 +1,7 @@
function getImportPath(filename) {
return `./${filename}`;
}
import{j as a}from"./vendor-markdown-CBmlBP6m.js";import{r as d}from"./vendor-react-Dixhfmvb.js";import{W as f,a as n}from"./message-components-wGrDwG40.js";import{c as p}from"./workflowChat-nsr95Ko6.js";/**
import{j as a}from"./vendor-markdown-CBmlBP6m.js";import{r as d}from"./vendor-react-Dixhfmvb.js";import{W as f,a as n}from"./message-components-wGrDwG40.js";import{c as p}from"./workflowChat-DP6Ois-Q.js";/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
+2 -2
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long