@alicloud/appflow-chat 0.0.6 → 0.0.7

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.
@@ -1191,7 +1191,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1191
1191
  &:hover {
1192
1192
  background: #f5f5f5;
1193
1193
  }
1194
- `,So=({text:e=""})=>C.jsx(V_,{children:C.jsx("span",{children:e})}),B4=()=>new Promise((e,t)=>{if(typeof window!="undefined"&&window.mermaid){e();return}R4("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.0/mermaid.min.js").then(()=>{window.mermaid.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"}),e()}).catch(n=>{console.error("mermaid加载失败:",n),t(n)})});let W_=0;const G_=()=>`mermaid-${Date.now()}-${W_++}`,X_=e=>{if(!e||e.trim().length<10)return!1;const t=e.trim();return["graph","flowchart","sequenceDiagram","classDiagram","stateDiagram","erDiagram","journey","gantt","pie","quadrantChart","requirementDiagram","gitGraph","mindmap","timeline"].some(i=>t.startsWith(i)||t.match(new RegExp(`^${i}\\s`,"m")))?/(\w+\s*-->|\w+\s*---|\w+\s*-\.->|\w+\s*==>|\w+\s*\[.*?\]|\w+\s*\(.*?\)|participant\s+\w+|\w+\s*->>)/m.test(t):!1},K_=({code:e})=>{const{t}=gt(),r=K.useRef(null),[n,a]=K.useState(""),[i,s]=K.useState(""),[o,u]=K.useState(!0),[l,c]=K.useState(!1),[f,p]=K.useState(!0),h=K.useRef(""),b=K.useRef(null),y=K.useRef(null);return K.useEffect(()=>(He(exports,null,function*(){try{yield B4(),c(!0)}catch(x){console.error("mermaid加载失败:",x),s(t("markdown.mermaidLoadFailed")),u(!1)}}),()=>{b.current&&clearTimeout(b.current),y.current&&clearTimeout(y.current)}),[]),K.useEffect(()=>{if(!e||!l)return;const T=window.mermaid;if(!T){s(t("markdown.mermaidNotLoaded")),u(!1);return}const x=e!==h.current;if(h.current=e,x&&(p(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{p(!1)},500)),!X_(e)){u(!0),s("");return}return b.current&&clearTimeout(b.current),b.current=setTimeout(()=>He(exports,null,function*(){u(!0),s("");try{const w=G_(),{svg:I}=yield T.render(w,e.trim());a(I),s("");const L=document.getElementById(w);L&&L.remove()}catch(w){document.querySelectorAll('[id^="dmermaid-"]').forEach(L=>L.remove()),f?console.log("Mermaid 流式输出中,暂不显示错误"):(console.error("Mermaid 渲染错误:",w),s((w==null?void 0:w.message)||t("markdown.mermaidRenderFailed")))}finally{u(!1)}}),300),()=>{b.current&&clearTimeout(b.current)}},[e,l,f]),o?C.jsx("div",{style:{width:"100%",minHeight:"100px",padding:"20px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed #d9d9d9",borderRadius:"6px",color:"#666",backgroundColor:"#fafafa",marginTop:"10px",marginBottom:"10px"},children:t("markdown.chartLoading")}):i&&!f?C.jsxs("div",{style:{width:"100%",padding:"20px",border:"1px solid #ffccc7",borderRadius:"6px",color:"#cf1322",backgroundColor:"#fff2f0",marginTop:"10px",marginBottom:"10px"},children:[C.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:t("markdown.mermaidRenderFailed")}),C.jsx("div",{style:{fontSize:"12px",color:"#666",wordBreak:"break-word",overflowWrap:"break-word",whiteSpace:"pre-wrap"},children:i})]}):i&&f?C.jsx("div",{style:{width:"100%",minHeight:"100px",padding:"20px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed #d9d9d9",borderRadius:"6px",color:"#666",backgroundColor:"#fafafa",marginTop:"10px",marginBottom:"10px"},children:t("markdown.chartLoading")}):C.jsx("div",{ref:r,style:{width:"100%",overflow:"auto",marginTop:"10px",marginBottom:"10px",padding:"10px",backgroundColor:"#fff",borderRadius:"6px",border:"1px solid #e8e8e8"},dangerouslySetInnerHTML:{__html:n}})},Zt=({content:e,waitingMessage:t=""})=>{const{t:r}=gt(),n=K.useMemo(()=>({remarkPlugins:[KE,nv,YS],rehypePlugins:[Dv,jS],components:{img:c=>{var f=c,{node:u}=f,l=ki(f,["node"]);return C.jsx(ve.Image,{style:{maxWidth:"100%",maxHeight:"600px"},src:l.src,alt:l.alt,preview:{zIndex:1100}})},code:p=>{var h=p,{node:u,inline:l,className:c}=h,f=ki(h,["node","inline","className"]);var w,I,L,P,M;if(l||!c&&!((w=u==null?void 0:u.properties)!=null&&w.className))return C.jsx("code",{style:{backgroundColor:"rgba(175, 184, 193, 0.2)",padding:"0.2em 0.4em",borderRadius:"3px",fontSize:"85%",fontFamily:'Consolas, Monaco, "Andale Mono", monospace'},children:f.children});const y=(L=/language-(\w+)/.exec(((I=u==null?void 0:u.properties)==null?void 0:I.className)||c||""))==null?void 0:L[0],T=((M=(P=u==null?void 0:u.position)==null?void 0:P.start)==null?void 0:M.line)===2?"language-file":null,x=y||T;if(x==="language-file"){const z=String(f.children).replace(/\n$/,""),B=o(z);return C.jsx(B_,{fileInfo:B})}if(x==="language-ant_table")try{const z=String(f==null?void 0:f.children).replace(/\n$/,""),B=JSON.parse(z),$=ac(B);return C.jsx(Zt,{content:$})}catch(z){return a(String(f==null?void 0:f.children))?(console.error("ant_table数据解析错误:",z),C.jsx(So,{text:r("markdown.tableLoadFailed")})):C.jsx(Gi,{text:r("markdown.tableLoading")})}if(x==="language-echarts")try{const z=Array.isArray(f.children)?f.children.join(""):f.children.toString();if(!a(z))return C.jsx(Gi,{});const B=JSON.parse(z);let $;try{return typeof(B==null?void 0:B.option)=="string"?$=JSON.parse(B==null?void 0:B.option):$=B==null?void 0:B.option,!$||Object.keys($).length===0?C.jsx(Gi,{}):C.jsx("div",{style:{minWidth:"300px"},children:C.jsx(j_,{options:$})})}catch(D){return console.error("图表配置解析错误:",D),C.jsx(So,{text:r("markdown.chartLoadFailed")})}}catch(z){return a(String(f.children))?(console.error("图表数据解析错误:",z),C.jsx(So,{text:r("markdown.chartLoadFailed")})):C.jsx(Gi,{})}if(x==="language-mermaid"){const z=String(f.children).replace(/\n$/,"");return C.jsx(K_,{code:z})}return C.jsx(Bv,{children:f.children})},p:u=>{var c,f,p;const{node:l}=u||{};if(((c=l==null?void 0:l.children[0])==null?void 0:c.tagName)==="img"){const h=l.children[0],b=Array.isArray(u==null?void 0:u.children)||typeof((f=u==null?void 0:u.children)==null?void 0:f.slice)=="function";return C.jsxs(C.Fragment,{children:[C.jsx(ve.Image,{style:{maxWidth:"100%",maxHeight:"600px"},src:h.properties.src,className:"max-w-full h-auto align-middle border-none rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 ease-in-out mt-2 mb-2",alt:h.properties.alt,preview:{zIndex:1100}}),b&&C.jsx("p",{children:(p=u==null?void 0:u.children)==null?void 0:p.slice(1)})]})}return C.jsx("p",{children:u==null?void 0:u.children})},a:({children:u,href:l})=>C.jsx("a",{href:l,target:"_blank",children:u})}}),[r]),a=u=>{try{const l=u==null?void 0:u.trim()[0],c=u==null?void 0:u.trim()[(u==null?void 0:u.trim().length)-1];return l==="{"&&c==="}"||l==="["&&c==="]"}catch(l){return!1}},i=u=>{const l=r("markdown.deepThinking");return u==null?void 0:u.replace(/<think>([\s\S]*?)<\/think>/g,`<details open><summary>${l}</summary><pre class="think">$1</pre></details>
1194
+ `,So=({text:e=""})=>C.jsx(V_,{children:C.jsx("span",{children:e})}),B4=()=>new Promise((e,t)=>{if(typeof window!="undefined"&&window.mermaid){e();return}R4("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.0/mermaid.min.js").then(()=>{window.mermaid.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"}),e()}).catch(n=>{console.error("mermaid加载失败:",n),t(n)})});let W_=0;const G_=()=>`mermaid-${Date.now()}-${W_++}`,X_=e=>{if(!e||e.trim().length<10)return!1;const t=e.trim();return["graph","flowchart","sequenceDiagram","classDiagram","stateDiagram","erDiagram","journey","gantt","pie","quadrantChart","requirementDiagram","gitGraph","mindmap","timeline"].some(i=>t.startsWith(i)||t.match(new RegExp(`^${i}\\s`,"m")))?/(\w+\s*-->|\w+\s*---|\w+\s*-\.->|\w+\s*==>|\w+\s*\[.*?\]|\w+\s*\(.*?\)|participant\s+\w+|\w+\s*->>)/m.test(t):!1},K_=({code:e})=>{const{t}=gt(),r=K.useRef(null),[n,a]=K.useState(""),[i,s]=K.useState(""),[o,u]=K.useState(!0),[l,c]=K.useState(!1),[f,p]=K.useState(!0),h=K.useRef(""),b=K.useRef(null),y=K.useRef(null);return K.useEffect(()=>(He(exports,null,function*(){try{yield B4(),c(!0)}catch(x){console.error("mermaid加载失败:",x),s(t("markdown.mermaidLoadFailed")),u(!1)}}),()=>{b.current&&clearTimeout(b.current),y.current&&clearTimeout(y.current)}),[]),K.useEffect(()=>{if(!e||!l)return;const T=window.mermaid;if(!T){s(t("markdown.mermaidNotLoaded")),u(!1);return}const x=e!==h.current;if(h.current=e,x&&(p(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{p(!1)},500)),!X_(e)){u(!0),s("");return}return b.current&&clearTimeout(b.current),b.current=setTimeout(()=>He(exports,null,function*(){u(!0),s("");try{const w=G_(),{svg:I}=yield T.render(w,e.trim());a(I),s("");const L=document.getElementById(w);L&&L.remove()}catch(w){document.querySelectorAll('[id^="dmermaid-"]').forEach(L=>L.remove()),f?console.log("Mermaid 流式输出中,暂不显示错误"):(console.error("Mermaid 渲染错误:",w),s((w==null?void 0:w.message)||t("markdown.mermaidRenderFailed")))}finally{u(!1)}}),300),()=>{b.current&&clearTimeout(b.current)}},[e,l,f]),o?C.jsx("div",{style:{width:"100%",minHeight:"100px",padding:"20px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed #d9d9d9",borderRadius:"6px",color:"#666",backgroundColor:"#fafafa",marginTop:"10px",marginBottom:"10px"},children:t("markdown.chartLoading")}):i&&!f?C.jsxs("div",{style:{width:"100%",padding:"20px",border:"1px solid #ffccc7",borderRadius:"6px",color:"#cf1322",backgroundColor:"#fff2f0",marginTop:"10px",marginBottom:"10px"},children:[C.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:t("markdown.mermaidRenderFailed")}),C.jsx("div",{style:{fontSize:"12px",color:"#666",wordBreak:"break-word",overflowWrap:"break-word",whiteSpace:"pre-wrap"},children:i})]}):i&&f?C.jsx("div",{style:{width:"100%",minHeight:"100px",padding:"20px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed #d9d9d9",borderRadius:"6px",color:"#666",backgroundColor:"#fafafa",marginTop:"10px",marginBottom:"10px"},children:t("markdown.chartLoading")}):C.jsx("div",{ref:r,style:{width:"100%",overflow:"auto",marginTop:"10px",marginBottom:"10px",padding:"10px",backgroundColor:"#fff",borderRadius:"6px",border:"1px solid #e8e8e8"},dangerouslySetInnerHTML:{__html:n}})},Zt=({content:e,waitingMessage:t=""})=>{const{t:r}=gt(),n=K.useMemo(()=>({remarkPlugins:[KE,nv,YS],rehypePlugins:[Dv,jS],components:{img:c=>{var f=c,{node:u}=f,l=ki(f,["node"]);return C.jsx(ve.Image,{style:{maxWidth:"100%",maxHeight:"600px"},src:l.src,alt:l.alt,referrerPolicy:"no-referrer",preview:{zIndex:1100}})},code:p=>{var h=p,{node:u,inline:l,className:c}=h,f=ki(h,["node","inline","className"]);var w,I,L,P,M;if(l||!c&&!((w=u==null?void 0:u.properties)!=null&&w.className))return C.jsx("code",{style:{backgroundColor:"rgba(175, 184, 193, 0.2)",padding:"0.2em 0.4em",borderRadius:"3px",fontSize:"85%",fontFamily:'Consolas, Monaco, "Andale Mono", monospace'},children:f.children});const y=(L=/language-(\w+)/.exec(((I=u==null?void 0:u.properties)==null?void 0:I.className)||c||""))==null?void 0:L[0],T=((M=(P=u==null?void 0:u.position)==null?void 0:P.start)==null?void 0:M.line)===2?"language-file":null,x=y||T;if(x==="language-file"){const z=String(f.children).replace(/\n$/,""),B=o(z);return C.jsx(B_,{fileInfo:B})}if(x==="language-ant_table")try{const z=String(f==null?void 0:f.children).replace(/\n$/,""),B=JSON.parse(z),$=ac(B);return C.jsx(Zt,{content:$})}catch(z){return a(String(f==null?void 0:f.children))?(console.error("ant_table数据解析错误:",z),C.jsx(So,{text:r("markdown.tableLoadFailed")})):C.jsx(Gi,{text:r("markdown.tableLoading")})}if(x==="language-echarts")try{const z=Array.isArray(f.children)?f.children.join(""):f.children.toString();if(!a(z))return C.jsx(Gi,{});const B=JSON.parse(z);let $;try{return typeof(B==null?void 0:B.option)=="string"?$=JSON.parse(B==null?void 0:B.option):$=B==null?void 0:B.option,!$||Object.keys($).length===0?C.jsx(Gi,{}):C.jsx("div",{style:{minWidth:"300px"},children:C.jsx(j_,{options:$})})}catch(D){return console.error("图表配置解析错误:",D),C.jsx(So,{text:r("markdown.chartLoadFailed")})}}catch(z){return a(String(f.children))?(console.error("图表数据解析错误:",z),C.jsx(So,{text:r("markdown.chartLoadFailed")})):C.jsx(Gi,{})}if(x==="language-mermaid"){const z=String(f.children).replace(/\n$/,"");return C.jsx(K_,{code:z})}return C.jsx(Bv,{children:f.children})},p:u=>{var c,f,p;const{node:l}=u||{};if(((c=l==null?void 0:l.children[0])==null?void 0:c.tagName)==="img"){const h=l.children[0],b=Array.isArray(u==null?void 0:u.children)||typeof((f=u==null?void 0:u.children)==null?void 0:f.slice)=="function";return C.jsxs(C.Fragment,{children:[C.jsx(ve.Image,{style:{maxWidth:"100%",maxHeight:"600px"},src:h.properties.src,className:"max-w-full h-auto align-middle border-none rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 ease-in-out mt-2 mb-2",alt:h.properties.alt,referrerPolicy:"no-referrer",preview:{zIndex:1100}}),b&&C.jsx("p",{children:(p=u==null?void 0:u.children)==null?void 0:p.slice(1)})]})}return C.jsx("p",{children:u==null?void 0:u.children})},a:({children:u,href:l})=>C.jsx("a",{href:l,target:"_blank",children:u})}}),[r]),a=u=>{try{const l=u==null?void 0:u.trim()[0],c=u==null?void 0:u.trim()[(u==null?void 0:u.trim().length)-1];return l==="{"&&c==="}"||l==="["&&c==="]"}catch(l){return!1}},i=u=>{const l=r("markdown.deepThinking");return u==null?void 0:u.replace(/<think>([\s\S]*?)<\/think>/g,`<details open><summary>${l}</summary><pre class="think">$1</pre></details>
1195
1195
 
