@@ -0,0 +1,34 @@
|
||||
// The documents module's manifest (spec §4.1, §16): the one place it registers anything.
|
||||
//
|
||||
// A generic document-review module, and the pattern a product's own extraction module follows:
|
||||
//
|
||||
// upload (files module) -> `files.processors` -> OCR job (this module, in the worker)
|
||||
// -> a model behind ModelGateway proposes lines, code verifies their quotes
|
||||
// -> proposals (proposals module) -> a person approves, edits or rejects
|
||||
// -> approval writes `documents_line` in the same transaction -> export of approved lines.
|
||||
//
|
||||
// It contains no customer vocabulary: what a line means, which units or catalogue numbers it uses,
|
||||
// and what file format a customer's other systems import are product decisions and live in the
|
||||
// product's own module (the extractor's prompt and schema, and a second exporter, are the two seams).
|
||||
|
||||
import { defineModule, subscribe } from "@conusai-kit/core"
|
||||
import { proposalApproved, proposalEdited, proposalRejected } from "@conusai-kit/proposals"
|
||||
import { onLineApproved, onLineEdited, onLineRejected } from "./adapters/item-feedback.js"
|
||||
import { ocrJob } from "./adapters/jobs.js"
|
||||
import { OCR_JOB } from "./contract/index.js"
|
||||
import { DOCUMENTS_MODULE_BASE } from "./module.shared.js"
|
||||
|
||||
export const documentsModule = defineModule({
|
||||
...DOCUMENTS_MODULE_BASE,
|
||||
jobs: { [OCR_JOB]: ocrJob },
|
||||
// A reviewer's decision on a line the platform extracted goes back to it as Document Items feedback.
|
||||
events: {
|
||||
...DOCUMENTS_MODULE_BASE.events,
|
||||
subscribes: [
|
||||
...(DOCUMENTS_MODULE_BASE.events?.subscribes ?? []),
|
||||
subscribe(proposalApproved, onLineApproved),
|
||||
subscribe(proposalRejected, onLineRejected),
|
||||
subscribe(proposalEdited, onLineEdited),
|
||||
],
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user