feat(类型): 添加标签系统类型定义

- 定义 TagStats 标签统计接口
- 定义 SuggestedTag AI 推荐标签接口
- 定义 AutoTagResponse、UpdateTagsRequest/Response 等 API 类型
- 添加 TagFilterState 筛选状态类型
- 添加统一的标签颜色常量
This commit is contained in:
gaoziman 2025-12-28 17:27:30 +08:00
parent a50ab2c8ee
commit c946f8608c

69
src/types/tags.ts Normal file
View File

@ -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;
}