1196
1196
  `)},s=u=>{if(!u)return`<span><span class="prompt-message">${t}</span><span class="prompt-loading-cursor">...</span></span>`;const l=`${u==null?void 0:u.replace(new RegExp("\\\\\\[.*?\\\\\\]","gims"),c=>c.split(/[\r\n]/g)[0].trim()==="\\["?"$$"+c.slice(2,-2)+"$$":"$"+c.slice(2,-2)+"$").replace(new RegExp("\\\\\\(.*?\\\\\\)","gims"),c=>"$"+c.slice(2,-2)+"$")}`;return i(l)},o=u=>{const l=u.split(`
1197
1197
  `),c={name:"",size:"",type:"unknown"};return l.forEach(f=>{const[p,h]=f.split(":").map(b=>b.trim());p&&h&&(p.toLowerCase()==="名称"&&(c.name=h),p.toLowerCase()==="大小"&&(c.size=h),p.toLowerCase()==="类型"&&(c.type=h))}),c};return C.jsx(VS,{children:C.jsx(B9,it(re({},n),{children:`${s(e)}`}))})},Q_=ue.div`
@@ -1430,7 +1430,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1430
1430
  color: #707279;
1431
1431
  font-size: 12px;
1432
1432
  min-width: 60px;
1433
- `,FN=({item:e,isPageConfig:t,onClick:r})=>{const n=t?e.Index:e.index,a=t?e.Title:e.title;return C.jsx(NN,{onClick:()=>r(e),children:C.jsxs(ON,{children:[n&&C.jsx(RN,{children:n}),a&&C.jsx(DN,{children:a})]})})},W4=({items:e,status:t="Success",isPageConfig:r=!1,onItemClick:n,onWebSearchClick:a,className:i,style:s})=>{const{t:o}=gt(),u=K.useMemo(()=>{var b,y;let h;return r?h=(b=e==null?void 0:e.filter(T=>T.Images))==null?void 0:b.map(T=>T.Images):h=(y=e==null?void 0:e.filter(T=>T.images))==null?void 0:y.map(T=>T.images),_N(EN(h))},[e,r]),l=K.useMemo(()=>r?(e==null?void 0:e.filter(h=>h.Type==="rag"))||[]:(e==null?void 0:e.filter(h=>h.type==="rag"))||[],[e,r]),c=K.useMemo(()=>r?(e==null?void 0:e.filter(h=>h.Type==="web_search"))||[]:(e==null?void 0:e.filter(h=>h.type==="web_search"))||[],[e,r]),f=h=>{n==null||n(h)},p=()=>{a==null||a(c)};return t!=="Success"?null:C.jsxs(IN,{className:i,style:s,children:[c.length>0&&C.jsxs(PN,{onClick:p,children:[C.jsx(ur.SearchOutlined,{}),C.jsx("div",{children:o("webSearch.foundPages",{count:c.length})})]}),l.length>0&&C.jsxs(Dd,{children:[C.jsx(Ld,{children:o("source.answerFrom")}),C.jsx("div",{style:{width:"calc(100% - 70px)"},children:l.map((h,b)=>C.jsx(FN,{item:h,isPageConfig:r,onClick:f},b))})]}),u.length>0&&C.jsxs(Dd,{children:[C.jsx(Ld,{children:o("source.imageFrom")}),C.jsx(LN,{children:u.map((h,b)=>C.jsx(MN,{children:C.jsx(ve.Image,{src:h,width:50,height:50,preview:{zIndex:1100}})},b))})]})]})},{Title:BN}=ve.Typography,zN=ue.div`
1433
+ `,FN=({item:e,isPageConfig:t,onClick:r})=>{const n=t?e.Index:e.index,a=t?e.Title:e.title;return C.jsx(NN,{onClick:()=>r(e),children:C.jsxs(ON,{children:[n&&C.jsx(RN,{children:n}),a&&C.jsx(DN,{children:a})]})})},W4=({items:e,status:t="Success",isPageConfig:r=!1,onItemClick:n,onWebSearchClick:a,className:i,style:s})=>{const{t:o}=gt(),u=K.useMemo(()=>{var b,y;let h;return r?h=(b=e==null?void 0:e.filter(T=>T.Images))==null?void 0:b.map(T=>T.Images):h=(y=e==null?void 0:e.filter(T=>T.images))==null?void 0:y.map(T=>T.images),_N(EN(h))},[e,r]),l=K.useMemo(()=>r?(e==null?void 0:e.filter(h=>h.Type==="rag"))||[]:(e==null?void 0:e.filter(h=>h.type==="rag"))||[],[e,r]),c=K.useMemo(()=>r?(e==null?void 0:e.filter(h=>h.Type==="web_search"))||[]:(e==null?void 0:e.filter(h=>h.type==="web_search"))||[],[e,r]),f=h=>{n==null||n(h)},p=()=>{a==null||a(c)};return t!=="Success"?null:C.jsxs(IN,{className:i,style:s,children:[c.length>0&&C.jsxs(PN,{onClick:p,children:[C.jsx(ur.SearchOutlined,{}),C.jsx("div",{children:o("webSearch.foundPages",{count:c.length})})]}),l.length>0&&C.jsxs(Dd,{children:[C.jsx(Ld,{children:o("source.answerFrom")}),C.jsx("div",{style:{width:"calc(100% - 70px)"},children:l.map((h,b)=>C.jsx(FN,{item:h,isPageConfig:r,onClick:f},b))})]}),u.length>0&&C.jsxs(Dd,{children:[C.jsx(Ld,{children:o("source.imageFrom")}),C.jsx(LN,{children:u.map((h,b)=>C.jsx(MN,{children:C.jsx(ve.Image,{src:h,width:50,height:50,referrerPolicy:"no-referrer",preview:{zIndex:1100}})},b))})]})]})},{Title:BN}=ve.Typography,zN=ue.div`
1434
1434
  height: 100%;
