This commit is contained in:
2026-02-26 22:05:39 +08:00
parent 3bbb28677b
commit c121f03ad1

View File

@@ -144,11 +144,17 @@
<!-- 底部操作栏 -->
<div class="card-footer">
<button class="chat-btn" @click.stop="handleChat(agent)">
<MessageOutlined class="chat-btn-icon" />
<div class="footer-actions">
<button class="action-btn" @click.stop="handleHistory(agent)">
<HistoryOutlined class="action-btn-icon" />
<span>历史</span>
</button>
<button class="action-btn action-btn--primary" @click.stop="handleChat(agent)">
<MessageOutlined class="action-btn-icon" />
<span>对话</span>
</button>
</div>
</div>
</article>
</div>
</template>
@@ -170,6 +176,13 @@
:agent="currentAgent"
@send="handleSendMessage"
/>
<!-- 历史记录面板 -->
<HistoryPanel
:visible="historyPanelVisible"
:agent-id="historyAgentId"
@close="closeHistoryPanel"
/>
</FullWidthLayout>
</template>
@@ -182,11 +195,13 @@ import {
MessageOutlined,
AppstoreOutlined,
StarOutlined,
StarFilled
StarFilled,
HistoryOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import FullWidthLayout from '@/layouts/components/FullWidthLayout.vue'
import ChatDrawer from '@/components/agents/ChatDrawer.vue'
import HistoryPanel from '@/components/agents/HistoryPanel.vue'
import { getAgentList, addFavorite, removeFavorite } from '@/api/agent'
import tokenManager from '@gold/utils/token-manager'
@@ -200,6 +215,8 @@ const categoryScrollRef = ref(null)
const expandTriggerRef = ref(null)
const showCategoryPanel = ref(false)
const panelTop = ref(0)
const historyPanelVisible = ref(false)
const historyAgentId = ref(null)
// 面板样式
const panelStyle = computed(() => ({
@@ -339,6 +356,20 @@ const handleChat = (agent) => {
chatDrawerVisible.value = true
}
const handleHistory = (agent) => {
// 检查登录状态
if (!tokenManager.isLoggedIn()) {
message.warning('请先登录')
return
}
historyAgentId.value = agent.id
historyPanelVisible.value = true
}
const closeHistoryPanel = () => {
historyPanelVisible.value = false
}
const handleSendMessage = (data) => {
console.log('发送消息:', data)
}
@@ -798,7 +829,7 @@ onMounted(() => {
.card-footer {
display: flex;
align-items: center;
justify-content: center;
justify-content: flex-end;
padding: 12px 16px;
border-top: 1px solid #F3F4F6;
background: #FAFAFA;
@@ -807,31 +838,50 @@ onMounted(() => {
transition: all 0.25s ease;
}
.chat-btn {
.footer-actions {
display: flex;
align-items: center;
gap: 8px;
}
.action-btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 14px;
background: #111827;
border: none;
gap: 5px;
padding: 6px 12px;
background: white;
border: 1px solid #E5E7EB;
border-radius: 8px;
font-size: 12px;
font-weight: 500;
color: white;
color: #6B7280;
cursor: pointer;
transition: all 0.2s ease;
&:hover {
background: #1F2937;
transform: scale(1.02);
border-color: #D1D5DB;
background: #F9FAFB;
color: #374151;
}
&:active {
transform: scale(0.98);
}
&--primary {
background: #111827;
border-color: #111827;
color: white;
&:hover {
background: #1F2937;
border-color: #1F2937;
color: white;
}
}
}
.chat-btn-icon {
.action-btn-icon {
font-size: 13px;
}