feat(reset): 以构造器模式重构

- 加了大文件传输自定义分片协议

BREAKING CHANGES: 0.1.0(latest)
This commit is contained in:
tobegold574
2025-11-30 20:27:53 +08:00
parent c5853847ae
commit 382e3aff21
82 changed files with 1421 additions and 7010 deletions

View File

@@ -1,57 +1,26 @@
import type { PaginationRequest, PaginationResponse } from 'types/common';
import type { ModelComment, AIModel } from './base';
import type { CommentSortType } from './enum';
// AI模型榜单项接口
export interface AIModelRankingItem {
model: AIModel;
rank: number;
change?: 'up' | 'down' | 'same'; // 排名变化,未来扩展
}
// 获取AI模型广场数据请求接口
export interface GetAIPlazaRequest {
// 模型卡片数据是静态配置(手动维护)的,不需要分页参数
}
// 获取AI模型广场数据响应接口
export interface GetAIPlazaResponse {
models: AIModel[]; // 模型卡片列表,由管理员预定义
hotRankings: AIModelRankingItem[]; // 热评模型榜单
clickRankings: AIModelRankingItem[]; // 点击排行榜
}
// 获取模型详情请求接口
export interface GetModelDetailRequest {
modelId: string;
page?: number; // 评论页码
limit?: number; // 每页评论数量
sortBy?: CommentSortType; // 评论排序方式,未来扩展功能
export interface GetModelsRequest extends PaginationRequest {
// 够了
}
// 获取模型详情响应接口
export interface GetModelDetailResponse {
model: AIModel;
comments: ModelComment[]; // 使用新的ModelComment类型已经是数组
totalComments: number;
hasMoreComments: boolean; // 是否还有更多评论,支持无限滚动加载
export interface GetModelsResponse extends PaginationResponse<AIModel> {
// 够了
}
// 批量获取模型评论请求接口
export interface GetModelCommentsRequest {
export interface GetModelCommentsRequest extends PaginationRequest {
modelId: string;
page?: number; // 页码
limit?: number; // 每页评论数量
sortBy?: CommentSortType; // 评论排序方式
parentId?: string; // 父评论ID用于获取回复
parentId?: string; // 父评论ID
}
// 批量获取模型评论响应接口
export interface GetModelCommentsResponse {
comments: ModelComment[]; // 评论列表
total: number; // 总数
page: number; // 当前页码
limit: number; // 每页数量
hasMore: boolean; // 是否有更多数据
export interface GetModelCommentsResponse extends PaginationResponse<ModelComment> {
// 够了
}
// 发表模型评论请求接口
@@ -63,98 +32,19 @@ export interface CreateModelCommentRequest {
// 发表模型评论响应接口
export interface CreateModelCommentResponse {
comment: ModelComment; // 使用新的ModelComment类型
}
// 点赞模型评论请求接口
export interface LikeModelCommentRequest {
commentId: string;
}
// 点赞模型评论响应接口
export interface LikeModelCommentResponse {
success: boolean;
}
// 记录模型点击请求接口
export interface RecordModelClickRequest {
// 点赞模型请求接口
export interface LikeModelRequest {
modelId: string;
}
// 记录模型点击响应接口
export interface RecordModelClickResponse {
success: boolean;
clickCount: number; // 更新后的总点击数
}
// 后面的都暂时不考虑
// 删除模型评论请求接口
export interface DeleteModelCommentRequest {
commentId: string;
}
// 删除模型评论响应接口
export interface DeleteModelCommentResponse {
// 点赞模型响应接口
export interface LikeModelResponse {
success: boolean;
}
// 更新模型评论请求接口
export interface UpdateModelCommentRequest {
commentId: string;
content?: string; // 更新内容
}
// 更新模型评论响应接口
export interface UpdateModelCommentResponse {
success: boolean;
comment: ModelComment; // 返回更新后的评论
}
// 批量点赞模型评论请求接口
export interface BatchLikeModelCommentsRequest {
commentIds: string[]; // 评论ID列表
}
// 批量点赞模型评论响应接口
export interface BatchLikeModelCommentsResponse {
results: Array<{
commentId: string;
success: boolean;
comment?: ModelComment; // 成功时返回更新后的评论
error?: string; // 失败时的错误信息
}>;
}
// 批量删除模型评论请求接口
export interface BatchDeleteModelCommentsRequest {
commentIds: string[]; // 评论ID列表
}
// 批量删除模型评论响应接口
export interface BatchDeleteModelCommentsResponse {
results: Array<{
commentId: string;
success: boolean;
error?: string; // 失败时的错误信息
}>;
}
// 批量更新模型评论请求接口
export interface BatchUpdateModelCommentsRequest {
updates: Array<{
commentId: string;
content?: string; // 更新内容
rating?: number; // 更新评分
}>;
}
// 批量更新模型评论响应接口
export interface BatchUpdateModelCommentsResponse {
results: Array<{
commentId: string;
success: boolean;
comment?: ModelComment; // 成功时返回更新后的评论
error?: string; // 失败时的错误信息
}>;
}