1435
1435
  display: flex;
1436
1436
  flex-direction: column;
@@ -1927,7 +1927,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1927
1927
  display: flex;
1928
1928
  flex-wrap: wrap;
1929
1929
  gap: 8px;
1930
- `,WO=({content:e,role:t="bot",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:o,eventType:u,humanVerifyData:l,historyCardData:c,onHumanVerifySubmit:f})=>{const{t:p}=gt(),[h,b]=ve.Modal.useModal(),[y,T]=K.useState(!1),[x,w]=K.useState([]);K.useEffect(()=>{e!=null&&e.includes("```echarts")&&yi().catch(console.error)},[e]);const I=K.useCallback(B=>{const $=B.Title||B.title,D=B.Text||B.text,H=B.Images||B.images;h.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:p("source.title"),destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:C.jsxs(ve.Space,{direction:"vertical",style:{width:"100%"},children:[C.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[$&&C.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:$}),D&&C.jsx("div",{children:D})]}),H&&H.length>0&&C.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:C.jsx(VO,{children:H.map((W,ye)=>C.jsx(ve.Image,{src:W,height:50},ye))})})]}),footer:null})},[h,p]),L=K.useCallback(B=>{w(B),T(!0)},[]),P=K.useCallback(()=>{T(!1)},[]),M=s||I,z=o||L;return C.jsxs(C.Fragment,{children:[C.jsx($O,{$role:t,className:`appflow-sdk-message-bubble ${a||""}`,style:i,children:C.jsxs(qO,{$role:t,children:[C.jsxs(z4,{content:e,status:r,role:t,children:[u==="humanVerify"&&l&&C.jsx(Q4,{data:l,onSubmit:f}),u==="historyCard"&&c&&C.jsx(J4,{data:c}),n&&n.length>0&&r==="Success"&&C.jsx(YO,{children:C.jsx(sc,{items:n,status:r,onItemClick:M,onWebSearchClick:z})})]}),b]})}),!o&&C.jsx(oc,{items:x,open:y,onClose:P})]})},GO=ue.div`
1930
+ `,WO=({content:e,role:t="bot",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:o,eventType:u,humanVerifyData:l,historyCardData:c,onHumanVerifySubmit:f})=>{const{t:p}=gt(),[h,b]=ve.Modal.useModal(),[y,T]=K.useState(!1),[x,w]=K.useState([]);K.useEffect(()=>{e!=null&&e.includes("```echarts")&&yi().catch(console.error)},[e]);const I=K.useCallback(B=>{const $=B.Title||B.title,D=B.Text||B.text,H=B.Images||B.images;h.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:p("source.title"),destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:C.jsxs(ve.Space,{direction:"vertical",style:{width:"100%"},children:[C.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[$&&C.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:$}),D&&C.jsx("div",{children:D})]}),H&&H.length>0&&C.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:C.jsx(VO,{children:H.map((W,ye)=>C.jsx(ve.Image,{src:W,height:50,referrerPolicy:"no-referrer"},ye))})})]}),footer:null})},[h,p]),L=K.useCallback(B=>{w(B),T(!0)},[]),P=K.useCallback(()=>{T(!1)},[]),M=s||I,z=o||L;return C.jsxs(C.Fragment,{children:[C.jsx($O,{$role:t,className:`appflow-sdk-message-bubble ${a||""}`,style:i,children:C.jsxs(qO,{$role:t,children:[C.jsxs(z4,{content:e,status:r,role:t,children:[u==="humanVerify"&&l&&C.jsx(Q4,{data:l,onSubmit:f}),u==="historyCard"&&c&&C.jsx(J4,{data:c}),n&&n.length>0&&r==="Success"&&C.jsx(YO,{children:C.jsx(sc,{items:n,status:r,onItemClick:M,onWebSearchClick:z})})]}),b]})}),!o&&C.jsx(oc,{items:x,open:y,onClose:P})]})},GO=ue.div`
1931
1931
  padding: 12px 16px;
