Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine.
Browse files Browse the repository at this point in the history
mathewjordan committed Mar 6, 2024
1 parent 4c2d5c2 commit 519ed5b
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions components/Chat/components/Response/StreamedAnswer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { StyledCursor, StyledStreamedAnswer } from "./Response.styled";

import React from "react";
import { StyledStreamedAnswer } from "./Response.styled";
import useMarkdown from "@/hooks/useMarkdown";

const ResponseStreamedAnswer = ({
7 changes: 5 additions & 2 deletions hooks/useMarkdown.tsx
Original file line number Diff line number Diff line change
@@ -32,9 +32,12 @@ function useMarkdown({
const result = await processor.process(preparedMarkdown);
const htmlContent = String(result);

const regex = new RegExp(cursor, "g");
const cursorRegex = new RegExp(cursor, "g");
const updatedHtml = hasCursor
? htmlContent.replace(regex, `<span class="markdown-cursor"></span>`)
? htmlContent.replace(
cursorRegex,
`<span class="markdown-cursor"></span>`
)
: htmlContent;

setHtml(updatedHtml);

0 comments on commit 519ed5b

Please sign in to comment.