Skip to content

Commit

Permalink
Merge pull request #229 from iceljc/features/refine-chat-window
Browse files Browse the repository at this point in the history
replace text
  • Loading branch information
iceljc authored Sep 30, 2024
2 parents aef073b + b336fd0 commit 1187c03
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/lib/common/Markdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
/** @type {string} */
export let containerClasses = "";
/** @type {boolean} */
export let replaceText = false;
let displayText = '';
$: {
const markedText = replaceNewLine(marked(replaceMarkdown(text || ''))?.toString());
const markedText = replaceNewLine(marked(replaceText ? replaceMarkdown(text || '') : text || '')?.toString());
if (!!markedText && markedText.endsWith('<br>')) {
const idx = markedText.lastIndexOf('<br>');
displayText = markedText.substring(0, idx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
style="padding: 5px 8px;"
>
<div class:log-collapse={includedSources.includes(data.source) && !!is_collapsed}>
<Markdown containerClasses={logTextStyle} text={data?.content} />
<Markdown containerClasses={logTextStyle} text={data?.content} replaceText />
</div>

{#if includedSources.includes(data.source)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<Markdown
containerClasses={'dialog-item-text'}
text={dialog?.rich_content?.message?.text || dialog?.text}
replaceText
/>
</div>

Expand Down

0 comments on commit 1187c03

Please sign in to comment.