1932
1932
  border-radius: 12px;
1933
1933
  background: rgba(205, 208, 220, 0.15);
@@ -2025,4 +2025,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2025
2025
  display: flex;
2026
2026
  flex-wrap: wrap;
2027
2027
  gap: 8px;
2028
- `,QO=({content:e,messageType:t="markdown",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:o})=>{const{t:u}=gt(),[l,c]=ve.Modal.useModal(),[f,p]=K.useState(!1),[h,b]=K.useState([]);K.useEffect(()=>{(e!=null&&e.includes("echart")||e!=null&&e.includes("echarts"))&&yi().catch(console.error)},[e]);const y=K.useCallback(L=>{const P=L.Title||L.title,M=L.Text||L.text,z=L.Images||L.images;l.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:u("source.title"),destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:C.jsxs(ve.Space,{direction:"vertical",style:{width:"100%"},children:[C.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[P&&C.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:P}),M&&C.jsx("div",{children:M})]}),z&&z.length>0&&C.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:C.jsx(KO,{children:z.map((B,$)=>C.jsx(ve.Image,{src:B,height:50},$))})})]}),footer:null})},[l,u]),T=K.useCallback(L=>{b(L),p(!0)},[]),x=K.useCallback(()=>{p(!1)},[]),w=s||y,I=o||T;return C.jsxs(C.Fragment,{children:[C.jsxs(GO,{className:`appflow-sdk-rich-message-bubble ${a||""}`,style:i,children:[C.jsx(H4,{content:e,messageType:t,status:r,role:"bot",children:n&&n.length>0&&r==="Success"&&C.jsx(XO,{children:C.jsx(sc,{items:n,status:r,onItemClick:w,onWebSearchClick:I})})}),c]}),!o&&C.jsx(oc,{items:h,open:f,onClose:x})]})},JO={common:{loading:"Loading...",confirm:"OK",cancel:"Cancel",submit:"Submit",retry:"Retry",copy:"Copy",copied:"Copied",placeholderSelect:"Please select"},humanVerify:{requiredAll:"Please fill in all required fields",submitted:"Submitted",pending:"Pending",placeholder:{input:"Please enter {title}",select:"Please select"},file:{supportAll:"Supports all file formats",supportFormats:"Supports {formats} formats",uploadButton:"Select File",uploading:"Uploading",upload:"Upload",defaultFileName:"File",maxSizeError:"File size cannot exceed {size}",uploadFailed:"File upload failed",tokenFailed:"Failed to get upload credentials",uploaderNotConfigured:"Upload feature is not configured",uploadMethodNotConfigured:"File upload method is not configured",getFileIdFailed:"Failed to get file ID"}},webSearch:{title:"Search Results",foundPages:"Found {count} web pages"},source:{title:"References",answerFrom:"Sources:",imageFrom:"Images:"},rich:{stepLabel:"Step {index}:",emptyContent:"No content"},markdown:{copyCode:"Copy code",copied:"Copied!",copy:"Copy",copiedShort:"Copied",deepThinking:"Deep Thinking",chartLoading:"Loading chart...",tableLoading:"Loading table...",tableLoadFailed:"Failed to load table data, please check the data format",chartLoadFailed:"Failed to load chart data, please check the data format",mermaidLoadFailed:"Failed to load Mermaid library",mermaidNotLoaded:"Mermaid is not loaded correctly",mermaidRenderFailed:"Mermaid chart rendering failed"},message:{like:"Like",dislike:"Dislike",regenerate:"Regenerate",copy:"Copy",copied:"Copied"}};exports.BubbleContent=z4;exports.ChatService=yh;exports.CustomParamsRenderer=lc;exports.DocReferences=sc;exports.HistoryCard=J4;exports.HumanVerify=Q4;exports.LocaleContext=nc;exports.LocaleProvider=U_;exports.MarkdownRenderer=J_;exports.MarkdownView=Zt;exports.MessageBubble=WO;exports.RichBubbleContent=H4;exports.RichBubbleProvider=N4;exports.RichMessageBubble=QO;exports.SourceContent=W4;exports.WebSearchContent=G4;exports.WebSearchPanel=oc;exports.chatService=J6;exports.convertSchemaToUpperCase=Wu;exports.enUS=JO;exports.getGlobalLocale=z_;exports.getGlobalLocaleName=H_;exports.loadEchartsScript=yi;exports.loadMermaidScript=B4;exports.setGlobalLocale=F4;exports.translate=Mn;exports.useCustomParamsRenderer=BO;exports.useRichBubbleContext=O4;exports.useTranslation=gt;exports.validateCustomParams=Zn;exports.zhCN=x0;
2028
+ `,QO=({content:e,messageType:t="markdown",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:o})=>{const{t:u}=gt(),[l,c]=ve.Modal.useModal(),[f,p]=K.useState(!1),[h,b]=K.useState([]);K.useEffect(()=>{(e!=null&&e.includes("echart")||e!=null&&e.includes("echarts"))&&yi().catch(console.error)},[e]);const y=K.useCallback(L=>{const P=L.Title||L.title,M=L.Text||L.text,z=L.Images||L.images;l.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:u("source.title"),destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:C.jsxs(ve.Space,{direction:"vertical",style:{width:"100%"},children:[C.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[P&&C.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:P}),M&&C.jsx("div",{children:M})]}),z&&z.length>0&&C.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:C.jsx(KO,{children:z.map((B,$)=>C.jsx(ve.Image,{src:B,height:50,referrerPolicy:"no-referrer"},$))})})]}),footer:null})},[l,u]),T=K.useCallback(L=>{b(L),p(!0)},[]),x=K.useCallback(()=>{p(!1)},[]),w=s||y,I=o||T;return C.jsxs(C.Fragment,{children:[C.jsxs(GO,{className:`appflow-sdk-rich-message-bubble ${a||""}`,style:i,children:[C.jsx(H4,{content:e,messageType:t,status:r,role:"bot",children:n&&n.length>0&&r==="Success"&&C.jsx(XO,{children:C.jsx(sc,{items:n,status:r,onItemClick:w,onWebSearchClick:I})})}),c]}),!o&&C.jsx(oc,{items:h,open:f,onClose:x})]})},JO={common:{loading:"Loading...",confirm:"OK",cancel:"Cancel",submit:"Submit",retry:"Retry",copy:"Copy",copied:"Copied",placeholderSelect:"Please select"},humanVerify:{requiredAll:"Please fill in all required fields",submitted:"Submitted",pending:"Pending",placeholder:{input:"Please enter {title}",select:"Please select"},file:{supportAll:"Supports all file formats",supportFormats:"Supports {formats} formats",uploadButton:"Select File",uploading:"Uploading",upload:"Upload",defaultFileName:"File",maxSizeError:"File size cannot exceed {size}",uploadFailed:"File upload failed",tokenFailed:"Failed to get upload credentials",uploaderNotConfigured:"Upload feature is not configured",uploadMethodNotConfigured:"File upload method is not configured",getFileIdFailed:"Failed to get file ID"}},webSearch:{title:"Search Results",foundPages:"Found {count} web pages"},source:{title:"References",answerFrom:"Sources:",imageFrom:"Images:"},rich:{stepLabel:"Step {index}:",emptyContent:"No content"},markdown:{copyCode:"Copy code",copied:"Copied!",copy:"Copy",copiedShort:"Copied",deepThinking:"Deep Thinking",chartLoading:"Loading chart...",tableLoading:"Loading table...",tableLoadFailed:"Failed to load table data, please check the data format",chartLoadFailed:"Failed to load chart data, please check the data format",mermaidLoadFailed:"Failed to load Mermaid library",mermaidNotLoaded:"Mermaid is not loaded correctly",mermaidRenderFailed:"Mermaid chart rendering failed"},message:{like:"Like",dislike:"Dislike",regenerate:"Regenerate",copy:"Copy",copied:"Copied"}};exports.BubbleContent=z4;exports.ChatService=yh;exports.CustomParamsRenderer=lc;exports.DocReferences=sc;exports.HistoryCard=J4;exports.HumanVerify=Q4;exports.LocaleContext=nc;exports.LocaleProvider=U_;exports.MarkdownRenderer=J_;exports.MarkdownView=Zt;exports.MessageBubble=WO;exports.RichBubbleContent=H4;exports.RichBubbleProvider=N4;exports.RichMessageBubble=QO;exports.SourceContent=W4;exports.WebSearchContent=G4;exports.WebSearchPanel=oc;exports.chatService=J6;exports.convertSchemaToUpperCase=Wu;exports.enUS=JO;exports.getGlobalLocale=z_;exports.getGlobalLocaleName=H_;exports.loadEchartsScript=yi;exports.loadMermaidScript=B4;exports.setGlobalLocale=F4;exports.translate=Mn;exports.useCustomParamsRenderer=BO;exports.useRichBubbleContext=O4;exports.useTranslation=gt;exports.validateCustomParams=Zn;exports.zhCN=x0;
@@ -35409,6 +35409,7 @@ const gI = () => `mermaid-${Date.now()}-${pI++}`, bI = (e) => {
35409
35409
  },
