mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
chore(documents): format index modules and drop unused helper
This commit is contained in:
1 parent
5e253313fc
commit
2ecf39c772
4 files changed
+11
-12
No files matched your search
@@ -46,7 +46,10 @@ vi.mock("@/lib/ai/ai-budgets", () => ({
|
||||
}));
|
||||
|
||||
import { indexDocumentContent } from "../index-document";
|
||||
import { loadOwnedDocument, prepareVisionInput } from "@/lib/documents/ai-route-support";
|
||||
import {
|
||||
loadOwnedDocument,
|
||||
prepareVisionInput,
|
||||
} from "@/lib/documents/ai-route-support";
|
||||
import { upsertContentIndex } from "@/lib/documents/content-index";
|
||||
import { transcribeDocument } from "@/lib/documents/describe";
|
||||
import { localExtractText } from "@/lib/documents/local-extract";
|
||||
|
||||
@@ -68,7 +68,10 @@ describe("localExtractText", () => {
|
||||
});
|
||||
|
||||
it("returns unsupported for images (deferred server-OCR seam)", async () => {
|
||||
const result = await localExtractText(Buffer.from([0xff, 0xd8]), "image/jpeg");
|
||||
const result = await localExtractText(
|
||||
Buffer.from([0xff, 0xd8]),
|
||||
"image/jpeg",
|
||||
);
|
||||
expect(result).toEqual({ ok: false, reason: "unsupported" });
|
||||
});
|
||||
|
||||
|
||||
@@ -249,7 +249,8 @@ export function decryptIndexText(buf: Uint8Array): string {
|
||||
* provider, no egress — the fallback when no provider is usable.
|
||||
* - `local-ocr` → server-side OCR of a scanned image/PDF (deferred follow-up).
|
||||
*/
|
||||
export type ContentIndexSource = "vision" | "text-ocr" | "local-pdf" | "local-ocr";
|
||||
export type ContentIndexSource =
|
||||
"vision" | "text-ocr" | "local-pdf" | "local-ocr";
|
||||
|
||||
export interface UpsertContentIndexArgs {
|
||||
userId: string;
|
||||
|
||||
@@ -61,10 +61,7 @@ export type IndexOutcome =
|
||||
| {
|
||||
indexed: false;
|
||||
reason:
|
||||
| "not-found"
|
||||
| "local-empty"
|
||||
| "local-unsupported"
|
||||
| "decrypt-error";
|
||||
"not-found" | "local-empty" | "local-unsupported" | "decrypt-error";
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -103,11 +100,6 @@ export async function resolveIndexProvider(
|
||||
return { chain, pick, consentOk, dailyCap };
|
||||
}
|
||||
|
||||
/** True when the provider path can be attempted for this user. */
|
||||
export function providerUsable(provider: ResolvedIndexProvider): boolean {
|
||||
return Boolean(provider.pick) && provider.consentOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try the PROVIDER (vision) path for one already-loaded document. Returns a
|
||||
* terminal outcome on success/budget/provider-error, or `null` to signal
|
||||
|
||||
Reference in new issue
Block a user