@topthink/chat 1.1.21 → 1.1.22

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.
Files changed (2) hide show
  1. package/es/index.js +1 -1
  2. package/package.json +2 -2
package/es/index.js CHANGED
@@ -617,7 +617,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{styled as
617
617
  }
618
618
  `,wt=n.span`
619
619
  display: inline-block;
620
- `;function Nt(r){let{nodes:n,loading:i}=r;const[o,s]=C(!1),a=n.some((e=>"error"in e)),l=i?t(I,{animation:"border",variant:"primary",size:"sm"}):t("i",a?{className:"bi bi-x-circle-fill text-danger"}:{className:"bi bi-check-circle-fill text-success"});return t("div",{className:"mb-2",children:e("div",o?{className:"shadow-sm rounded bg-white fs-7",children:[e("div",{onClick:()=>s(!1),role:"button",className:"d-flex align-items-center p-1 px-2 gap-2",children:[l,t("span",{children:"工作流"}),t("i",{className:"bi bi-caret-up-fill text-muted"})]}),t("div",{className:"border-top p-2 d-flex flex-column gap-1 bg-light bg-opacity-50",children:n.map(((e,r)=>t(xt,{node:e},r)))})]}:{onClick:()=>s(!0),role:"button",className:"d-inline-flex align-items-center shadow-sm rounded bg-white p-1 px-2 fs-7 gap-2",children:[l,t("span",{children:"工作流"}),t("i",{className:"bi bi-caret-down-fill text-muted"})]})})}const Et=S((n=>{let{message:i,actions:o,setMessage:s,cite:a,speech:l}=n;const{query:c,quote:d,files:h=[],chunks:u,annotation:m,loading:p}=i,{user:g,bot:f,logLevel:x="none",messages:y}=ae(),k=q((()=>u?u.reduce((function(e,t){return e+t.content+"\n"+t.tools.reduce(((e,t)=>t.content&&"string"==typeof t.content?e+t.content+"\n":e),"")}),""):""),[u]),w=N(null),E=N(null),j=N(null),C=q((()=>u?.flatMap((e=>e.node?[e.node]:[]))||[]),[u]);return console.log(u),e(r,{children:[(c||h.length>0)&&e(It,{$reverse:!0,children:[g&&t(At,{children:t("img",{src:g.avatar})}),t(Rt,{}),e(Ft,{ref:w,children:[c&&t(Ze,{content:c}),d&&t(L,{trigger:"click",container:w,rootClose:!0,placement:"bottom",overlay:t(jt,{body:!0,children:d}),children:t(Mt,{children:t(Ct,{children:d})})}),h.length>0&&h.map(((e,r)=>{let{name:n,size:i,path:o}=e;return v(o)?t(st,{src:`/uploads/${o}`},r):t(zt,{children:t(ee,{name:n,size:i})},r)}))]})]}),u&&e(It,{children:[t(At,{ref:E,children:t("img",{src:f.avatar})}),t(Rt,{}),e(Ft,{children:[(c||h.length>0)&&!1!==o&&e($t,{children:[t(b,{placement:"top",content:k,as:nt,tooltip:!0}),l&&t(pt,{loading:i.loading,avatarRef:E,contentRef:j,...l}),o?.({Component:nt,message:i,content:k,setMessage:s,messages:y})]}),t(St,{children:["stats","all"].includes(x)&&i.stats&&e(r,{children:[e("span",{children:["耗时 ",i.stats.latency/1e3," 秒"]}),e("span",{children:["花费 Token ",i.stats.usage]})]})}),e(qt,{ref:j,$deleted:!!m,children:["all"===x&&C.length>0&&t(Nt,{loading:p,nodes:C}),u.length>0&&u.map(((r,n)=>e($,{children:[r.reasoning&&["stats","all"].includes(x)&&t(ct,{reasoning:r.reasoning,loading:!r.content}),r.content&&t(lt,{cite:a,value:r.content}),r.tools.map(((e,r)=>t(bt,{tool:e},r))),r.error&&t(Ze,{content:`[${r.error}]`})]},n)))]}),m&&e("div",{children:[e("div",{className:"d-flex align-items-center",children:[t("span",{className:"fs-7 text-secondary me-2",children:"标注的答案"}),t("hr",{className:"flex-fill"})]}),t(Ze,{content:m.answer})]}),i.loading&&t(Ke,{})]})]})]})})),jt=n(P)`
620
+ `;function Nt(r){let{nodes:n,loading:i}=r;const[o,s]=C(!1),a=n.some((e=>"error"in e)),l=i?t(I,{animation:"border",variant:"primary",size:"sm"}):t("i",a?{className:"bi bi-x-circle-fill text-danger"}:{className:"bi bi-check-circle-fill text-success"});return t("div",{className:"mb-2",children:e("div",o?{className:"shadow-sm rounded bg-white fs-7",children:[e("div",{onClick:()=>s(!1),role:"button",className:"d-flex align-items-center p-1 px-2 gap-2",children:[l,t("span",{children:"工作流"}),t("i",{className:"bi bi-caret-up-fill text-muted"})]}),t("div",{className:"border-top p-2 d-flex flex-column gap-1 bg-light bg-opacity-50",children:n.map(((e,r)=>t(xt,{node:e},r)))})]}:{onClick:()=>s(!0),role:"button",className:"d-inline-flex align-items-center shadow-sm rounded bg-white p-1 px-2 fs-7 gap-2",children:[l,t("span",{children:"工作流"}),t("i",{className:"bi bi-caret-down-fill text-muted"})]})})}const Et=S((n=>{let{message:i,actions:o,setMessage:s,cite:a,speech:l}=n;const{query:c,quote:d,files:h=[],chunks:u,annotation:m,loading:p}=i,{user:g,bot:f,logLevel:x="none",messages:y}=ae(),k=q((()=>u?u.reduce((function(e,t){return e+t.content+"\n"+t.tools.reduce(((e,t)=>t.content&&"string"==typeof t.content?e+t.content+"\n":e),"")}),""):""),[u]),w=N(null),E=N(null),j=N(null),C=q((()=>u?.flatMap((e=>e.node?[e.node]:[]))||[]),[u]);return e(r,{children:[(c||h.length>0)&&e(It,{$reverse:!0,children:[g&&t(At,{children:t("img",{src:g.avatar})}),t(Rt,{}),e(Ft,{ref:w,children:[c&&t(Ze,{content:c}),d&&t(L,{trigger:"click",container:w,rootClose:!0,placement:"bottom",overlay:t(jt,{body:!0,children:d}),children:t(Mt,{children:t(Ct,{children:d})})}),h.length>0&&h.map(((e,r)=>{let{name:n,size:i,path:o}=e;return v(o)?t(st,{src:`/uploads/${o}`},r):t(zt,{children:t(ee,{name:n,size:i})},r)}))]})]}),u&&e(It,{children:[t(At,{ref:E,children:t("img",{src:f.avatar})}),t(Rt,{}),e(Ft,{children:[(c||h.length>0)&&!1!==o&&e($t,{children:[t(b,{placement:"top",content:k,as:nt,tooltip:!0}),l&&t(pt,{loading:i.loading,avatarRef:E,contentRef:j,...l}),o?.({Component:nt,message:i,content:k,setMessage:s,messages:y})]}),t(St,{children:["stats","all"].includes(x)&&i.stats&&e(r,{children:[e("span",{children:["耗时 ",i.stats.latency/1e3," 秒"]}),e("span",{children:["花费 Token ",i.stats.usage]})]})}),e(qt,{ref:j,$deleted:!!m,children:["all"===x&&C.length>0&&t(Nt,{loading:p,nodes:C}),u.length>0&&u.map(((r,n)=>e($,{children:[r.reasoning&&["stats","all"].includes(x)&&t(ct,{reasoning:r.reasoning,loading:!r.content}),r.content&&t(lt,{cite:a,value:r.content}),r.tools.map(((e,r)=>t(bt,{tool:e},r))),r.error&&t(Ze,{content:`[${r.error}]`})]},n)))]}),m&&e("div",{children:[e("div",{className:"d-flex align-items-center",children:[t("span",{className:"fs-7 text-secondary me-2",children:"标注的答案"}),t("hr",{className:"flex-fill"})]}),t(Ze,{content:m.answer})]}),i.loading&&t(Ke,{})]})]})]})})),jt=n(P)`
621
621
  max-width: calc(100% - .875rem * 2);
622
622
  width: calc(100% - .875rem * 2);
623
623
  font-size: 1rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topthink/chat",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "scripts": {
5
5
  "prebuild": "rimraf es types",
6
6
  "build": "rollup -c --environment NODE_ENV:production",
@@ -65,5 +65,5 @@
65
65
  },
66
66
  "author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
67
67
  "license": "MIT",
68
- "gitHead": "18680f04ace9e3ef94476fb347206b5bd82adda0"
68
+ "gitHead": "adf9c4be6967face2be4bd1cd65d2a1ff1886b32"
69
69
  }