35410
35410
  src: l.src,
35411
35411
  alt: l.alt,
35412
+ referrerPolicy: "no-referrer",
35412
35413
  preview: { zIndex: 1100 }
35413
35414
  }
35414
35415
  );
@@ -35473,6 +35474,7 @@ const gI = () => `mermaid-${Date.now()}-${pI++}`, bI = (e) => {
35473
35474
  src: h.properties.src,
35474
35475
  className: "max-w-full h-auto align-middle border-none rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 ease-in-out mt-2 mb-2",
35475
35476
  alt: h.properties.alt,
35477
+ referrerPolicy: "no-referrer",
35476
35478
  preview: { zIndex: 1100 }
35477
35479
  }
35478
35480
  ),
@@ -36279,7 +36281,7 @@ const JN = oe.div`
36279
36281
  ] }),
36280
36282
  u.length > 0 && /* @__PURE__ */ we(Vd, { children: [
36281
36283
  /* @__PURE__ */ M(Wd, { children: o("source.imageFrom") }),
36282
- /* @__PURE__ */ M(nO, { children: u.map((h, b) => /* @__PURE__ */ M(aO, { children: /* @__PURE__ */ M(Xa, { src: h, width: 50, height: 50, preview: { zIndex: 1100 } }) }, b)) })
36284
+ /* @__PURE__ */ M(nO, { children: u.map((h, b) => /* @__PURE__ */ M(aO, { children: /* @__PURE__ */ M(Xa, { src: h, width: 50, height: 50, referrerPolicy: "no-referrer", preview: { zIndex: 1100 } }) }, b)) })
36283
36285
  ] })
36284
36286
  ] });
36285
36287
  }, { Title: uO } = b3, lO = oe.div`
