feat(image): 新建 knowai-core:1.0.0 镜像并完成推送
Some checks reported errors
continuous-integration/drone/push Build was killed

- 搭建 api、auth、utils 等逻辑模块
- 通过 tsc、eslint、vitest 测试验证

BREAKING CHANGE: 新镜像分支
This commit is contained in:
tobegold574
2025-11-10 20:20:25 +08:00
commit 6a81b7bb13
73 changed files with 10511 additions and 0 deletions

160
types/model/api.d.ts vendored Normal file
View File

@@ -0,0 +1,160 @@
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 GetModelDetailResponse {
model: AIModel;
comments: ModelComment[]; // 使用新的ModelComment类型已经是数组
totalComments: number;
hasMoreComments: boolean; // 是否还有更多评论,支持无限滚动加载
}
// 批量获取模型评论请求接口
export interface GetModelCommentsRequest {
modelId: string;
page?: number; // 页码
limit?: number; // 每页评论数量
sortBy?: CommentSortType; // 评论排序方式
parentId?: string; // 父评论ID用于获取回复
}
// 批量获取模型评论响应接口
export interface GetModelCommentsResponse {
comments: ModelComment[]; // 评论列表
total: number; // 总数
page: number; // 当前页码
limit: number; // 每页数量
hasMore: boolean; // 是否有更多数据
}
// 发表模型评论请求接口
export interface CreateModelCommentRequest {
modelId: string;
content: string;
parentId?: string; // 父评论ID用于回复评论
}
// 发表模型评论响应接口
export interface CreateModelCommentResponse {
comment: ModelComment; // 使用新的ModelComment类型
}
// 点赞模型评论请求接口
export interface LikeModelCommentRequest {
commentId: string;
}
// 点赞模型评论响应接口
export interface LikeModelCommentResponse {
success: boolean;
}
// 记录模型点击请求接口
export interface RecordModelClickRequest {
modelId: string;
}
// 记录模型点击响应接口
export interface RecordModelClickResponse {
success: boolean;
clickCount: number; // 更新后的总点击数
}
// 后面的都暂时不考虑
// 删除模型评论请求接口
export interface DeleteModelCommentRequest {
commentId: string;
}
// 删除模型评论响应接口
export interface DeleteModelCommentResponse {
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; // 失败时的错误信息
}>;
}

31
types/model/base.d.ts vendored Normal file
View File

@@ -0,0 +1,31 @@
import type { BaseEntity, BaseUser } from '../post/base';
// AI模型评论统计信息接口
export interface ModelCommentStats {
stars: number; // 收藏数
likes: number; // 点赞数
comments: number; // 评论数
replies: number; // 回复数
}
// AI模型评论接口
export interface ModelComment extends BaseEntity {
modelId: string; // 模型ID
authorId: string; // 作者ID
author: BaseUser; // 作者信息
content: string; // 评论内容
parentId?: string; // 父评论ID用于嵌套评论
stats: ModelCommentStats; // 统计信息
}
// AI模型接口
export interface AIModel {
id: string;
name: string;
description: string;
avatar?: string; // 模型头像
tags?: string[]; // 模型标签
website?: string; // 官方网站
clickCount?: number; // 点击次数
likeCount?: number; // 点赞次数
}

6
types/model/enum.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
// AI模型评论排序枚举
export enum CommentSortType {
LATEST = 'latest', // 最新
HOTTEST = 'hottest', // 最热
HIGHEST_RATING = 'highest_rating' // 评分最高
}

4
types/model/index.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
// 导出所有模型相关的类型定义
export * from './base';
export * from './api';
export * from './enum';