feature/zoujing #4

Open
zoujing wants to merge 15 commits from feature/zoujing into main
5 changed files with 81 additions and 9 deletions
Showing only changes of commit b8cdf530fc - Show all commits

View File

@@ -12,11 +12,8 @@
<!-- 消息气泡 -->
<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'">
<span class="text-xs text-[#4E5969]"> ZHINIAN</span>
<span class="text-xs text-[#86909C]"> 20:30</span>
</div>
<!-- 名字和时间 -->
<ChatNameTime :showReverse="msg.messageRole === MessageRole.ME" />
<!-- AI 发的消息 -->
<ChatRoleAI v-if="msg.messageRole === MessageRole.AI" :msg="msg" />
@@ -25,9 +22,7 @@
<ChatRoleMe v-if="msg.messageRole === MessageRole.ME" :msg="msg" />
<!-- AI 标识 -->
<div v-if="msg.messageRole === MessageRole.AI && msg.finished" class="mt-2 text-xs text-gray-400 ">
本回答由 AI 生成
</div>
<ChatAIMark v-if="msg.messageRole === MessageRole.AI && msg.finished" />
<!-- AI 操作按钮 -->
<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 ChatRoleAI from './components/ChatRoleAI.vue';
import ChatRoleMe from './components/ChatRoleMe.vue';
import ChatAIMark from './components/ChatAIMark.vue';
import ChatNameTime from './components/ChatNameTime.vue';
import { Session } from '../../utils/storage';

View File

@@ -0,0 +1,5 @@
<template>
<div class="mt-2 text-xs text-gray-400 ">
本回答由 AI 生成
</div>
</template>

View 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>

View 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>

View File

@@ -1,5 +1,7 @@
<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>
</template>
@@ -9,6 +11,7 @@ import { computed } from 'vue'
import MarkdownIt from 'markdown-it'
import hljs from 'highlight.js'
import 'highlight.js/styles/github.css'
import ChatLoading from './ChatLoading.vue';
interface Props {
msg: ChatMessage