ForcePilot/web/src/views/AgentSingleView.vue
Wenjie Zhang a292e69b22 feat: 添加消息记录云端保存
主要修改:
1. 服务端新增 Thread 模型,用于存储对话列表信息,但不保存实际的历史记录
2. langgraph 配置了 InMemorySaver,添加 thread_id 参数,消息对话保存在内存中(服务重启后丢失)
3. 添加获取历史记录的 API 接口,从内存中获取
4. 添加 Graph 的单例模式,get_runnable_agent 导致的重复创建 Agent 实例的情况。
5. 优化 Agent 管理页面,更容易配置,更容易调试
6. 添加独立页面的侧边栏。
2025-05-15 22:37:50 +08:00

112 lines
2.1 KiB
Vue

<template>
<div class="agent-single-view">
<!-- 智能体聊天界面 -->
<AgentChatComponent :agent-id="agentId">
<template #header-right>
<UserInfoComponent />
</template>
</AgentChatComponent>
</div>
</template>
<script setup>
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import AgentChatComponent from '@/components/AgentChatComponent.vue';
import UserInfoComponent from '@/components/UserInfoComponent.vue';
import sidebarLeftIcon from '@/assets/icons/sidebar_left.svg';
import sidebarRightIcon from '@/assets/icons/sidebar_right.svg';
const route = useRoute();
const agentId = computed(() => route.params.agent_id);
// 侧边栏状态
const isSidebarCollapsed = ref(false);
// 切换侧边栏展开/折叠状态
const toggleSidebar = () => {
isSidebarCollapsed.value = !isSidebarCollapsed.value;
};
// 用户信息点击事件
const toggleUserInfo = () => {
// 此处可以添加用户信息相关的逻辑
console.log('用户信息图标被点击');
};
</script>
<style lang="less" scoped>
.agent-single-view {
width: 100%;
height: 100vh;
overflow: hidden;
position: relative;
display: flex;
flex-direction: row;
}
.user-info-wrapper {
position: absolute;
top: 10px;
right: 20px;
z-index: 10;
}
// 侧边栏样式
.sidebar {
// position: absolute;
left: 0;
top: 0;
height: 100%;
width: 240px;
background-color: #f5f5f5;
transition: all 0.3s ease;
z-index: 20;
display: flex;
&.collapsed {
width: 60px;
}
.sidebar-content {
flex: 1;
padding: 20px 10px;
overflow-y: auto;
}
.user-icon {
cursor: pointer;
margin-bottom: 20px;
padding-left: 4px 8px;
img {
width: 32px;
height: 32px;
}
}
.toggle-button {
position: absolute;
right: -15px;
top: 50%;
transform: translateY(-50%);
width: 30px;
height: 30px;
background-color: #fff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
img {
width: 16px;
height: 16px;
}
}
}
</style>