Refactor analysis file names
The versioning of analysis input and document files
(`analysis_input_v{N}.json`, `document_v{N}.md`) has been removed. All
analysis inputs will now use `analysis_input.json` and generated
documents will use `document.md`.
This simplifies file management, as there's no longer a need to track
and manage multiple versions of these files within a case directory. The
analysis worker will now overwrite the existing `document.md` if it
exists, ensuring that the latest analysis result is always present. The
`version` field has also been removed from `AnalyzeJob` and
`AnalysisInput`.
This commit is contained in:
+12
-13
@@ -8,14 +8,18 @@ pub mod prompt;
|
||||
pub mod recovery;
|
||||
pub mod worker;
|
||||
|
||||
/// A single request to analyze a case. Payload is tiny (path + u32), so the
|
||||
/// channel is unbounded — persistence lives in `analysis_input_v{N}.json` on
|
||||
/// Single-document-per-case filenames. A re-analysis overwrites the
|
||||
/// document in place (handler deletes it first; worker writes the fresh one).
|
||||
pub const DOCUMENT_FILE: &str = "document.md";
|
||||
pub const ANALYSIS_INPUT_FILE: &str = "analysis_input.json";
|
||||
|
||||
/// A single request to analyze a case. Payload is tiny (a path), so the
|
||||
/// channel is unbounded — persistence lives in `analysis_input.json` on
|
||||
/// disk, not in the queue. Recovery re-enqueues any inputs the server may
|
||||
/// have held at crash time.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AnalyzeJob {
|
||||
pub case_dir: PathBuf,
|
||||
pub version: u32,
|
||||
}
|
||||
|
||||
pub type AnalyzeSender = mpsc::UnboundedSender<AnalyzeJob>;
|
||||
@@ -25,19 +29,14 @@ pub fn channel() -> (AnalyzeSender, AnalyzeReceiver) {
|
||||
mpsc::unbounded_channel()
|
||||
}
|
||||
|
||||
/// Persistent input for a single analysis run. Written by the close-case
|
||||
/// handler, consumed by the analyze worker, and left on disk indefinitely as
|
||||
/// an audit trail of what was sent to the LLM.
|
||||
///
|
||||
/// Timestamps are stored as ISO-8601 strings (lexicographic order matches
|
||||
/// chronological order, so string comparison is sufficient for the
|
||||
/// "Nachtrag" detection the UI needs later).
|
||||
/// Persistent input for a single analysis run. Written by the analyze
|
||||
/// handler, consumed by the analyze worker, removed after a successful
|
||||
/// document write.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct AnalysisInput {
|
||||
pub version: u32,
|
||||
/// Latest filesystem mtime (server clock) of any `.m4a` in the case at
|
||||
/// the moment the close button was clicked. Used later to detect late
|
||||
/// arrivals that should trigger a re-analysis prompt.
|
||||
/// the moment the analyze button was clicked. Carried through for
|
||||
/// diagnostics / future "Nachtrag" detection.
|
||||
pub last_recording_mtime: String,
|
||||
pub recordings: Vec<RecordingInput>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user