- 新增 entities 数据表(含迁移)、Entity 类型、DAO 层完整 CRUD
- AI 预处理管道接入真实模型(generateText),输出结构化 JSON(摘要+规范化内容+候选实体)
- 模板接口重构为 {systemPrompt, buildUserPrompt, parseOutput},general/meeting 模板真实化
- 新增 5 个实体路由端点 + 实体管理前端页面(列表/详情/编辑弹窗)
- 审核面板增强:展示 AI 预处理结构化结果+候选实体归一化面板(合并/新建/选择/放弃)
- 素材通过时根据用户确认的候选实体写入 entities 表
- 工作台菜单新增"实体"入口
- 新增 entities DAO 测试(16)、processor 测试(11)、路由测试(8),服务端 367 测试全部通过
- TypeScript 0 错误
357 lines
6.7 KiB
TypeScript
357 lines
6.7 KiB
TypeScript
export interface ApiErrorResponse {
|
|
error: string;
|
|
status: number;
|
|
}
|
|
|
|
export interface Conversation {
|
|
createdAt: string;
|
|
id: string;
|
|
modelId: null | string;
|
|
projectId: string;
|
|
title: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface ConversationListResponse {
|
|
items: Conversation[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface ConversationResponse {
|
|
conversation: Conversation;
|
|
}
|
|
|
|
export interface CreateConversationRequest {
|
|
modelId?: string;
|
|
title?: string;
|
|
}
|
|
|
|
export interface CreateMaterialRequest {
|
|
associatedDate: string;
|
|
description: string;
|
|
materialType?: MaterialType;
|
|
}
|
|
|
|
export interface CreateModelRequest {
|
|
capabilities: ModelCapability[];
|
|
contextLength?: null | number;
|
|
externalId: string;
|
|
maxOutputTokens?: null | number;
|
|
name: string;
|
|
providerId: string;
|
|
}
|
|
|
|
export interface CreateProjectRequest {
|
|
description?: string;
|
|
name: string;
|
|
}
|
|
|
|
export interface CreateProviderRequest {
|
|
apiKey: string;
|
|
baseUrl: string;
|
|
name: string;
|
|
type: ProviderType;
|
|
}
|
|
|
|
export interface ApproveMaterialRequest {
|
|
entityConfirmations?: EntityConfirmation[];
|
|
}
|
|
|
|
export interface CandidateEntity {
|
|
context: string;
|
|
matchedEntityId: null | string;
|
|
name: string;
|
|
type: EntityType;
|
|
}
|
|
|
|
export interface CreateEntityRequest {
|
|
aliases?: string[];
|
|
description?: string;
|
|
name: string;
|
|
type: EntityType;
|
|
}
|
|
|
|
export interface Entity {
|
|
aliases: string[];
|
|
createdAt: string;
|
|
description: string;
|
|
id: string;
|
|
name: string;
|
|
projectId: string;
|
|
type: EntityType;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface EntityConfirmation {
|
|
action: "create" | "discard" | "merge" | "select";
|
|
candidateIndex: number;
|
|
targetEntityId?: string;
|
|
}
|
|
|
|
export interface EntityListResponse {
|
|
items: Entity[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface EntityResponse {
|
|
entity: Entity;
|
|
}
|
|
|
|
export const ENTITY_TYPES = [
|
|
"person",
|
|
"organization",
|
|
"system",
|
|
"feature",
|
|
"requirement",
|
|
"issue",
|
|
"term",
|
|
"other",
|
|
] as const;
|
|
|
|
export type EntityType = (typeof ENTITY_TYPES)[number];
|
|
|
|
export interface ProcessingResult {
|
|
candidateEntities: CandidateEntity[];
|
|
normalizedContent: string;
|
|
summary: string;
|
|
}
|
|
|
|
export interface UpdateEntityRequest {
|
|
aliases?: string[];
|
|
description?: string;
|
|
name?: string;
|
|
type?: EntityType;
|
|
}
|
|
|
|
export interface ListSortParams {
|
|
sortBy?: string;
|
|
sortOrder?: SortOrder;
|
|
}
|
|
|
|
export interface Material {
|
|
associatedDate: string;
|
|
createdAt: string;
|
|
description: string;
|
|
id: string;
|
|
materialType: MaterialType;
|
|
processedContent: null | string;
|
|
projectId: string;
|
|
status: MaterialStatus;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface MaterialListResponse {
|
|
items: Material[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface MaterialResponse {
|
|
material: Material;
|
|
}
|
|
|
|
export type MaterialStatus = "approved" | "discarded" | "failed" | "pending" | "processing" | "review";
|
|
|
|
export type MaterialType = "general" | "meeting";
|
|
|
|
export interface Message {
|
|
content: string;
|
|
conversationId: string;
|
|
createdAt: string;
|
|
id: string;
|
|
parts: null | string;
|
|
role: "assistant" | "system" | "user";
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface MessageListResponse {
|
|
items: Message[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface MetaResponse {
|
|
ok: true;
|
|
service: string;
|
|
timestamp: string;
|
|
version: string;
|
|
}
|
|
|
|
export interface Model {
|
|
capabilities: ModelCapability[];
|
|
contextLength: null | number;
|
|
createdAt: string;
|
|
externalId: string;
|
|
id: string;
|
|
maxOutputTokens: null | number;
|
|
name: string;
|
|
providerId: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export type ModelCapability =
|
|
| "audio-generation"
|
|
| "audio-recognition"
|
|
| "image-generation"
|
|
| "image-recognition"
|
|
| "reasoning"
|
|
| "text"
|
|
| "video-generation"
|
|
| "video-recognition";
|
|
|
|
export type SortOrder = "asc" | "desc";
|
|
|
|
export interface UpdateConversationRequest {
|
|
modelId?: string;
|
|
title?: string;
|
|
}
|
|
|
|
export const MODEL_CAPABILITIES: readonly ModelCapability[] = [
|
|
"audio-generation",
|
|
"audio-recognition",
|
|
"image-generation",
|
|
"image-recognition",
|
|
"reasoning",
|
|
"text",
|
|
"video-generation",
|
|
"video-recognition",
|
|
];
|
|
|
|
export interface ModelListResponse {
|
|
items: Model[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface ModelResponse {
|
|
model: Model;
|
|
}
|
|
|
|
export interface ModelTestResponse {
|
|
message: string;
|
|
ok: boolean;
|
|
}
|
|
|
|
export interface ModelTestResultResponse {
|
|
modelTestResponse: ModelTestResponse;
|
|
}
|
|
|
|
export interface Project {
|
|
createdAt: string;
|
|
description: string;
|
|
id: string;
|
|
name: string;
|
|
status: ProjectStatus;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface ProjectListResponse {
|
|
items: Project[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface ProjectResponse {
|
|
project: Project;
|
|
}
|
|
|
|
export type ProjectStatus = "active" | "archived";
|
|
|
|
export interface Provider {
|
|
apiKey: string;
|
|
baseUrl: string;
|
|
createdAt: string;
|
|
id: string;
|
|
name: string;
|
|
type: ProviderType;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface ProviderListResponse {
|
|
items: Provider[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
export interface ProviderOption {
|
|
id: string;
|
|
name: string;
|
|
type: ProviderType;
|
|
}
|
|
|
|
export interface ProviderOptionsResponse {
|
|
items: ProviderOption[];
|
|
}
|
|
|
|
export interface ProviderResponse {
|
|
provider: Provider;
|
|
}
|
|
|
|
export interface ProviderTestResponse {
|
|
message: string;
|
|
ok: boolean;
|
|
}
|
|
|
|
export interface ProviderTestResultResponse {
|
|
providerTestResponse: ProviderTestResponse;
|
|
}
|
|
|
|
export type ProviderType = "anthropic" | "openai" | "openai-compatible";
|
|
|
|
export type RuntimeMode = "development" | "production" | "test";
|
|
|
|
/** 模型能力到默认模型 ID 的映射,用于后台自动流程 */
|
|
export interface DefaultModelSettings {
|
|
/** 文本能力,覆盖 text + reasoning */
|
|
text?: string | null;
|
|
imageRecognition?: string | null;
|
|
audioRecognition?: string | null;
|
|
videoRecognition?: string | null;
|
|
imageGeneration?: string | null;
|
|
audioGeneration?: string | null;
|
|
videoGeneration?: string | null;
|
|
}
|
|
|
|
export interface SettingsData {
|
|
compact?: boolean;
|
|
defaultModels?: DefaultModelSettings;
|
|
theme: ThemePreference;
|
|
}
|
|
|
|
export interface TestModelRequest {
|
|
externalId: string;
|
|
providerId: string;
|
|
}
|
|
|
|
export type ThemePreference = "dark" | "light" | "system";
|
|
|
|
export interface UpdateModelRequest {
|
|
capabilities?: ModelCapability[];
|
|
contextLength?: null | number;
|
|
externalId?: string;
|
|
maxOutputTokens?: null | number;
|
|
name?: string;
|
|
providerId?: string;
|
|
}
|
|
|
|
export interface UpdateProjectRequest {
|
|
description?: string;
|
|
name?: string;
|
|
}
|
|
|
|
export interface UpdateProviderRequest {
|
|
apiKey?: string;
|
|
baseUrl?: string;
|
|
name?: string;
|
|
type?: ProviderType;
|
|
}
|