feat: 模型适配

This commit is contained in:
ai-business-hql
2025-08-11 19:25:05 +08:00
parent ebf2a94214
commit a653bb2070
7 changed files with 54 additions and 54 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-BTyByt5y.js","copilot_web/vendor-markdown-BAJQc3l1.js","copilot_web/vendor-react-Dixhfmvb.js","copilot_web/message-components-CydUdrgj.js","copilot_web/input.js","copilot_web/assets/input-DEGzoeyh.css","copilot_web/fonts.css"].map(path => {
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["copilot_web/workflowChat-BI_IxPL_.js","copilot_web/vendor-markdown-BAJQc3l1.js","copilot_web/vendor-react-Dixhfmvb.js","copilot_web/message-components-CT_-IXpQ.js","copilot_web/input.js","copilot_web/assets/input-DEGzoeyh.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 e}from"./vendor-markdown-BAJQc3l1.js";import{r as t,R as i}from"./vendor-react-Dixhfmvb.js";import{C as n}from"./message-components-CydUdrgj.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-BTyByt5y.js")),__vite__mapDeps([0,1,2,3,4,5,6])).then(o=>({default:o.default})));function c(){const[o,r]=t.useState(!1);return t.useEffect(()=>{const l=()=>{r(!0)};return window.addEventListener(s.EXPLAIN_NODE,l),()=>window.removeEventListener(s.EXPLAIN_NODE,l)},[]),e.jsx(n,{children:e.jsx("div",{className:"h-full w-full flex flex-col",children:e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:e.jsx(d,{visible:!0,triggerUsage:o,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 e}from"./vendor-markdown-BAJQc3l1.js";import{r as t,R as i}from"./vendor-react-Dixhfmvb.js";import{C as n}from"./message-components-CT_-IXpQ.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-BI_IxPL_.js")),__vite__mapDeps([0,1,2,3,4,5,6])).then(o=>({default:o.default})));function c(){const[o,r]=t.useState(!1);return t.useEffect(()=>{const l=()=>{r(!0)};return window.addEventListener(s.EXPLAIN_NODE,l),()=>window.removeEventListener(s.EXPLAIN_NODE,l)},[]),e.jsx(n,{children:e.jsx("div",{className:"h-full w-full flex flex-col",children:e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"h-full w-full flex items-center justify-center",children:"Loading..."}),children:e.jsx(d,{visible:!0,triggerUsage:o,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-BAJQc3l1.js";import{r as a}from"./vendor-react-Dixhfmvb.js";import{u as E,B as D,R as O,h,a as x,W as m}from"./message-components-CydUdrgj.js";function $({content:g,name:b="Assistant",avatar:J,onAddMessage:k,onUpdateMessage:c,onFinishLoad:y,messageId:w}){const{dispatch:_,abortControllerRef:d}=E(),[l,S]=a.useState(!1),[T,G]=a.useState(""),[R,j]=a.useState(!1),[C,v]=a.useState(null);a.useEffect(()=>{y?.()},[]);const r=a.useMemo(()=>{try{return JSON.parse(g)}catch(e){return console.error("Failed to parse message content:",e),null}},[g]),f=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])||C,N=async()=>{if(l)return;const e=h(),t={id:e,role:"ai",content:JSON.stringify({text:`🔍 Starting workflow analysis...
import{j as s}from"./vendor-markdown-BAJQc3l1.js";import{r as a}from"./vendor-react-Dixhfmvb.js";import{u as E,B as D,R as O,h,a as x,W as m}from"./message-components-CT_-IXpQ.js";function $({content:g,name:b="Assistant",avatar:J,onAddMessage:k,onUpdateMessage:c,onFinishLoad:y,messageId:w}){const{dispatch:_,abortControllerRef:d}=E(),[l,S]=a.useState(!1),[T,G]=a.useState(""),[R,j]=a.useState(!1),[C,v]=a.useState(null);a.useEffect(()=>{y?.()},[]);const r=a.useMemo(()=>{try{return JSON.parse(g)}catch(e){return console.error("Failed to parse message content:",e),null}},[g]),f=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])||C,N=async()=>{if(l)return;const e=h(),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 I(),_({type:"SET_LOADING",payload:!0}),await A(e)}finally{S(!1)}},I=async()=>{try{const e=await x.graphToPrompt(),t=localStorage.getItem("sessionId")||"";if(t&&e){const n=await m.saveWorkflowCheckpoint(t,e.output,e.workflow,"debug_start");if(v(n.version_id),console.log(`Saved debug start checkpoint: ${n.version_id}`),c&&r){const o=[...r.ext||[]].filter(p=>p.type!=="debug_start_checkpoint"&&!(p.type==="debug_checkpoint"&&p.data?.checkpoint_type==="debug_start"));o.push({type:"debug_start_checkpoint",data:{checkpoint_id:n.version_id,checkpoint_type:"debug_start"}});const u={id:w||h(),role:"ai",content:JSON.stringify({text:r.text,ext:o}),format:"debug_guide",name:"Assistant"};c(u)}}}catch(e){console.error("Failed to save checkpoint before debug:",e)}},A=async e=>{try{const t=await x.graphToPrompt();let n="",i=null;d&&(d.current=new AbortController);for await(const o of m.streamDebugAgent(t,d?.current?.signal||void 0))if(o.text){n=o.text,o.ext&&(i=o.ext);const u={id:e,role:"ai",content:JSON.stringify({text:n,ext:i||[]}),format:"markdown",name:"Assistant",finished:!1,debugGuide:!0};c?.(u)}c?.({id:e,role:"ai",content:JSON.stringify({text:n,ext:i||[]}),format:"markdown",name:"Assistant",finished:!0,debugGuide:!0})}catch(t){console.error("Error calling debug agent:",t),j(!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(D,{name:b,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:N,disabled:l,className:`debug-btn bg-debug-btn text-sm text-[#fff] rounded-lg px-4 py-2 ${l?"cursor-not-allowed":"cursor-pointer"}`,children:l?"Analyzing...":"Debug Errors"})}),s.jsx("div",{className:"flex justify-end mt-2",children:!!f&&s.jsx("div",{className:"ml-2 flex-shrink-0",children:s.jsx(O,{checkpointId:f,onRestore:()=>{console.log("Workflow restored from checkpoint")}})})})]})}):null}export{$ as DebugGuide};
@@ -1,4 +1,4 @@
function getImportPath(filename) {
return `./${filename}`;
}
import{j as e}from"./vendor-markdown-BAJQc3l1.js";import{b as m,c as u,B as w,p as k,R as v}from"./message-components-CydUdrgj.js";import{r as f}from"./vendor-react-Dixhfmvb.js";const j=a=>{const{title:i="",isWorkflowUpdate:x=!1,className:n="",onFinishLoad:c,children:d}=a,[s,r]=f.useState(!1);return f.useEffect(()=>{c?.()},[]),e.jsxs("div",{className:`relative rounded-lg flex flex-col beautify-card ${n} ${s?"":"h-[200px]"}`,children:[e.jsx("div",{className:"card-border rounded-lg"}),e.jsxs("div",{className:"flex flex-1 justify-between items-center pb-2 border-b border-[#29292f]",children:[e.jsx("div",{children:typeof i=="string"?e.jsx("h3",{className:"text-sm text-[#fff] font-medium",children:i}):i}),e.jsx("button",{onClick:()=>{r(!s)},children:s?e.jsx(m,{color:"#E5E7EB"}):e.jsx(u,{color:"#E5E7EB"})})]}),e.jsx("div",{className:"overflow-hidden",children:d})]})};function y({content:a,name:i="Assistant",avatar:x,format:n="markdown",onFinishLoad:c}){const d=()=>{let s=null,r=!1,o;try{if(o=JSON.parse(a),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 p=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-[#fff]",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"})]}),h=r?e.jsx("div",{className:"mt-3 text-xs text-[#fff]/70",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(j,{title:p,isWorkflowUpdate:r,className:"p-4",onFinishLoad:c,children:e.jsxs("div",{className:"prose prose-sm max-w-none",children:[n==="markdown"?e.jsx(k,{response:o||{}}):e.jsx("pre",{className:"whitespace-pre-wrap text-[#fff]/70 text-sm leading-relaxed h-full",children:o?.text||""}),h]})}),e.jsx("div",{className:"flex justify-end mt-2",children:!!s&&e.jsx("div",{className:"ml-2 flex-shrink-0",children:e.jsx(v,{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(w,{name:i,children:d()})}export{y as DebugResult};
import{j as e}from"./vendor-markdown-BAJQc3l1.js";import{b as m,c as u,B as w,p as k,R as v}from"./message-components-CT_-IXpQ.js";import{r as f}from"./vendor-react-Dixhfmvb.js";const j=a=>{const{title:i="",isWorkflowUpdate:x=!1,className:n="",onFinishLoad:c,children:d}=a,[s,r]=f.useState(!1);return f.useEffect(()=>{c?.()},[]),e.jsxs("div",{className:`relative rounded-lg flex flex-col beautify-card ${n} ${s?"":"h-[200px]"}`,children:[e.jsx("div",{className:"card-border rounded-lg"}),e.jsxs("div",{className:"flex flex-1 justify-between items-center pb-2 border-b border-[#29292f]",children:[e.jsx("div",{children:typeof i=="string"?e.jsx("h3",{className:"text-sm text-[#fff] font-medium",children:i}):i}),e.jsx("button",{onClick:()=>{r(!s)},children:s?e.jsx(m,{color:"#E5E7EB"}):e.jsx(u,{color:"#E5E7EB"})})]}),e.jsx("div",{className:"overflow-hidden",children:d})]})};function y({content:a,name:i="Assistant",avatar:x,format:n="markdown",onFinishLoad:c}){const d=()=>{let s=null,r=!1,o;try{if(o=JSON.parse(a),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 p=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-[#fff]",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"})]}),h=r?e.jsx("div",{className:"mt-3 text-xs text-[#fff]/70",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(j,{title:p,isWorkflowUpdate:r,className:"p-4",onFinishLoad:c,children:e.jsxs("div",{className:"prose prose-sm max-w-none",children:[n==="markdown"?e.jsx(k,{response:o||{}}):e.jsx("pre",{className:"whitespace-pre-wrap text-[#fff]/70 text-sm leading-relaxed h-full",children:o?.text||""}),h]})}),e.jsx("div",{className:"flex justify-end mt-2",children:!!s&&e.jsx("div",{className:"ml-2 flex-shrink-0",children:e.jsx(v,{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(w,{name:i,children:d()})}export{y as DebugResult};
@@ -1,7 +1,7 @@
function getImportPath(filename) {
return `./${filename}`;
}
import{j as ue}from"./vendor-markdown-BAJQc3l1.js";import{W as Si,h as Ba,a as Bt}from"./message-components-CydUdrgj.js";import{g as _u,R as Oe,b as Wa,r as g,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 Ba,a as Bt}from"./message-components-CT_-IXpQ.js";import{g as _u,R as Oe,b as Wa,r as g,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
+3 -3
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