Browse Source

思考过程加入动图;

master
宋杰 1 week ago
parent
commit
b6d8d2db8a
  1. BIN
      src/assets/img/gif/思考.gif
  2. BIN
      src/assets/img/gif/生成.gif
  3. BIN
      src/assets/img/gif/解析.gif
  4. 69
      src/views/AIchat.vue
  5. 74
      src/views/AiEmotion.vue

BIN
src/assets/img/gif/思考.gif

After

Width: 150  |  Height: 150  |  Size: 5.6 KiB

BIN
src/assets/img/gif/生成.gif

After

Width: 150  |  Height: 150  |  Size: 29 KiB

BIN
src/assets/img/gif/解析.gif

After

Width: 150  |  Height: 150  |  Size: 90 KiB

69
src/views/AIchat.vue

@ -690,7 +690,8 @@ async function showThinkingProcess(stockName = null) {
class: 'ing', class: 'ing',
type: 'ing', type: 'ing',
flag: true, flag: true,
content: '正在思考......'
content: '正在思考......',
gif: '/src/assets/img/gif/思考.gif'
}); });
chatStore.messages.push(thinkingMessage1); chatStore.messages.push(thinkingMessage1);
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
@ -702,7 +703,8 @@ async function showThinkingProcess(stockName = null) {
class: 'ing', class: 'ing',
type: 'ing', type: 'ing',
flag: true, flag: true,
content: '正在解析关键数据......'
content: '正在解析关键数据......',
gif: '/src/assets/img/gif/解析.gif'
}); });
chatStore.messages.push(thinkingMessage2); chatStore.messages.push(thinkingMessage2);
@ -721,7 +723,8 @@ async function showThinkingProcess(stockName = null) {
class: 'ing', class: 'ing',
type: 'ing', type: 'ing',
flag: true, flag: true,
content: `正在生成${stockName}全景作战报告......`
content: `正在生成${stockName}全景作战报告......`,
gif: '/src/assets/img/gif/生成.gif'
}); });
chatStore.messages.push(thinkingMessage3); chatStore.messages.push(thinkingMessage3);
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
@ -733,7 +736,8 @@ async function showThinkingProcess(stockName = null) {
class: 'ing', class: 'ing',
type: 'ing', type: 'ing',
flag: true, flag: true,
content: '报告已生成!'
content: '报告已生成!',
gif: '/src/assets/img/gif/生成.gif'
}); });
chatStore.messages.push(thinkingMessage4); chatStore.messages.push(thinkingMessage4);
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
@ -761,7 +765,8 @@ async function continueThinkingProcess(thinkingMessageRef, stockName) {
class: 'ing', class: 'ing',
type: 'ing', type: 'ing',
flag: true, flag: true,
content: `正在生成${stockName}全景作战报告......`
content: `正在生成${stockName}全景作战报告......`,
gif: '/src/assets/img/gif/生成.gif'
}); });
chatStore.messages.push(thinkingMessage3); chatStore.messages.push(thinkingMessage3);
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
@ -4209,7 +4214,9 @@ onUnmounted(() => {
</div> </div>
</div> </div>
</div> </div>
<div v-else-if="msg.type == 'ing'">
<div v-else-if="msg.type == 'ing'" class="ai-message-container">
<img v-if="msg.gif" :src="msg.gif" alt="思考过程" class="thinking-gif" />
<div class="ai-message-content">
<div v-if="msg.flag"> <div v-if="msg.flag">
<span>{{ msg.content }}</span> <span>{{ msg.content }}</span>
<span class="loading-dots"> <span class="loading-dots">
@ -4223,6 +4230,7 @@ onUnmounted(() => {
</div> </div>
<div v-else v-html="msg.content"></div> <div v-else v-html="msg.content"></div>
</div> </div>
</div>
<div v-else-if="msg.type == 'title1'" style="display: flex; width: 100%"> <div v-else-if="msg.type == 'title1'" style="display: flex; width: 100%">
<div class="mainTitle"> <div class="mainTitle">
{{ msg.content }} {{ msg.content }}
@ -4459,7 +4467,6 @@ p {
max-width: 80%; max-width: 80%;
margin: 10px 0px; margin: 10px 0px;
padding: 15px 20px; padding: 15px 20px;
position: relative; position: relative;
} }
@ -4467,9 +4474,10 @@ p {
.user-message-container { .user-message-container {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
margin: 10px 0;
margin: 10px 0px;
justify-content: flex-end; justify-content: flex-end;
gap: 10px; gap: 10px;
align-items: center;
} }
.user-message-speaker { .user-message-speaker {
@ -4507,7 +4515,9 @@ p {
font-weight: bold; font-weight: bold;
border-radius: 10px; border-radius: 10px;
margin: 0; margin: 0;
/* border-bottom-right-radius: 5px; */
width: fit-content;
display: flex;
align-items: center;
} }
.message-bubble.ai { .message-bubble.ai {
@ -4524,7 +4534,9 @@ p {
border-radius: 10px; border-radius: 10px;
margin-left: 20px; margin-left: 20px;
margin-right: auto; margin-right: auto;
/* border-bottom-left-radius: 5px; */
display: flex;
align-items: center;
width: fit-content;
} }
.message-bubble.ai.title1 { .message-bubble.ai.title1 {
@ -4734,4 +4746,41 @@ p {
height: 80%; height: 80%;
width: 90%; width: 90%;
} }
/* AI消息容器样式 */
.ai-message-container {
display: flex;
align-items: flex-start;
gap: 10px;
margin-right: auto;
max-width: 80%;
}
/* 思考过程动图样式 */
.thinking-gif {
width: 40px;
height: 40px;
object-fit: contain;
margin-top: 5px;
border-radius: 8px;
animation: float 2s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0px);
}
50% {
transform: translateY(-5px);
}
}
/* AI消息内容样式 */
.ai-message-content {
display: flex;
align-items: center;
white-space: nowrap;
width: fit-content;
overflow: visible;
}
</style> </style>

74
src/views/AiEmotion.vue

@ -27,12 +27,18 @@
</div> </div>
</div> </div>
<!-- AI返回结果 --> <!-- AI返回结果 -->
<div v-if="message.sender === 'ai'" class="message-bubble ai-message">
<div v-if="message.sender === 'ai'" class="ai-message-container">
<!-- 思考过程动图 -->
<!-- <img v-if="message.gif" :src="message.gif" class="thinking-gif" alt="思考动图" /> -->
<div class="message-bubble ai-message">
<!-- 思考过程动图 -->
<img v-if="message.gif" :src="message.gif" class="thinking-gif" alt="思考动图" />
{{ message.text }} {{ message.text }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- 加载提示 --> <!-- 加载提示 -->
<div v-if="isLoading" class="loading-container"> <div v-if="isLoading" class="loading-container">
<div class="loading-content"> <div class="loading-content">
@ -970,13 +976,21 @@ function startImageRotation() {
// //
async function showThinkingProcess(stockName = null) { async function showThinkingProcess(stockName = null) {
// //
const thinkingMessage1 = reactive({ sender: 'ai', text: '正在思考......' });
const thinkingMessage1 = reactive({
sender: 'ai',
text: 'AI情绪大模型正在思考......',
gif: '/src/assets/img/gif/思考.gif'
});
messages.value.push(thinkingMessage1); messages.value.push(thinkingMessage1);
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
messages.value.pop(); messages.value.pop();
// //
const thinkingMessage2 = reactive({ sender: 'ai', text: '正在解析关键数据......' });
const thinkingMessage2 = reactive({
sender: 'ai',
text: 'AI情绪大模型正在解析关键数据......',
gif: '/src/assets/img/gif/解析.gif'
});
messages.value.push(thinkingMessage2); messages.value.push(thinkingMessage2);
// //
@ -989,7 +1003,11 @@ async function showThinkingProcess(stockName = null) {
messages.value.pop(); messages.value.pop();
// //
const thinkingMessage3 = reactive({ sender: 'ai', text: `正在生成${stockName}量子四维矩阵图......` });
const thinkingMessage3 = reactive({
sender: 'ai',
text: `AI情绪大模型正在生成${stockName}量子四维矩阵图......`,
gif: '/src/assets/img/gif/生成.gif'
});
messages.value.push(thinkingMessage3); messages.value.push(thinkingMessage3);
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
messages.value.pop(); messages.value.pop();
@ -1017,7 +1035,11 @@ async function continueThinkingProcess(thinkingMessageRef, stockName) {
} }
// //
const thinkingMessage3 = reactive({ sender: 'ai', text: `正在生成${stockName}量子四维矩阵图......` });
const thinkingMessage3 = reactive({
sender: 'ai',
text: `正在生成${stockName}量子四维矩阵图......`,
gif: '/src/assets/img/gif/生成.gif'
});
messages.value.push(thinkingMessage3); messages.value.push(thinkingMessage3);
// 便 // 便
@ -2678,7 +2700,7 @@ const emit = defineEmits(['updateMessage', 'sendMessage', 'ensureAIchat']);
/* 用户消息容器样式 */ /* 用户消息容器样式 */
.user-message-container { .user-message-container {
display: flex; display: flex;
align-items: flex-start;
align-items: center;
margin-left: auto; margin-left: auto;
gap: 10px; gap: 10px;
} }
@ -2716,7 +2738,7 @@ const emit = defineEmits(['updateMessage', 'sendMessage', 'ensureAIchat']);
color: #6d22f8; color: #6d22f8;
background: white; background: white;
font-weight: bold; font-weight: bold;
padding: 20px 20px;
padding: 15px 20px;
border-radius: 15px; border-radius: 15px;
max-width: 60%; max-width: 60%;
text-align: left; text-align: left;
@ -2725,18 +2747,48 @@ const emit = defineEmits(['updateMessage', 'sendMessage', 'ensureAIchat']);
/* 将用户消息推到右边 */ /* 将用户消息推到右边 */
} }
/* AI消息容器样式 */
.ai-message-container {
display: flex;
align-items: flex-start;
gap: 10px;
margin-right: auto;
max-width: 80%;
}
/* 思考过程动图样式 */
.thinking-gif {
width: 40px;
height: 40px;
object-fit: contain;
margin-top: 5px;
border-radius: 8px;
animation: float 2s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0px);
}
50% {
transform: translateY(-5px);
}
}
.ai-message { .ai-message {
background-color: #f1f1f1; background-color: #f1f1f1;
color: #333; color: #333;
font-weight: bold; font-weight: bold;
padding: 10px 15px;
padding: 20px 30px;
border-radius: 15px; border-radius: 15px;
max-width: 60%;
text-align: left; text-align: left;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
margin-right: auto; margin-right: auto;
/* 将AI消息保持在左边 */ /* 将AI消息保持在左边 */
padding: 20px 20px;
white-space: nowrap;
width: fit-content;
overflow: visible;
align-items: center;
display: flex;
} }
.input-container { .input-container {

Loading…
Cancel
Save