上传完整的WebUI前端仓库

This commit is contained in:
墨梓柒
2026-01-13 06:24:35 +08:00
parent a9187dc312
commit 812296590e
184 changed files with 47854 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
/**
* 配置架构类型定义
*/
export type FieldType =
| 'string'
| 'number'
| 'integer'
| 'boolean'
| 'select'
| 'array'
| 'object'
| 'textarea'
export interface FieldSchema {
name: string
type: FieldType
label: string
description: string
required: boolean
default?: unknown
options?: string[]
minValue?: number
maxValue?: number
items?: {
type: string
}
properties?: ConfigSchema
}
export interface ConfigSchema {
className: string
classDoc: string
fields: FieldSchema[]
nested?: Record<string, ConfigSchema>
}
export interface ConfigSchemaResponse {
success: boolean
schema: ConfigSchema
}
export interface ConfigDataResponse {
success: boolean
config: Record<string, unknown>
}
export interface ConfigUpdateResponse {
success: boolean
message: string
}

View File

@@ -0,0 +1,93 @@
/**
* 表情包相关类型定义
*/
/**
* 表情包信息
*/
export interface Emoji {
id: number
full_path: string
format: string
emoji_hash: string
description: string
query_count: number
is_registered: boolean
is_banned: boolean
emotion: string | null
record_time: number
register_time: number | null
usage_count: number
last_used_time: number | null
}
/**
* 表情包列表响应
*/
export interface EmojiListResponse {
success: boolean
total: number
page: number
page_size: number
data: Emoji[]
}
/**
* 表情包详情响应
*/
export interface EmojiDetailResponse {
success: boolean
data: Emoji
}
/**
* 表情包更新请求
*/
export interface EmojiUpdateRequest {
description?: string
is_registered?: boolean
is_banned?: boolean
emotion?: string
}
/**
* 表情包更新响应
*/
export interface EmojiUpdateResponse {
success: boolean
message: string
data?: Emoji
}
/**
* 表情包删除响应
*/
export interface EmojiDeleteResponse {
success: boolean
message: string
}
/**
* 表情包统计数据
*/
export interface EmojiStats {
total: number
registered: number
banned: number
unregistered: number
formats: Record<string, number>
top_used: Array<{
id: number
emoji_hash: string
description: string
usage_count: number
}>
}
/**
* 表情包统计响应
*/
export interface EmojiStatsResponse {
success: boolean
data: EmojiStats
}

View File

@@ -0,0 +1,174 @@
/**
* 表达方式相关类型定义
*/
/**
* 表达方式信息
*/
export interface Expression {
id: number
situation: string
style: string
last_active_time: number
chat_id: string
create_date: number | null
checked: boolean
rejected: boolean
modified_by: 'ai' | 'user' | null // 最后修改来源
}
/**
* 聊天信息
*/
export interface ChatInfo {
chat_id: string
chat_name: string
platform: string | null
is_group: boolean
}
/**
* 聊天列表响应
*/
export interface ChatListResponse {
success: boolean
data: ChatInfo[]
}
/**
* 表达方式列表响应
*/
export interface ExpressionListResponse {
success: boolean
total: number
page: number
page_size: number
data: Expression[]
}
/**
* 表达方式详情响应
*/
export interface ExpressionDetailResponse {
success: boolean
data: Expression
}
/**
* 表达方式创建请求
*/
export interface ExpressionCreateRequest {
situation: string
style: string
chat_id: string
}
/**
* 表达方式更新请求
*/
export interface ExpressionUpdateRequest {
situation?: string
style?: string
chat_id?: string
checked?: boolean
rejected?: boolean
require_unchecked?: boolean // 用于人工审核时的冲突检测
}
/**
* 表达方式创建响应
*/
export interface ExpressionCreateResponse {
success: boolean
message: string
data: Expression
}
/**
* 表达方式更新响应
*/
export interface ExpressionUpdateResponse {
success: boolean
message: string
data?: Expression
}
/**
* 表达方式删除响应
*/
export interface ExpressionDeleteResponse {
success: boolean
message: string
}
/**
* 表达方式统计数据
*/
export interface ExpressionStats {
total: number
recent_7days: number
chat_count: number
top_chats: Record<string, number>
}
/**
* 表达方式统计响应
*/
export interface ExpressionStatsResponse {
success: boolean
data: ExpressionStats
}
// ============ 审核相关类型 ============
/**
* 审核统计数据
*/
export interface ReviewStats {
total: number
unchecked: number
passed: number
rejected: number
ai_checked: number
user_checked: number
}
/**
* 审核列表响应
*/
export interface ReviewListResponse {
success: boolean
total: number
page: number
page_size: number
data: Expression[]
}
/**
* 批量审核项
*/
export interface BatchReviewItem {
id: number
rejected: boolean
require_unchecked?: boolean
}
/**
* 批量审核结果项
*/
export interface BatchReviewResultItem {
id: number
success: boolean
message: string
}
/**
* 批量审核响应
*/
export interface BatchReviewResponse {
success: boolean
total: number
succeeded: number
failed: number
results: BatchReviewResultItem[]
}

