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

View File

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