Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion frontend/lib/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,17 @@ export interface AuditResultsResponse {
// Local document model
// ---------------------------------------------------------------------------

export interface DocumentMetadata {
jurisdiction?: string;
year?: string | number;
[key: string]: unknown;
}

export interface Document {
document_id: string;
title: string;
text: string;
metadata: Record<string, unknown>;
metadata: DocumentMetadata;
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing Document.metadata to DocumentMetadata narrows the type, but /analyze responses are still typed as AnalysisResult.metadata: Record<string, unknown>. In components/document/UploadPanel.tsx, a local Document is built with metadata: result.metadata, which will no longer be assignable (because jurisdiction/year are unknown on the Record type). To keep the types consistent and avoid introducing a new build error, consider updating AnalysisResult.metadata (and optionally AnalyzePayload.metadata) to DocumentMetadata, or explicitly normalizing/casting result.metadata when constructing a Document.

Suggested change
metadata: DocumentMetadata;
metadata: DocumentMetadata | Record<string, unknown>;

Copilot uses AI. Check for mistakes.
chunks: string[];
checksum?: string;
created_at: string;
Expand Down
Loading