View File

@@ -0,0 +1,131 @@
/**
* 黑话(俚语)相关类型定义
*/
/**
* 黑话信息
*/
export interface Jargon {
id: number
content: string
raw_content: string | null
meaning: string | null
chat_id: string
stream_id: string | null // 解析后的 stream_id用于编辑时匹配
chat_name: string | null // 解析后的聊天名称,用于前端显示
is_global: boolean
count: number
is_jargon: boolean | null // null 表示未判定
is_complete: boolean
inference_with_context: string | null
inference_content_only: string | null
}
/**
* 聊天信息
*/
export interface JargonChatInfo {
chat_id: string
chat_name: string
platform: string | null
is_group: boolean
}
/**
* 聊天列表响应
*/
export interface JargonChatListResponse {
success: boolean
data: JargonChatInfo[]
}
/**
* 黑话列表响应
*/
export interface JargonListResponse {
success: boolean
total: number
page: number
page_size: number
data: Jargon[]
}
/**
* 黑话详情响应
*/
export interface JargonDetailResponse {
success: boolean
data: Jargon
}
/**
* 黑话创建请求
*/
export interface JargonCreateRequest {
content: string
raw_content?: string
meaning?: string
chat_id: string
is_global?: boolean
}
/**
* 黑话更新请求
*/
export interface JargonUpdateRequest {
content?: string
raw_content?: string
meaning?: string
chat_id?: string
is_global?: boolean
is_jargon?: boolean | null
}
/**
* 黑话创建响应
*/
export interface JargonCreateResponse {
success: boolean
message: string
data: Jargon
}
/**
* 黑话更新响应
*/
export interface JargonUpdateResponse {
success: boolean
message: string
data?: Jargon
}
/**
* 黑话删除响应
*/
export interface JargonDeleteResponse {
success: boolean
message: string
deleted_count: number
}
/**
* 黑话统计数据
*/
export interface JargonStats {
total: number
confirmed_jargon: number
confirmed_not_jargon: number
pending: number
global_count: number
complete_count: number
chat_count: number
top_chats: Record<string, number>
}
/**
* 黑话统计响应
*/
export interface JargonStatsResponse {
success: boolean
data: JargonStats
}

View File

@@ -0,0 +1,95 @@
/**
* 人物信息相关类型定义
*/
/**
* 群昵称信息
*/
export interface GroupNickName {
group_id: string
group_nick_name: string
}
/**
* 人物信息
*/
export interface PersonInfo {
id: number
is_known: boolean
person_id: string
person_name: string | null
name_reason: string | null
platform: string
user_id: string
nickname: string | null
group_nick_name: GroupNickName[] | null
memory_points: string | null
know_times: number | null
know_since: number | null
last_know: number | null
}
/**
* 人物列表响应
*/
export interface PersonListResponse {
success: boolean
total: number
page: number
page_size: number
data: PersonInfo[]
}
/**
* 人物详情响应
*/
export interface PersonDetailResponse {
success: boolean
data: PersonInfo
}
/**
* 人物更新请求
*/
export interface PersonUpdateRequest {
person_name?: string
name_reason?: string
nickname?: string
memory_points?: string
is_known?: boolean
}
/**
* 人物更新响应
*/
export interface PersonUpdateResponse {
success: boolean
message: string
data?: PersonInfo
}
/**
* 人物删除响应
*/
export interface PersonDeleteResponse {
success: boolean
message: string
}
/**
* 人物统计数据
*/
export interface PersonStats {
total: number
known: number
unknown: number
platforms: Record<string, number>
}
/**
* 人物统计响应
*/
export interface PersonStatsResponse {
success: boolean
data: PersonStats
}

