WIP push-to-talk Letta chat frontend
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

run formatters

+12 -10
+12 -10
src/routes/+page.svelte
··· 1 1 <script lang="ts"> 2 - import { invoke, Channel } from "@tauri-apps/api/core"; 2 + import { Channel, invoke } from "@tauri-apps/api/core"; 3 3 4 4 interface TranscriptionWord { 5 5 word: string; ··· 9 9 10 10 let isRecording = $state(false); 11 11 let draft = $state(""); 12 - let history = $state(new Array<string>()) 12 + let history = $state(new Array<string>()); 13 13 let keyInvocation = $state( 14 14 invoke("has_secret", { name: "cartesia_api_key" }), 15 15 ); 16 16 17 17 $effect(async () => { 18 18 if (isRecording) { 19 - const onEvent = new Channel<TranscriptionWord>() 19 + const onEvent = new Channel<TranscriptionWord>(); 20 20 21 - onEvent.onmessage = word => { 22 - draft += word.word 23 - } 24 - 21 + onEvent.onmessage = (word) => { 22 + draft += word.word; 23 + }; 24 + 25 25 invoke("start_stt", { onEvent }); 26 26 } else { 27 27 await invoke("stop_stt"); 28 28 29 29 if (draft) { 30 - history.unshift(draft) 31 - draft = "" 30 + history.unshift(draft); 31 + draft = ""; 32 32 } 33 33 } 34 34 }); ··· 92 92 </div> 93 93 94 94 {#if draft} 95 - <div class="bg-rose-pine-surface bg-rose-pine-subtle italic rounded-md p-3 flex gap-3 shadow-xl"> 95 + <div 96 + class="bg-rose-pine-surface bg-rose-pine-subtle italic rounded-md p-3 flex gap-3 shadow-xl" 97 + > 96 98 {draft} 97 99 </div> 98 100 {/if}