@topthink/chat 1.0.35 → 1.0.37
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/es/index.js
CHANGED
|
@@ -580,7 +580,7 @@ import*as e from"react";import{useCallback as t,useState as r,useRef as n,useImp
|
|
|
580
580
|
box-shadow: 0.125rem 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
|
|
581
581
|
`,Ae=f.div`
|
|
582
582
|
margin: 0 1rem 1rem;
|
|
583
|
-
`;function Pe(e){let{className:o,bot:i,user:a,input:s,logLevel:l,imageResolver:c,placeholder:d,actions:u
|
|
583
|
+
`;function Pe(e){let{className:o,bot:i,user:a,input:s,logLevel:l,imageResolver:c,placeholder:d,actions:u,messages:p=[]}=e;const[f,b]=h((()=>U(p))),[v,x]=r(!1),y=n(!s),k=n(null),w=t((()=>{const e=k.current;e&&requestAnimationFrame((()=>{e.scrollTo({top:e.scrollHeight})}))}),[]),{ref:j,height:N}=P(),[$,q]=r([]);return m((()=>{(v||!y.current)&&f.length>0&&(v&&(y.current=!0),w())}),[N,v,y,f]),m((()=>{$.length>0&&w()}),[$]),z(ne,{bot:i,user:a,logLevel:l,imageResolver:c,children:z(Ke,{className:o,children:M(g,{children:[z(Ue,{ref:k,children:M(He,{ref:j,children:[0===f.length&&d,f.slice(-30).map(((e,t)=>z(we,{actions:u,message:e,updater:t=>{b((r=>{const n=r.findIndex((t=>t.id===e.id));-1!==n&&t(r[n])}))}},t))),$.length>0&&z(Ie,{children:$.map(((e,t)=>z("a",{href:"#!question",children:e},t)))})]})}),s&&z(Se,{...s,onMessages:b,onSuggestions:q,scrollRef:k,onLoading:x})]})})})}const Ie=f.div`
|
|
584
584
|
display: flex;
|
|
585
585
|
flex-direction: column;
|
|
586
586
|
align-items: flex-start;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topthink/chat",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prebuild": "rimraf es types",
|
|
6
6
|
"build": "rollup -c --environment NODE_ENV:production",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.11.2",
|
|
20
|
-
"@topthink/components": "^1.0.
|
|
20
|
+
"@topthink/components": "^1.0.96",
|
|
21
21
|
"@types/mdast": "^4.0.4",
|
|
22
22
|
"katex": "^0.16.9",
|
|
23
23
|
"mdast-util-from-markdown": "^2.0.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
},
|
|
66
66
|
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
67
67
|
"license": "MIT",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "363c317dc9452f6546c1142ebbb789c3eb7fe24e"
|
|
69
69
|
}
|
|
@@ -30,5 +30,5 @@ interface Props {
|
|
|
30
30
|
};
|
|
31
31
|
actions?: MessageActions;
|
|
32
32
|
}
|
|
33
|
-
export default function MessageBox({ className, bot, user, input, logLevel, imageResolver, placeholder, actions,
|
|
33
|
+
export default function MessageBox({ className, bot, user, input, logLevel, imageResolver, placeholder, actions, messages: initMessages, }: Props): JSX.Element;
|
|
34
34
|
export {};
|