Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript

refactor(KB): move FileWarning to shared types/rag following existing convention

Jake Turner102998ec96ac
diff --git a/admin/app/utils/kb_warning_decision.ts b/admin/app/utils/kb_warning_decision.ts
index cec59fa7..4551566f 100644
--- a/admin/app/utils/kb_warning_decision.ts
+++ b/admin/app/utils/kb_warning_decision.ts
@@ -12,9 +12,9 @@
* stall (which the binary "any chunks ⇒ embedded" check
* used to mask). Surfaces a Retry affordance.
*/
-export type FileWarning =
- | { kind: 'zero_chunks'; fileSizeBytes: number }
- | { kind: 'partial_stall'; chunksEmbedded: number; chunksExpected: number }
+import type { FileWarning } from '../../types/rag.js'
+
+export type { FileWarning }
/** Files smaller than this are too small to flag as suspicious zero-chunk
* cases — a 5 KB upload that produces 0 chunks is much more likely to be a
diff --git a/admin/inertia/lib/api.ts b/admin/inertia/lib/api.ts
index 628f4a04..950f5938 100644
--- a/admin/inertia/lib/api.ts
+++ b/admin/inertia/lib/api.ts
@@ -5,8 +5,7 @@ import { FileEntry } from '../../types/files'
import { CheckLatestVersionResult, SystemInformationResponse, SystemUpdateStatus } from '../../types/system'
import { DownloadJobWithProgress, WikipediaState } from '../../types/downloads'
import type { Country, CountryCode, CountryGroup, MapExtractPreflight } from '../../types/maps'
-import { EmbedJobWithProgress } from '../../types/rag'
-import type { FileWarning } from '../../app/utils/kb_warning_decision.js'
+import { EmbedJobWithProgress, FileWarning } from '../../types/rag'
import type { CategoryWithStatus, CollectionWithStatus, ContentUpdateCheckResult, ResourceUpdateInfo } from '../../types/collections'
import { catchInternal } from './util'
import { NomadChatResponse, NomadInstalledModel, NomadOllamaModel, OllamaChatRequest } from '../../types/ollama'
diff --git a/admin/types/rag.ts b/admin/types/rag.ts
index a50cb4cb..8aaa0f6e 100644
--- a/admin/types/rag.ts
+++ b/admin/types/rag.ts
@@ -40,4 +40,8 @@ export type RAGResult = {
export type RerankedRAGResult = Omit<RAGResult, 'keywords'> & {
finalScore: number
-}
\ No newline at end of file
+}
+
+export type FileWarning =
+ | { kind: 'zero_chunks'; fileSizeBytes: number }
+ | { kind: 'partial_stall'; chunksEmbedded: number; chunksExpected: number }
\ No newline at end of file