Skip to content

Commit

Permalink
feat: input
Browse files Browse the repository at this point in the history
  • Loading branch information
nekomeowww committed Dec 20, 2024
1 parent 8492d66 commit 7c65fce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
25 changes: 23 additions & 2 deletions packages/stage/src/components/Layouts/InteractiveArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ const { audioInputs } = useDevicesList({ constraints: { audio: true }, requestPe
const { selectedAudioDevice, isAudioInputOn, selectedAudioDeviceId } = storeToRefs(useSettings())
const { send, onAfterSend } = useChatStore()
const { audioContext } = useAudioContext()
const { t } = useI18n()
const { transcribe: generate, load: loadWhisper, status: whisperStatus, terminate } = useWhisper(WhisperWorker, {
onComplete: async (res) => {
await send(res)
},
})
async function handleSend() {
await send(messageInput.value)
}
const { destroy, start } = useMicVAD(selectedAudioDeviceId, {
onSpeechStart: () => {
// TODO: interrupt the playback
Expand Down Expand Up @@ -154,8 +159,24 @@ onAfterSend(async () => {
</label>
</fieldset>
<div h-full max-h="[85vh]" w-full px-12 py-4>
<div border="solid 4 pink-100 dark:pink-400/20" h-full w-full overflow-scroll rounded-xl p-4>
<ChatHistory />
<div
flex="~ col"
border="solid 4 pink-100 dark:pink-400/20"
h-full w-full overflow-scroll rounded-xl
>
<ChatHistory h-full flex-1 p-4 w="full" max-h="[80vh]" />
<div flex gap-2>
<BasicTextarea
v-model="messageInput"
:placeholder="t('stage.message')"
text="pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500 placeholder:pink-300 placeholder:hover:pink-500 placeholder:dark:pink-300/50 placeholder:dark:hover:pink-500"
bg="pink-100 dark:pink-400/20"
min-h="[100px]" w-full
rounded-xl p-4 font-medium
outline-none transition="all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out"
@submit="handleSend"
/>
</div>
</div>
</div>
<div flex="~ row" gap-2>
Expand Down
4 changes: 2 additions & 2 deletions packages/stage/src/components/Widgets/ChatHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ onTokenLiteral(async () => {
<div
relative
class="<lg:(absolute bottom-0 from-zinc-100/80 to-zinc-800/0 bg-gradient-to-t p-2 dark:from-zinc-800/80)"
px="<sm:2" py="<sm:2" w="full" flex="~ col 1"
rounded="lg" max-h="[80vh]"
px="<sm:2" py="<sm:2" flex="~ col"
rounded="lg"
overflow-hidden
>
<div ref="chatHistoryRef" v-auto-animate h-full w-full overflow-scroll>
Expand Down

0 comments on commit 7c65fce

Please sign in to comment.