style(chatMessage): fix formatting and add const keyword to convert variable in both files
feat(chatMessage): add newline option to ansi-to-html Convert constructor in both files
This commit is contained in:
parent
d3ed0cd7c9
commit
50165ce789
2 changed files with 5 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ import { useState } from "react";
|
||||||
import { ChatMessageType } from "../../../types/chat";
|
import { ChatMessageType } from "../../../types/chat";
|
||||||
import { nodeColors } from "../../../utils";
|
import { nodeColors } from "../../../utils";
|
||||||
import Convert from "ansi-to-html";
|
import Convert from "ansi-to-html";
|
||||||
var convert = new Convert({newline:true});
|
const convert = new Convert({ newline: true });
|
||||||
|
|
||||||
export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
|
export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
|
||||||
const [hidden, setHidden] = useState(true);
|
const [hidden, setHidden] = useState(true);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import { CodeBlock } from "./codeBlock";
|
||||||
import Convert from "ansi-to-html";
|
import Convert from "ansi-to-html";
|
||||||
|
|
||||||
export default function ChatMessage({ chat, lockChat }: { chat: ChatMessageType, lockChat: boolean }) {
|
export default function ChatMessage({ chat, lockChat }: { chat: ChatMessageType, lockChat: boolean }) {
|
||||||
|
const convert = new Convert({ newline: true });
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const imgRef = useRef(null);
|
const imgRef = useRef(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -35,9 +36,9 @@ export default function ChatMessage({ chat, lockChat }: { chat: ChatMessageType,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!chat.isSend && <div className="relative w-8 h-8">
|
{!chat.isSend && <div className="relative w-8 h-8">
|
||||||
<img className={"absolute transition-opacity duration-500 scale-150 " + (lockChat ? "opacity-100" : "opacity-0")} src={AiIcon} />
|
<img className={"absolute transition-opacity duration-500 scale-150 " + (lockChat ? "opacity-100" : "opacity-0")} src={AiIcon} />
|
||||||
<img className={"absolute transition-opacity duration-500 scale-150 " + (lockChat ? "opacity-0" : "opacity-100")} src={AiIconStill} />
|
<img className={"absolute transition-opacity duration-500 scale-150 " + (lockChat ? "opacity-0" : "opacity-100")} src={AiIconStill} />
|
||||||
</div>}
|
</div>}
|
||||||
{chat.isSend && <UserIcon className="w-6 h-6 -mb-1 text-gray-800 dark:text-gray-200" />}
|
{chat.isSend && <UserIcon className="w-6 h-6 -mb-1 text-gray-800 dark:text-gray-200" />}
|
||||||
</div>
|
</div>
|
||||||
{!chat.isSend ? (
|
{!chat.isSend ? (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue