Prepare text search during media setup and retain query sessions through promotion
This commit is contained in:
1 parent
af6ce29125
commit
9aae3f8216
15 files changed
+1235
-65
No files matched your search
@@ -0,0 +1,43 @@
|
||||
/** Setup and search readiness are independent: media downloads need not block text. */
|
||||
export type SemanticCoverage = "text_only" | "full_media";
|
||||
|
||||
export interface SemanticSetupStatus {
|
||||
ready: boolean;
|
||||
generation: number | null;
|
||||
pending: number;
|
||||
downloading: boolean;
|
||||
warming: boolean;
|
||||
embedding: boolean;
|
||||
error: string | null;
|
||||
indexing_ready?: boolean;
|
||||
text_model_ready?: boolean;
|
||||
media_model_ready?: boolean;
|
||||
media_model_error?: string | null;
|
||||
requested_coverage?: SemanticCoverage;
|
||||
}
|
||||
|
||||
export function semanticIndexReady(status: SemanticSetupStatus) {
|
||||
return Boolean(
|
||||
status.ready &&
|
||||
!status.warming &&
|
||||
!status.embedding &&
|
||||
(status.indexing_ready ?? !status.downloading),
|
||||
);
|
||||
}
|
||||
|
||||
/** Promotion must receive its own automatic attempt even with unchanged counts. */
|
||||
export function semanticIndexKey(
|
||||
status: SemanticSetupStatus,
|
||||
folderRevision: number,
|
||||
) {
|
||||
return `${status.generation}:${status.pending}:${folderRevision}:${status.requested_coverage ?? "full_media"}`;
|
||||
}
|
||||
|
||||
export function semanticRetryVisible(status: SemanticSetupStatus) {
|
||||
return Boolean(status.media_model_error || (status.error && !status.ready));
|
||||
}
|
||||
|
||||
export function semanticMediaReady(status: SemanticSetupStatus) {
|
||||
// Legacy capture fixtures and older full-pair status did not expose this field.
|
||||
return status.media_model_ready ?? (status.ready && !status.downloading);
|
||||
}
|
||||
Reference in new issue
Block a user