feat:调整加载样式
This commit is contained in:
@@ -12,11 +12,8 @@
|
|||||||
|
|
||||||
<!-- 消息气泡 -->
|
<!-- 消息气泡 -->
|
||||||
<div class="max-w-[70%]">
|
<div class="max-w-[70%]">
|
||||||
<div class="flex items-start gap-2 pt-0.5 mb-2"
|
<!-- 名字和时间 -->
|
||||||
:class="msg.messageRole === MessageRole.ME ? 'flex-row-reverse' : 'flex-row'">
|
<ChatNameTime :showReverse="msg.messageRole === MessageRole.ME" />
|
||||||
<span class="text-xs text-[#4E5969]"> ZHINIAN</span>
|
|
||||||
<span class="text-xs text-[#86909C]"> 20:30</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- AI 发的消息 -->
|
<!-- AI 发的消息 -->
|
||||||
<ChatRoleAI v-if="msg.messageRole === MessageRole.AI" :msg="msg" />
|
<ChatRoleAI v-if="msg.messageRole === MessageRole.AI" :msg="msg" />
|
||||||
@@ -25,9 +22,7 @@
|
|||||||
<ChatRoleMe v-if="msg.messageRole === MessageRole.ME" :msg="msg" />
|
<ChatRoleMe v-if="msg.messageRole === MessageRole.ME" :msg="msg" />
|
||||||
|
|
||||||
<!-- AI 标识 -->
|
<!-- AI 标识 -->
|
||||||
<div v-if="msg.messageRole === MessageRole.AI && msg.finished" class="mt-2 text-xs text-gray-400 ">
|
<ChatAIMark v-if="msg.messageRole === MessageRole.AI && msg.finished" />
|
||||||
本回答由 AI 生成
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- AI 操作按钮 -->
|
<!-- AI 操作按钮 -->
|
||||||
<ChatOperation v-if="msg.messageRole === MessageRole.AI && msg.finished" :msg="msg" />
|
<ChatOperation v-if="msg.messageRole === MessageRole.AI && msg.finished" :msg="msg" />
|
||||||
@@ -79,6 +74,8 @@ import ChatAvatar from './components/ChatAvatar.vue';
|
|||||||
import ChatOperation from './components/ChatOperation.vue';
|
import ChatOperation from './components/ChatOperation.vue';
|
||||||
import ChatRoleAI from './components/ChatRoleAI.vue';
|
import ChatRoleAI from './components/ChatRoleAI.vue';
|
||||||
import ChatRoleMe from './components/ChatRoleMe.vue';
|
import ChatRoleMe from './components/ChatRoleMe.vue';
|
||||||
|
import ChatAIMark from './components/ChatAIMark.vue';
|
||||||
|
import ChatNameTime from './components/ChatNameTime.vue';
|
||||||
|
|
||||||
import { Session } from '../../utils/storage';
|
import { Session } from '../../utils/storage';
|
||||||
|
|
||||||
|
|||||||
5
src/renderer/views/home/components/ChatAIMark.vue
Normal file
5
src/renderer/views/home/components/ChatAIMark.vue
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mt-2 text-xs text-gray-400 ">
|
||||||
|
本回答由 AI 生成
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
50
src/renderer/views/home/components/ChatLoading.vue
Normal file
50
src/renderer/views/home/components/ChatLoading.vue
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<template>
|
||||||
|
<div class="wave">
|
||||||
|
<div class="dot"></div>
|
||||||
|
<div class="dot"></div>
|
||||||
|
<div class="dot"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script></script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.wave {
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
width: 30px;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
display: inline-block;
|
||||||
|
width: 3px;
|
||||||
|
height: 3px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 3px;
|
||||||
|
background: #333333;
|
||||||
|
animation: wave 1.3s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot:nth-child(2) {
|
||||||
|
animation-delay: -1.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot:nth-child(3) {
|
||||||
|
animation-delay: -0.9s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes wave {
|
||||||
|
|
||||||
|
0%,
|
||||||
|
60%,
|
||||||
|
100% {
|
||||||
|
transform: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
30% {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
17
src/renderer/views/home/components/ChatNameTime.vue
Normal file
17
src/renderer/views/home/components/ChatNameTime.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex items-start gap-2 pt-0.5 mb-2" :class="showReverse ? 'flex-row-reverse' : 'flex-row'">
|
||||||
|
<span class="text-xs text-[#4E5969]"> ZHINIAN</span>
|
||||||
|
<span class="text-xs text-[#86909C]"> 20:30</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
interface Props {
|
||||||
|
showReverse: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
withDefaults(defineProps<Props>(), {
|
||||||
|
showReverse: false
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="text-sm text-gray-700" v-html="compiledMarkdown">
|
<div class="text-sm text-gray-700 flex flex-row">
|
||||||
|
<div v-html="compiledMarkdown"></div>
|
||||||
|
<ChatLoading v-if="msg.isLoading" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -9,6 +11,7 @@ import { computed } from 'vue'
|
|||||||
import MarkdownIt from 'markdown-it'
|
import MarkdownIt from 'markdown-it'
|
||||||
import hljs from 'highlight.js'
|
import hljs from 'highlight.js'
|
||||||
import 'highlight.js/styles/github.css'
|
import 'highlight.js/styles/github.css'
|
||||||
|
import ChatLoading from './ChatLoading.vue';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
msg: ChatMessage
|
msg: ChatMessage
|
||||||
|
|||||||
Reference in New Issue
Block a user