report system

This commit is contained in:
k
2026-09-21 21:51:38 +02:00
parent 4cefd3e17f
commit aa33828215
15 changed files with 1379 additions and 75 deletions
+44
View File
@@ -21,6 +21,27 @@ export interface AccessMessage {
created_at: number;
}
export type ReportReason = "copyright" | "gore" | "falseinfo" | "bug";
export type ReportStatus = "open" | "reviewing" | "resolved" | "dismissed";
export interface Report {
id: string;
reporter_id: string;
reporter_name: string;
conversation_id: string;
message_index: number;
content: string;
prompt: string;
model: string;
reason: ReportReason;
details: string;
status: ReportStatus;
admin_note: string;
reporter_shadowbanned: number;
created_at: number;
updated_at: number;
}
const TOKEN_KEY = "kisassistant_token";
export function getToken(): string | null {
@@ -184,6 +205,29 @@ export const api = {
method: "POST",
body: JSON.stringify({ body }),
}),
/** Content reports (flagged AI responses). */
createReport: (r: {
conversationId?: string;
messageIndex?: number;
reason: ReportReason;
details?: string;
content?: string;
prompt?: string;
model?: string;
}) =>
req<{ report: Report }>("/api/reports", {
method: "POST",
body: JSON.stringify(r),
}),
/** Admin: report triage. */
adminReportList: () => req<{ reports: Report[] }>("/api/admin/reports"),
adminReportPatch: (id: string, patch: { status: ReportStatus; adminNote?: string }) =>
req<{ report: Report }>(`/api/admin/reports/${id}`, {
method: "PATCH",
body: JSON.stringify(patch),
}),
ollamaPull: async (
name: string,
onProgress: (p: { status?: string; digest?: string; total?: number; completed?: number; error?: string }) => void,