-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #269 from iceljc/features/refine-chat-window
Features/refine chat window
- Loading branch information
Showing
13 changed files
with
147 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script> | ||
/** @type {string} */ | ||
export let lang; | ||
/** @type {string} */ | ||
export let text; | ||
/** @type {boolean} */ | ||
let copied = false; | ||
function copyToClipboard() { | ||
navigator.clipboard.writeText(text).then(() => { | ||
setTimeout(() => { | ||
copied = false; | ||
}, 800); | ||
}); | ||
} | ||
</script> | ||
|
||
|
||
<div class="code-block"> | ||
<div class="code-header"> | ||
<div class="line-align-center fw-bold"> | ||
{lang || ''} | ||
</div> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<!-- svelte-ignore a11y-no-static-element-interactions --> | ||
<div | ||
class="line-align-center copy-btn" | ||
data-bs-toggle="tooltip" | ||
data-bs-placement="top" | ||
title="Copy" | ||
on:mouseup={() => copyToClipboard()} | ||
on:mousedown={() => copied = true} | ||
> | ||
{#if copied} | ||
<div class="div-center"> | ||
<div class="line-align-center"> | ||
<i class="bx bx-check" style="font-size: 18px;" /> | ||
</div> | ||
<div class="line-align-center"> | ||
<span style="font-size: 10px;">{'Copied!'}</span> | ||
</div> | ||
</div> | ||
{:else} | ||
<i class="bx bx-copy clickable" /> | ||
{/if} | ||
</div> | ||
</div> | ||
<pre> | ||
<code class={`language-${lang}`}> | ||
<div>{text}</div> | ||
</code> | ||
</pre> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script> | ||
import SvelteMarkdown from 'svelte-markdown'; | ||
import { replaceMarkdown, replaceNewLine } from '$lib/helpers/http'; | ||
import CodeBlock from './CodeBlock.svelte'; | ||
/** @type {string} */ | ||
export let text; | ||
/** @type {string} */ | ||
export let containerClasses = ""; | ||
/** @type {string} */ | ||
export let containerStyles = ""; | ||
/** @type {boolean} */ | ||
export let rawText = false; | ||
let innerText = ''; | ||
$: { | ||
innerText = !rawText ? replaceNewLine(replaceMarkdown(text || '')) : text; | ||
} | ||
</script> | ||
|
||
<div | ||
class={`markdown-container markdown-lite ${containerClasses || 'text-white'}`} | ||
style={`${containerStyles}`} | ||
> | ||
<!-- {@html innerText} --> | ||
<SvelteMarkdown | ||
source={innerText} | ||
renderers={{ | ||
code: CodeBlock | ||
}} | ||
/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.code-block { | ||
position: relative; | ||
background-color: black; | ||
color: white; | ||
border-radius: 5px; | ||
padding: 5px 10px; | ||
|
||
pre { | ||
margin: 0px !important; | ||
white-space: pre !important; | ||
overflow-x: auto; | ||
scrollbar-width: thin; | ||
max-width: 100%; | ||
} | ||
|
||
.code-header { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ | |
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: 10; | ||
max-height: 300px; | ||
} |
2 changes: 1 addition & 1 deletion
2
src/routes/chat/[agentId]/[conversationId]/persist-log/content-log-element.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/routes/chat/[agentId]/[conversationId]/rich-content/rc-message.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/routes/page/conversation/[conversationId]/conv-dialog-element.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters