From c946f8608c913aeb599bf5a9565526a12aa532f1 Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Sun, 28 Dec 2025 17:27:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B1=BB=E5=9E=8B):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=B3=BB=E7=BB=9F=E7=B1=BB=E5=9E=8B=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 定义 TagStats 标签统计接口 - 定义 SuggestedTag AI 推荐标签接口 - 定义 AutoTagResponse、UpdateTagsRequest/Response 等 API 类型 - 添加 TagFilterState 筛选状态类型 - 添加统一的标签颜色常量 --- src/types/tags.ts | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/types/tags.ts diff --git a/src/types/tags.ts b/src/types/tags.ts new file mode 100644 index 0000000..29a3e75 --- /dev/null +++ b/src/types/tags.ts @@ -0,0 +1,69 @@ +/** + * 自动标签功能相关类型定义 + */ + +// 标签统计信息 +export interface TagStats { + /** 标签名称 */ + name: string; + /** 该标签的对话数量 */ + count: number; +} + +// AI 推荐的标签 +export interface SuggestedTag { + /** 标签名称 */ + name: string; + /** AI 置信度 (0-100) */ + confidence: number; +} + +// 自动生成标签 API 响应 +export interface AutoTagResponse { + /** AI 推荐的标签列表 */ + suggestedTags: SuggestedTag[]; + /** 当前对话已有的标签 */ + currentTags: string[]; +} + +// 标签更新 API 请求 +export interface UpdateTagsRequest { + /** 新的标签数组 */ + tags: string[]; +} + +// 标签更新 API 响应 +export interface UpdateTagsResponse { + /** 更新后的标签数组 */ + tags: string[]; + /** 更新时间 */ + updatedAt: string; +} + +// 全局标签 API 响应 +export interface AllTagsResponse { + /** 标签统计列表 */ + tags: TagStats[]; + /** 总对话数 */ + totalConversations: number; +} + +// 标签筛选状态 +export interface TagFilterState { + /** 当前选中的标签 */ + selectedTags: string[]; + /** 是否启用筛选 */ + isFiltering: boolean; +} + +// 标签颜色 - 统一简洁风格 +export const TAG_COLOR = { + bg: 'rgba(113, 113, 122, 0.12)', // 灰色半透明背景 + text: '#71717A', // 灰色文字 + border: 'rgba(113, 113, 122, 0.2)', // 灰色边框 +} as const; + +// 获取标签颜色(统一返回相同颜色,保持简洁一致) +export function getTagColor(_tagName: string): typeof TAG_COLOR { + return TAG_COLOR; +}