style of ask gpt and infinit loop error fix

pull/5370/head
lianahus 1 year ago committed by Aniket
parent 94334d6d9f
commit 59d7187850
  1. 2
      libs/remix-ui/renderer/src/lib/renderer.css
  2. 6
      libs/remix-ui/renderer/src/lib/renderer.tsx
  3. 8
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -40,8 +40,6 @@
.remixui_sol.success a,
.remixui_sol.error a,
.remixui_sol.warning a {
position: absolute;
bottom: 0;
right: 0;
padding: 0.25rem;
}

@ -96,8 +96,12 @@ export const Renderer = ({message, opt = {}, plugin}: RendererProps) => {
<div className="close" data-id="renderer" onClick={handleClose}>
<i className="fas fa-times"></i>
</div>
<div className="d-flex flex-row-reverse">
<span className="ml-2 pt-1 p-1" >
<CopyToClipboard content={messageText} className={` p-0 m-0 far fa-copy ${classList}`} direction={'top'} />
<span onClick={() => { askGtp() }}>ASK GPT</span>
</span>
<span className="btn btn-success btn-sm" onClick={() => { askGtp() }}>ASK GPT</span>
</div>
</div>
)}
</>

@ -734,9 +734,12 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
if (x.typewriter && !typeWriterIndexes.current.includes(index)) {
typeWriterIndexes.current.push(index)
return (
<div className={classNameBlock} data-id="block" key={index}> <span ref={(element) => {
<div className={classNameBlock} data-id="block" key={index}>
<span ref={(element) => {
typewrite(element, msg ? msg.toString() : null)
}} className={x.style}></span></div>
}} className={x.style}>
</span>
</div>
)
} else {
return (
@ -804,6 +807,7 @@ const typewrite = (elementsRef, message) => {
(() => {
let count = 0
const id = setInterval(() => {
if (!elementsRef) return
count++
elementsRef.innerText = message.substr(0, count)
if (message === count) clearInterval(id)

Loading…
Cancel
Save