feat: agent对话
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="agent-item">
|
||||
<div class="message-wrapper flex align-center" :class="{ 'is-user': content.isUser }">
|
||||
<div class="message-wrapper flex" :class="{ 'is-user': content.isUser }">
|
||||
<div class="thumb">
|
||||
<img :src="content.isUser ? userThumb : agentThumb" class="thumb-icon" />
|
||||
</div>
|
||||
<div class="message-context">
|
||||
<div class="message-context" v-show="!content.loading && !content.thinking && !content.streaming">
|
||||
<div class="message-txt">{{ content.text }}</div>
|
||||
<div class="operate flex" :class="{ 'is-user': content.isUser }">
|
||||
<template v-if="content.isUser">
|
||||
@@ -22,13 +22,33 @@
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="message-context" v-show="content.loading">
|
||||
<div class="generating">
|
||||
Generating...
|
||||
</div>
|
||||
</div>
|
||||
<div class="message-context" v-show="content.thinking">
|
||||
<div class="thinking">
|
||||
<div class="thinking-header flex align-center" @click="toggleThinkingCollapsed">
|
||||
<span>思考中</span>
|
||||
<!-- <SvgIcon :name="content.thinkingCollapsed ? 'arrowDown' : 'arrowUp'" size="16" color="#666" /> -->
|
||||
</div>
|
||||
<div class="thinking-content" v-show="!content.thinkingCollapsed">
|
||||
<pre>{{ content.thinkingText }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="message-context" v-show="content.streaming">
|
||||
<div class="message-txt">{{ content.text }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import gsap from 'gsap'
|
||||
import userThumb from '@/assets/images/user-thumb.jpg'
|
||||
import agentThumb from '@/assets/images/agent-thumb.jpg'
|
||||
|
||||
@@ -65,6 +85,8 @@
|
||||
}
|
||||
])
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const handleCopyText = () => {
|
||||
navigator.clipboard
|
||||
.writeText(props.content.text)
|
||||
@@ -85,6 +107,16 @@
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const toggleThinkingCollapsed = () => {
|
||||
props.content.thinkingCollapsed = !props.content.thinkingCollapsed
|
||||
}
|
||||
|
||||
const playLoadingAnimate = () => {}
|
||||
|
||||
onMounted(() => {
|
||||
// playLoadingAnimate()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -97,6 +129,7 @@
|
||||
font-size: 1.4rem;
|
||||
.message-wrapper {
|
||||
column-gap: 0.9rem;
|
||||
// align-items: flex-start;
|
||||
&.is-user {
|
||||
text-align: right;
|
||||
flex-direction: row-reverse;
|
||||
@@ -124,4 +157,54 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.generating {
|
||||
font-family: 'GeneralBold';
|
||||
font-weight: 600;
|
||||
font-size: 1.55rem;
|
||||
background: linear-gradient(45deg, #f2ab4a, #ff6b75, #fe3b55);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.thinking {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
background-color: #f9f9f9;
|
||||
|
||||
.thinking-header {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.thinking-content {
|
||||
margin-top: 0.5rem;
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
font-family: inherit;
|
||||
font-size: 1.2rem;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @supports (-webkit-mask-image: url(#mask)) or (mask-image: url(#mask)) {
|
||||
// .generating::after {
|
||||
// content: '';
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// left: 0;
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// background: url('path-to-noise-texture.png'); /* Replace with a noise texture image sized appropriately (e.g., small grain at 0.03 scale) */
|
||||
// opacity: 1; /* 100% density */
|
||||
// mix-blend-mode: color; /* Approximate duotone blending */
|
||||
// -webkit-mask-image: -webkit-linear-gradient(#c05f20, #290d99);
|
||||
// mask-image: linear-gradient(#c05f20, #290d99);
|
||||
// }
|
||||
// }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user