- createChatClient: bearer auth, one refresh-and-retry on 401, 422 field errors
- useChat over useState: host bootstrap, open a channel, send
- ChatPage, ChatChannelList, ChatMessageList, ChatComposer
- runtime config chat.apiBase, public.chat.{apiBase,channelsApiBase,botsApiBase,hostApiBase}
17 lines
596 B
Vue
17 lines
596 B
Vue
<script setup lang="ts">
|
|
// The messages of one conversation, oldest first, as plain text.
|
|
const props = defineProps<{ conversationId: number }>()
|
|
const { t } = useI18n()
|
|
const chat = useChat()
|
|
const list = computed(() => chat.messages.value[props.conversationId] ?? [])
|
|
</script>
|
|
|
|
<template>
|
|
<div class="chat-list" role="log" :aria-label="t('chat.messages')">
|
|
<article v-for="m in list" :key="m.id" class="chat-msg" :data-message-id="m.id">
|
|
<span class="chat-msg-name">{{ m.sender_name }}</span>
|
|
<p class="chat-msg-body">{{ m.content }}</p>
|
|
</article>
|
|
</div>
|
|
</template>
|