View File

@@ -0,0 +1,158 @@
/**
* 插件清单文件类型定义
* 基于 MaiBot 插件系统 manifest 规范
*/
export interface PluginAuthor {
/** 插件作者名称 */
name: string
/** 插件作者主页 */
url?: string
}
export interface HostApplication {
/** 插件适配麦麦最低版本 */
min_version: string
/** 插件适配麦麦最高版本(可选) */
max_version?: string
}
export interface PluginManifest {
/** 清单文件版本 */
manifest_version: number
/** 插件名称 */
name: string
/** 插件版本 */
version: string
/** 插件介绍 */
description: string
/** 插件作者信息 */
author: PluginAuthor
/** 插件许可证 */
license: string
/** 主应用版本要求 */
host_application: HostApplication
/** 插件主页(可选) */
homepage_url?: string
/** 插件仓库地址(可选) */
repository_url?: string
/** 插件关键词 */
keywords: string[]
/** 插件分类(可选) */
categories?: string[]
/** 插件默认语言 */
default_locale: string
/** 插件语言文件夹(可选) */
locales_path?: string
}
/**
* 插件信息(用于市场展示)
* 包含 manifest 信息和额外的统计数据
*/
export interface PluginInfo {
/** 插件唯一标识 */
id: string
/** 插件清单 */
manifest: PluginManifest
/** 下载量 */
downloads: number
/** 评分 (0-5) */
rating: number
/** 评价数量 */
review_count: number
/** 是否已安装 */
installed: boolean
/** 安装的版本(如果已安装) */
installed_version?: string
/** 发布时间 */
published_at: string
/** 最后更新时间 */
updated_at: string
/** 详细描述(可能包含 Markdown */
detailed_description?: string
/** 截图列表 */
screenshots?: string[]
/** 更新日志 */
changelog?: string
}
/**
* 插件分类
*/
export const PluginCategory = {
/** 开发工具 */
DEVELOPER_TOOLS: 'Developer Tools',
/** AI 增强 */
AI_ENHANCEMENT: 'AI Enhancement',
/** 工具类 */
UTILITY: 'Utility',
/** 娱乐 */
ENTERTAINMENT: 'Entertainment',
/** 集成 */
INTEGRATION: 'Integration',
/** 数据分析 */
DATA_ANALYSIS: 'Data Analysis',
/** 自动化 */
AUTOMATION: 'Automation',
/** 其他 */
OTHER: 'Other',
} as const
export type PluginCategoryType = typeof PluginCategory[keyof typeof PluginCategory]
/**
* 插件状态
*/
export const PluginStatus = {
/** 未安装 */
NOT_INSTALLED: 'not_installed',
/** 已安装 */
INSTALLED: 'installed',
/** 可更新 */
UPDATE_AVAILABLE: 'update_available',
/** 安装中 */
INSTALLING: 'installing',
/** 卸载中 */
UNINSTALLING: 'uninstalling',
/** 已禁用 */
DISABLED: 'disabled',
} as const
export type PluginStatusType = typeof PluginStatus[keyof typeof PluginStatus]
/**
* 插件搜索筛选参数
*/
export interface PluginSearchParams {
/** 搜索关键词 */
query?: string
/** 分类筛选 */
category?: string
/** 排序方式 */
sort_by?: 'downloads' | 'rating' | 'updated' | 'name'
/** 排序顺序 */
order?: 'asc' | 'desc'
/** 页码 */
page?: number
/** 每页数量 */
limit?: number
}
/**
* 已安装插件信息
*/
export interface InstalledPlugin {
/** 插件 ID */
id: string
/** 插件清单 */
manifest: PluginManifest
/** 安装时间 */
installed_at: string
/** 是否启用 */
enabled: boolean
/** 插件状态 */
status: PluginStatusType
/** 插件路径 */
path: string
}

