assistant/console/types.ts

98 lines
2.1 KiB
TypeScript

export type EntryStatus = 'draft' | 'verified' | 'rejected';
export type Suggestion = 'adopt' | 'reject' | 'review';
export type Scope = 'origin' | 'all';
export const STATUS_LABEL: Record<EntryStatus, string> = {
draft: '待审',
verified: '已采纳',
rejected: '已驳回',
};
export const CATEGORY_LABEL: Record<string, string> = {
control_tip: '控件技巧',
path: '入口路径',
rule: '系统规则',
note: '其他',
};
export const SUGGESTION_LABEL: Record<Suggestion, string> = {
adopt: '建议采纳',
reject: '建议驳回',
review: '需人工判断',
};
export const SCOPE_LABEL: Record<Scope, string> = {
origin: '仅来源学校',
all: '所有学校',
};
export interface Entry {
id: number;
knowledge_id: string;
business_id: string;
key: string;
value: string;
category: string;
status: EntryStatus;
scope: Scope;
observations: number;
school_count: number;
// 试用证据:各校 Agent 在真实页面上验证相符 / 不符的次数
confirmed: number;
contradicted: number;
origin_school_id: string;
schools: string | null;
version: number;
suggestion: Suggestion | null;
suggestion_note: string;
suggested_at: string | null;
reviewed_by: string | null;
reviewed_at: string | null;
created_at: string;
updated_at: string;
}
export interface School {
id: string;
name: string;
note: string;
created_at: string;
last_seen_at: string | null;
last_report_at: string | null;
last_pull_at: string | null;
reported_entries: number;
}
export interface SyncRow {
id: number;
school_id: string;
direction: 'report' | 'pull';
count: number;
detail: string;
at: string;
}
export interface Facet {
knowledge_id: string;
business_id: string;
drafts: number;
total: number;
}
export interface Stats {
by_status: Partial<Record<EntryStatus, number>>;
draft_by_category: Record<string, number>;
schools: number;
recent_sync: SyncRow[];
facets: Facet[];
}
export interface Meta {
pid: number;
uptime_s: number;
db: string;
console_auth: boolean;
llm_ready: boolean;
llm_model: string;
}