Skip to content

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当前选中会话 IDstring—
searchable是否显示搜索框booleanfalse
creatable是否显示新建按钮booleantrue
groupByTime是否按时间自动分组booleantrue

基于 MIT 许可发布