View File

@@ -0,0 +1,120 @@
/**
* 问卷调查类型定义
*/
// 问题类型
export type QuestionType =
| 'single' // 单选
| 'multiple' // 多选
| 'text' // 文本输入
| 'textarea' // 多行文本
| 'rating' // 评分1-5星
| 'scale' // 量表(如 1-10
| 'dropdown' // 下拉选择
// 单个选项
export interface QuestionOption {
id: string // 选项ID
label: string // 选项文本
value: string // 选项值
}
// 问题定义
export interface SurveyQuestion {
id: string // 问题ID
type: QuestionType // 问题类型
title: string // 问题标题
description?: string // 问题描述/说明
required?: boolean // 是否必填
readOnly?: boolean // 是否只读(用于自动填充的字段)
options?: QuestionOption[] // 选项列表(用于单选、多选、下拉)
placeholder?: string // 占位符(用于文本输入)
minLength?: number // 最小长度(用于文本)
maxLength?: number // 最大长度(用于文本)
min?: number // 最小值(用于量表)
max?: number // 最大值(用于量表)
step?: number // 步长(用于量表)
minLabel?: string // 最小值标签(用于量表)
maxLabel?: string // 最大值标签(用于量表)
maxSelections?: number // 最大选择数(用于多选)
}
// 问卷配置
export interface SurveyConfig {
id: string // 问卷ID
version: string // 问卷版本
title: string // 问卷标题
description?: string // 问卷描述
questions: SurveyQuestion[] // 问题列表
settings?: {
allowAnonymous?: boolean // 是否允许匿名提交
allowMultiple?: boolean // 是否允许多次提交
startTime?: string // 开始时间
endTime?: string // 结束时间
thankYouMessage?: string // 提交成功消息
}
}
// 单个答案
export interface QuestionAnswer {
questionId: string // 问题ID
value: string | string[] | number // 答案值
}
// 问卷提交数据
export interface SurveySubmission {
surveyId: string // 问卷ID
surveyVersion: string // 问卷版本
userId?: string // 用户ID可选
answers: QuestionAnswer[] // 答案列表
submittedAt: string // 提交时间
metadata?: {
userAgent?: string // 用户代理
language?: string // 语言
}
}
// 存储的提交记录
export interface StoredSubmission extends SurveySubmission {
id: string // 提交记录ID
ip?: string // 提交者IP脱敏
}
// 问卷统计数据
export interface SurveyStats {
surveyId: string // 问卷ID
totalSubmissions: number // 总提交数
uniqueUsers: number // 唯一用户数
lastSubmissionAt?: string // 最后提交时间
questionStats: {
[questionId: string]: {
answered: number // 回答数
// 对于选择题,记录各选项的选择次数
optionCounts?: { [optionValue: string]: number }
// 对于评分/量表题,记录平均值
average?: number
// 对于文本题,记录样本答案(可选)
sampleAnswers?: string[]
}
}
}
// API 响应
export interface SurveySubmitResponse {
success: boolean
submissionId?: string
message?: string
error?: string
}
export interface SurveyStatsResponse {
success: boolean
stats?: SurveyStats
error?: string
}
export interface UserSubmissionsResponse {
success: boolean
submissions?: StoredSubmission[]
error?: string
}

View File

@@ -0,0 +1,10 @@
interface ViewTransition {
finished: Promise<void>
ready: Promise<void>
updateCallbackDone: Promise<void>
skipTransition: () => void
}
interface Document {
startViewTransition(callback: () => void | Promise<void>): ViewTransition
}