web修改ai推荐
This commit is contained in:
@@ -16,13 +16,13 @@
|
||||
|
||||
<!-- AI助手抽屉 -->
|
||||
<el-drawer
|
||||
v-model="drawerVisible"
|
||||
title=""
|
||||
direction="btt"
|
||||
size="85%"
|
||||
:show-close="false"
|
||||
class="ai-drawer"
|
||||
>
|
||||
v-model="drawerVisible"
|
||||
title=""
|
||||
direction="btt"
|
||||
size="90%"
|
||||
:show-close="false"
|
||||
class="ai-drawer"
|
||||
>
|
||||
<!-- 自定义标题栏 -->
|
||||
<template #header>
|
||||
<div class="drawer-header">
|
||||
@@ -80,7 +80,9 @@
|
||||
<img v-else src="@/assets/imgs/assistant.svg" alt="AI助手" class="welcome-avatar" />
|
||||
</div>
|
||||
<h2>你好!我是{{ agentConfig?.name || 'AI助手' }}</h2>
|
||||
<AIRecommend @select="handleRecommendSelect" />
|
||||
<div class="recommend-wrapper">
|
||||
<AIRecommend v-if="isFirstLoad" @select="handleRecommendSelect" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 对话消息列表 -->
|
||||
@@ -328,6 +330,8 @@ const messages = ref<AiMessage[]>([]);
|
||||
const inputMessage = ref('');
|
||||
const isGenerating = ref(false);
|
||||
const chatContentRef = ref<HTMLElement | null>(null);
|
||||
// 是否是第一次加载(用于控制推荐内容只在首次加载时显示)
|
||||
const isFirstLoad = ref(true);
|
||||
const inputRef = ref<HTMLTextAreaElement | null>(null);
|
||||
const uploadedFiles = ref([]);
|
||||
|
||||
@@ -381,6 +385,7 @@ function prepareNewConversation() {
|
||||
currentConversation.value = null;
|
||||
messages.value = [];
|
||||
showHistory.value = false;
|
||||
isFirstLoad.value = false; // 新建对话时不再显示推荐
|
||||
ElMessage.success('已准备新对话');
|
||||
}
|
||||
|
||||
@@ -494,7 +499,6 @@ async function sendMessage() {
|
||||
query: message,
|
||||
files: []
|
||||
}, {
|
||||
onStart: () => {},
|
||||
onInit: (initData) => {
|
||||
const lastMessage = messages.value[messages.value.length - 1];
|
||||
if (lastMessage && lastMessage.role === 'assistant') {
|
||||
@@ -511,7 +515,7 @@ async function sendMessage() {
|
||||
}
|
||||
nextTick(() => scrollToBottom());
|
||||
},
|
||||
onDifyEvent: () => {},
|
||||
onDifyEvent: () => {return},
|
||||
onMessageEnd: () => {
|
||||
isGenerating.value = false;
|
||||
},
|
||||
@@ -867,6 +871,10 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
max-width: 430px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.with-history {
|
||||
margin-left: 280px;
|
||||
@@ -881,7 +889,16 @@ onUnmounted(() => {
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
overflow-y: auto;
|
||||
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.recommend-wrapper {
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.welcome-icon {
|
||||
margin-bottom: 20px;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user