SessionList 会话历史
用于管理多个 AI 历史会话,支持时间自动分组、搜索过滤、置顶、重命名与删除。
基础用法
<script setup>
import { ref } from 'vue'
import SessionList from '@/vue/components/SessionList.vue'
const activeId = ref('2')
const sessions = ref([
{ id: '1', title: '架构评审记录', pinned: true },
{ id: '2', title: 'AI 组件库规划', updatedAt: new Date() },
{ id: '3', title: 'SQL 慢查询排查', updatedAt: Date.now() - 86400000 * 3 }
])
</script>
<template>
<div style="max-width: 280px;">
<SessionList
:items="sessions"
:active-id="activeId"
searchable
@select="(item) => (activeId = item.id)"
/>
</div>
</template>API
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| items | 会话列表 | SessionItem[] | [] |
| activeId | 当前选中会话 ID | string | — |
| searchable | 是否显示搜索框 | boolean | false |
| creatable | 是否显示新建按钮 | boolean | true |
| groupByTime | 是否按时间自动分组 | boolean | true |
