diff --git a/src/app.scss b/src/app.scss index 805bfc8..663fdf2 100644 --- a/src/app.scss +++ b/src/app.scss @@ -94,4 +94,16 @@ div.copy-prompt { position: absolute; top: 5px; right: 5px; +} + +.message-container{ + display: flex; + flex-direction: column; + height: 720px; +} +.message-list{ + // max-height: 100%; + overflow-y: auto; + flex: 1; + margin-bottom: 10px; } \ No newline at end of file diff --git a/src/lib/Chat.svelte b/src/lib/Chat.svelte index f9c7925..2023221 100644 --- a/src/lib/Chat.svelte +++ b/src/lib/Chat.svelte @@ -102,7 +102,7 @@ // Scroll to the bottom of the page after any updates to the messages array window.scrollTo(0, document.body.scrollHeight); input.focus(); - copyFunction() + copyFunction(); }); // Marked options @@ -286,7 +286,13 @@ const copyPrompt = document.createElement("div"); copyPrompt.className = "copy-prompt"; const copyPromptText = document.createElement("button"); - copyPromptText.classList.add("button", "is-light", "is-outlined", "is-small", "is-responsive"); + copyPromptText.classList.add( + "button", + "is-light", + "is-outlined", + "is-small", + "is-responsive" + ); copyPromptText.innerHTML = showCopyMessage; copyPrompt.appendChild(copyPromptText); block.appendChild(copyPrompt); @@ -301,7 +307,7 @@ }, 1000); }); }); - } + }; - -{#each chat.messages as message} - {#if message.role === "user"} -
line.trim()).length === 1} - > -
-
- {:else if message.role === "system" || message.role === "error"} -
-
- -
-
- {:else} -
-
- - {#if message.usage} -

- This message was generated using {message.usage.total_tokens} +

+ + + + {:else if message.role === "system" || message.role === "error"} +
+
+ +
+
+ {:else} +
+
+ + {#if message.usage} +

+ This message was generated using {message.usage.total_tokens} + tokens ~= + ${(message.usage.total_tokens * token_price).toFixed( + 6 + )} +

+ {/if} +
+
+ {/if} + {/each} + +
+ {#if updating} + + {/if} -{#if updating} - -{/if} - -
submitForm()} -> -

-