@alicloud/appflow-chat 0.0.1-beta.2 → 0.0.1-beta.3
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.
package/dist/appflow-chat.cjs.js
CHANGED
|
@@ -1802,7 +1802,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1802
1802
|
display: flex;
|
|
1803
1803
|
flex-wrap: wrap;
|
|
1804
1804
|
gap: 8px;
|
|
1805
|
-
`,iN=({content:e,role:t="bot",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:u,eventType:o,humanVerifyData:l,historyCardData:c,onHumanVerifySubmit:f})=>{const[p,m]=Ne.Modal.useModal(),[b,y]=ue.useState(!1),[v,T]=ue.useState([]);ue.useEffect(()=>{e!=null&&e.includes("```echarts")&&gi().catch(console.error)},[e]);const w=ue.useCallback(F=>{const $=F.Title||F.title,j=F.Text||F.text,D=F.Images||F.images;p.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:"参考资料",destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:R.jsxs(Ne.Space,{direction:"vertical",style:{width:"100%"},children:[R.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[$&&R.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:$}),j&&R.jsx("div",{children:j})]}),D&&D.length>0&&R.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:R.jsx(aN,{children:D.map((X,G)=>R.jsx(Ne.Image,{src:X,height:50},G))})})]}),footer:null})},[p]),A=ue.useCallback(F=>{T(F),y(!0)},[]),P=ue.useCallback(()=>{y(!1)},[]),B=s||w,O=u||A;return R.jsxs(R.Fragment,{children:[R.jsx(tN,{$role:t,className:`appflow-sdk-message-bubble ${a||""}`,style:i,children:R.jsxs(rN,{$role:t,children:[R.jsxs(U2,{content:e,status:r,role:t,children:[o==="humanVerify"&&l&&R.jsx(J2,{verifyId:l.verifyId,sessionWebhook:l.sessionWebhook,approved:l.approved,customParamsSchema:l.customParams,customParamsKey:l.customParamsKey,onSubmit:f}),o==="historyCard"&&c&&R.jsx(Z2,{approvalStatus:c.approvalStatus,formValues:c.formValues,formSchema:c.formSchema}),n.length>0&&r==="Success"&&R.jsx(nN,{children:R.jsx(Cl,{items:n,status:r,onItemClick:B,onWebSearchClick:O})})]}),m]})}),!u&&R.jsx(Il,{items:v,open:b,onClose:P})]})},sN=ae.div`
|
|
1805
|
+
`,iN=({content:e,role:t="bot",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:u,eventType:o,humanVerifyData:l,historyCardData:c,onHumanVerifySubmit:f})=>{const[p,m]=Ne.Modal.useModal(),[b,y]=ue.useState(!1),[v,T]=ue.useState([]);ue.useEffect(()=>{e!=null&&e.includes("```echarts")&&gi().catch(console.error)},[e]);const w=ue.useCallback(F=>{const $=F.Title||F.title,j=F.Text||F.text,D=F.Images||F.images;p.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:"参考资料",destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:R.jsxs(Ne.Space,{direction:"vertical",style:{width:"100%"},children:[R.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[$&&R.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:$}),j&&R.jsx("div",{children:j})]}),D&&D.length>0&&R.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:R.jsx(aN,{children:D.map((X,G)=>R.jsx(Ne.Image,{src:X,height:50},G))})})]}),footer:null})},[p]),A=ue.useCallback(F=>{T(F),y(!0)},[]),P=ue.useCallback(()=>{y(!1)},[]),B=s||w,O=u||A;return R.jsxs(R.Fragment,{children:[R.jsx(tN,{$role:t,className:`appflow-sdk-message-bubble ${a||""}`,style:i,children:R.jsxs(rN,{$role:t,children:[R.jsxs(U2,{content:e,status:r,role:t,children:[o==="humanVerify"&&l&&R.jsx(J2,{verifyId:l.verifyId,sessionWebhook:l.sessionWebhook,approved:l.approved,customParamsSchema:l.customParams,customParamsKey:l.customParamsKey,onSubmit:f}),o==="historyCard"&&c&&R.jsx(Z2,{approvalStatus:c.approvalStatus,formValues:c.formValues,formSchema:c.formSchema}),n&&n.length>0&&r==="Success"&&R.jsx(nN,{children:R.jsx(Cl,{items:n,status:r,onItemClick:B,onWebSearchClick:O})})]}),m]})}),!u&&R.jsx(Il,{items:v,open:b,onClose:P})]})},sN=ae.div`
|
|
1806
1806
|
padding: 12px 16px;
|
|
1807
1807
|
border-radius: 12px;
|
|
1808
1808
|
background: rgba(205, 208, 220, 0.15);
|
|
@@ -1900,4 +1900,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1900
1900
|
display: flex;
|
|
1901
1901
|
flex-wrap: wrap;
|
|
1902
1902
|
gap: 8px;
|
|
1903
|
-
`,lN=({content:e,messageType:t="markdown",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:u})=>{const[o,l]=Ne.Modal.useModal(),[c,f]=ue.useState(!1),[p,m]=ue.useState([]);ue.useEffect(()=>{(e!=null&&e.includes("echart")||e!=null&&e.includes("echarts"))&&gi().catch(console.error)},[e]);const b=ue.useCallback(A=>{const P=A.Title||A.title,B=A.Text||A.text,O=A.Images||A.images;o.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:"参考资料",destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:R.jsxs(Ne.Space,{direction:"vertical",style:{width:"100%"},children:[R.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[P&&R.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:P}),B&&R.jsx("div",{children:B})]}),O&&O.length>0&&R.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:R.jsx(oN,{children:O.map((F,$)=>R.jsx(Ne.Image,{src:F,height:50},$))})})]}),footer:null})},[o]),y=ue.useCallback(A=>{m(A),f(!0)},[]),v=ue.useCallback(()=>{f(!1)},[]),T=s||b,w=u||y;return R.jsxs(R.Fragment,{children:[R.jsxs(sN,{className:`appflow-sdk-rich-message-bubble ${a||""}`,style:i,children:[R.jsx(j2,{content:e,messageType:t,status:r,role:"bot",children:n.length>0&&r==="Success"&&R.jsx(uN,{children:R.jsx(Cl,{items:n,status:r,onItemClick:T,onWebSearchClick:w})})}),l]}),!u&&R.jsx(Il,{items:p,open:c,onClose:v})]})};exports.BubbleContent=U2;exports.ChatService=Rh;exports.CustomParamsRenderer=_l;exports.DocReferences=Cl;exports.HistoryCard=Z2;exports.HumanVerify=J2;exports.MarkdownRenderer=IC;exports.MarkdownView=Kt;exports.MessageBubble=iN;exports.RichBubbleContent=j2;exports.RichBubbleProvider=z2;exports.RichMessageBubble=lN;exports.SourceContent=X2;exports.WebSearchContent=K2;exports.WebSearchPanel=Il;exports.chatService=$3;exports.convertSchemaToUpperCase=fo;exports.loadEchartsScript=gi;exports.useCustomParamsRenderer=K_;exports.useRichBubbleContext=H2;exports.validateCustomParams=ea;
|
|
1903
|
+
`,lN=({content:e,messageType:t="markdown",status:r="Success",references:n=[],className:a,style:i,onReferenceClick:s,onWebSearchClick:u})=>{const[o,l]=Ne.Modal.useModal(),[c,f]=ue.useState(!1),[p,m]=ue.useState([]);ue.useEffect(()=>{(e!=null&&e.includes("echart")||e!=null&&e.includes("echarts"))&&gi().catch(console.error)},[e]);const b=ue.useCallback(A=>{const P=A.Title||A.title,B=A.Text||A.text,O=A.Images||A.images;o.confirm({bodyStyle:{maxHeight:"80vh",overflow:"auto"},icon:null,title:"参考资料",destroyOnClose:!0,maskClosable:!0,closable:!0,width:800,content:R.jsxs(Ne.Space,{direction:"vertical",style:{width:"100%"},children:[R.jsxs("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:[P&&R.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:P}),B&&R.jsx("div",{children:B})]}),O&&O.length>0&&R.jsx("div",{style:{borderRadius:"4px",backgroundColor:"#f0f2f5",padding:"8px"},children:R.jsx(oN,{children:O.map((F,$)=>R.jsx(Ne.Image,{src:F,height:50},$))})})]}),footer:null})},[o]),y=ue.useCallback(A=>{m(A),f(!0)},[]),v=ue.useCallback(()=>{f(!1)},[]),T=s||b,w=u||y;return R.jsxs(R.Fragment,{children:[R.jsxs(sN,{className:`appflow-sdk-rich-message-bubble ${a||""}`,style:i,children:[R.jsx(j2,{content:e,messageType:t,status:r,role:"bot",children:n&&n.length>0&&r==="Success"&&R.jsx(uN,{children:R.jsx(Cl,{items:n,status:r,onItemClick:T,onWebSearchClick:w})})}),l]}),!u&&R.jsx(Il,{items:p,open:c,onClose:v})]})};exports.BubbleContent=U2;exports.ChatService=Rh;exports.CustomParamsRenderer=_l;exports.DocReferences=Cl;exports.HistoryCard=Z2;exports.HumanVerify=J2;exports.MarkdownRenderer=IC;exports.MarkdownView=Kt;exports.MessageBubble=iN;exports.RichBubbleContent=j2;exports.RichBubbleProvider=z2;exports.RichMessageBubble=lN;exports.SourceContent=X2;exports.WebSearchContent=K2;exports.WebSearchPanel=Il;exports.chatService=$3;exports.convertSchemaToUpperCase=fo;exports.loadEchartsScript=gi;exports.useCustomParamsRenderer=K_;exports.useRichBubbleContext=H2;exports.validateCustomParams=ea;
|
package/dist/appflow-chat.esm.js
CHANGED
|
@@ -36740,7 +36740,7 @@ const w_ = ae.div`
|
|
|
36740
36740
|
formSchema: c.formSchema
|
|
36741
36741
|
}
|
|
36742
36742
|
),
|
|
36743
|
-
n.length > 0 && r === "Success" && /* @__PURE__ */ B(SN, { children: /* @__PURE__ */ B(
|
|
36743
|
+
n && n.length > 0 && r === "Success" && /* @__PURE__ */ B(SN, { children: /* @__PURE__ */ B(
|
|
36744
36744
|
r4,
|
|
36745
36745
|
{
|
|
36746
36746
|
items: n,
|
|
@@ -36915,7 +36915,7 @@ const w_ = ae.div`
|
|
|
36915
36915
|
messageType: t,
|
|
36916
36916
|
status: r,
|
|
36917
36917
|
role: "bot",
|
|
36918
|
-
children: n.length > 0 && r === "Success" && /* @__PURE__ */ B(IN, { children: /* @__PURE__ */ B(
|
|
36918
|
+
children: n && n.length > 0 && r === "Success" && /* @__PURE__ */ B(IN, { children: /* @__PURE__ */ B(
|
|
36919
36919
|
r4,
|
|
36920
36920
|
{
|
|
36921
36921
|
items: n,
|
package/package.json
CHANGED
|
@@ -370,7 +370,7 @@ export const MessageBubble: React.FC<MessageBubbleProps> = ({
|
|
|
370
370
|
)}
|
|
371
371
|
|
|
372
372
|
{/* 参考资料 */}
|
|
373
|
-
{references.length > 0 && status === 'Success' && (
|
|
373
|
+
{references && references.length > 0 && status === 'Success' && (
|
|
374
374
|
<ReferencesContainer>
|
|
375
375
|
<DocReferences
|
|
376
376
|
items={references}
|
|
@@ -397,4 +397,4 @@ export const MessageBubble: React.FC<MessageBubbleProps> = ({
|
|
|
397
397
|
);
|
|
398
398
|
};
|
|
399
399
|
|
|
400
|
-
export default MessageBubble;
|
|
400
|
+
export default MessageBubble;
|
|
@@ -254,7 +254,7 @@ export const RichMessageBubble: React.FC<RichMessageBubbleProps> = ({
|
|
|
254
254
|
role="bot"
|
|
255
255
|
>
|
|
256
256
|
{/* 参考资料 */}
|
|
257
|
-
{references.length > 0 && status === 'Success' && (
|
|
257
|
+
{references && references.length > 0 && status === 'Success' && (
|
|
258
258
|
<ReferencesContainer>
|
|
259
259
|
<DocReferences
|
|
260
260
|
items={references}
|
|
@@ -280,4 +280,4 @@ export const RichMessageBubble: React.FC<RichMessageBubbleProps> = ({
|
|
|
280
280
|
);
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
export default RichMessageBubble;
|
|
283
|
+
export default RichMessageBubble;
|