@@ -38270,7 +38272,7 @@ const $O = /* @__PURE__ */ Zs(UO), qO = oe.div`
38270
38272
  q && /* @__PURE__ */ M("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: q }),
38271
38273
  R && /* @__PURE__ */ M("div", { children: R })
38272
38274
  ] }),
38273
- H && H.length > 0 && /* @__PURE__ */ M("div", { style: { borderRadius: "4px", backgroundColor: "#f0f2f5", padding: "8px" }, children: /* @__PURE__ */ M(yR, { children: H.map((W, be) => /* @__PURE__ */ M(Xa, { src: W, height: 50 }, be)) }) })
38275
+ H && H.length > 0 && /* @__PURE__ */ M("div", { style: { borderRadius: "4px", backgroundColor: "#f0f2f5", padding: "8px" }, children: /* @__PURE__ */ M(yR, { children: H.map((W, be) => /* @__PURE__ */ M(Xa, { src: W, height: 50, referrerPolicy: "no-referrer" }, be)) }) })
38274
38276
  ] }),
38275
38277
  footer: null
38276
38278
  });
@@ -38459,7 +38461,7 @@ const $O = /* @__PURE__ */ Zs(UO), qO = oe.div`
38459
38461
  P && /* @__PURE__ */ M("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: P }),
38460
38462
  L && /* @__PURE__ */ M("div", { children: L })
38461
38463
  ] }),
