feat: 调整消息布局以便扩展

main
ChenZhaoYu 2 years ago
parent 727562f495
commit 73c9ac4d8f

@ -1,5 +1,15 @@
<script lang="ts" setup>
interface Props {
reversal?: boolean
}
defineProps<Props>()
</script>
<template> <template>
<div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']">
<span class="leading-relaxed whitespace-pre-wrap"> <span class="leading-relaxed whitespace-pre-wrap">
<slot /> <slot />
</span> </span>
</div>
</template> </template>

@ -23,9 +23,9 @@ defineProps<Props>()
<span class="text-xs text-[#b4bbc4]"> <span class="text-xs text-[#b4bbc4]">
{{ dateTime }} {{ dateTime }}
</span> </span>
<div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']"> <Text :reversal="reversal">
<Text>{{ message }}</Text> {{ message }}
</div> </Text>
</div> </div>
</div> </div>
</template> </template>

@ -92,7 +92,7 @@ function addMessage(message: string, reversal = false) {
<div class="flex items-center justify-between space-x-2"> <div class="flex items-center justify-between space-x-2">
<HoverButton tooltip="Clear conversations" @click="handleClear"> <HoverButton tooltip="Clear conversations" @click="handleClear">
<span class="text-xl text-[#4f555e]"> <span class="text-xl text-[#4f555e]">
<SvgIcon icon="ri:refresh-line" /> <SvgIcon icon="ri:delete-bin-line" />
</span> </span>
</HoverButton> </HoverButton>
<NInput v-model:value="prompt" placeholder="Type a message..." @keypress="handleEnter" /> <NInput v-model:value="prompt" placeholder="Type a message..." @keypress="handleEnter" />

Loading…
Cancel
Save