From 543e89ba4694d6b220b130a9b35eba01197d6a4a Mon Sep 17 00:00:00 2001 From: PleahMaCaka Date: Thu, 2 Nov 2023 15:59:50 +0900 Subject: [PATCH] fix(textarea/translate): shows the original message --- src/lib/client/Client.ts | 7 ++++++- src/lib/components/share/ChatInput.svelte | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/client/Client.ts b/src/lib/client/Client.ts index e9fbdf8..51a34e7 100644 --- a/src/lib/client/Client.ts +++ b/src/lib/client/Client.ts @@ -68,6 +68,7 @@ export const client = new class Client { // TODO get char/inst/preset from settings and/or env vars public async send( msg: string, + visibleMessage?: string | undefined, char: string = "Commander", inst: string = "Commander", preset: string = "Commander" @@ -77,7 +78,11 @@ export const client = new class Client { if (this._modelUrl === "") return // TODO do something for empty url - await this.appendHistory(Author.User, msg) + if (visibleMessage !== undefined) + await this.appendHistory(Author.User, visibleMessage) + else + await this.appendHistory(Author.User, msg) + await this.appendHistory(Author.Assistant, "...") // TODO add loading animation or anything blabla await this.llm.chat(msg, { diff --git a/src/lib/components/share/ChatInput.svelte b/src/lib/components/share/ChatInput.svelte index 500b43e..cae30a1 100644 --- a/src/lib/components/share/ChatInput.svelte +++ b/src/lib/components/share/ChatInput.svelte @@ -29,7 +29,7 @@ if (get(stateStore).debug) console.log("Translated Text Submit: ", translated) - await client.send(translated) + await client.send(translated, $stateStore.input) } else { await client.send($stateStore.input) }