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. 8
      libs/remix-ui/renderer/src/lib/renderer.tsx
  3. 10
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -40,8 +40,6 @@
.remixui_sol.success a, .remixui_sol.success a,
.remixui_sol.error a, .remixui_sol.error a,
.remixui_sol.warning a { .remixui_sol.warning a {
position: absolute;
bottom: 0; bottom: 0;
right: 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}> <div className="close" data-id="renderer" onClick={handleClose}>
<i className="fas fa-times"></i> <i className="fas fa-times"></i>
</div> </div>
<CopyToClipboard content={messageText} className={` p-0 m-0 far fa-copy ${classList}`} direction={'top'} /> <div className="d-flex flex-row-reverse">
<span onClick={() => { askGtp() }}>ASK GPT</span> <span className="ml-2 pt-1 p-1" >
<CopyToClipboard content={messageText} className={` p-0 m-0 far fa-copy ${classList}`} direction={'top'} />
</span>
<span className="btn btn-success btn-sm" onClick={() => { askGtp() }}>ASK GPT</span>
</div>
</div> </div>
)} )}
</> </>

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

Loading…
Cancel
Save