38462
- z && z.length > 0 && /* @__PURE__ */ M("div", { style: { borderRadius: "4px", backgroundColor: "#f0f2f5", padding: "8px" }, children: /* @__PURE__ */ M(xR, { children: z.map((B, q) => /* @__PURE__ */ M(Xa, { src: B, height: 50 }, q)) }) })
38464
+ z && z.length > 0 && /* @__PURE__ */ M("div", { style: { borderRadius: "4px", backgroundColor: "#f0f2f5", padding: "8px" }, children: /* @__PURE__ */ M(xR, { children: z.map((B, q) => /* @__PURE__ */ M(Xa, { src: B, height: 50, referrerPolicy: "no-referrer" }, q)) }) })
38463
38465
  ] }),
38464
38466
  footer: null
38465
38467
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/appflow-chat",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Appflow-Chat AI聊天机器人组件库,提供聊天服务和UI组件",
5
5
  "type": "module",
6
6
  "main": "./dist/appflow-chat.cjs.js",
@@ -310,7 +310,7 @@ export const MessageBubble: React.FC<MessageBubbleProps> = ({
310
310
  <div style={{ borderRadius: '4px', backgroundColor: '#f0f2f5', padding: '8px' }}>
311
311
  <StyledWrapSpace>
312
312
  {images.map((url, index) => (
313
- <Image key={index} src={url} height={50} />
313
+ <Image key={index} src={url} height={50} referrerPolicy="no-referrer" />
314
314
  ))}
315
315
  </StyledWrapSpace>
316
316
  </div>
@@ -216,7 +216,7 @@ export const RichMessageBubble: React.FC<RichMessageBubbleProps> = ({
216
216
  <div style={{ borderRadius: '4px', backgroundColor: '#f0f2f5', padding: '8px' }}>
217
217
  <StyledWrapSpace>
218
218
  {images.map((url: string, index: number) => (
219
- <Image key={index} src={url} height={50} />
219
+ <Image key={index} src={url} height={50} referrerPolicy="no-referrer" />
220
220
  ))}
221
221
  </StyledWrapSpace>
222
222
  </div>
@@ -274,7 +274,7 @@ export const SourceContent: React.FC<SourceContentProps> = ({
274
274
  <StyledWrapSpace>
275
275
  {uniqueImages.map((image, index) => (
276
276
  <StyledImageBox key={index}>
277
- <Image src={image} width={50} height={50} preview={{ zIndex: 1100 }}/>
277
+ <Image src={image} width={50} height={50} referrerPolicy="no-referrer" preview={{ zIndex: 1100 }}/>
278
278
  </StyledImageBox>
279
279
  ))}
280
280
  </StyledWrapSpace>
@@ -50,6 +50,7 @@ export const MarkdownView: React.FC<MarkdownViewProps> = ({
50
50
  }}
51
51
  src={props.src}
52
52
  alt={props.alt}
53
+ referrerPolicy="no-referrer"
53
54
  preview={{ zIndex: 1100 }}
54
55
  />
55
56
  );
@@ -181,6 +182,7 @@ export const MarkdownView: React.FC<MarkdownViewProps> = ({
181
182
  src={image.properties.src}
182
183
  className="max-w-full h-auto align-middle border-none rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 ease-in-out mt-2 mb-2"
183
184
  alt={image.properties.alt}
185
+ referrerPolicy="no-referrer"
184
186
  preview={{ zIndex: 1100 }}
185
187
  />
186
188
  {isSlice && <p>