Merge pull request 'feat(learning): מסלול נקי להעלאת החלטה סופית + פאנל-סגנון דו-סוכני (DeepSeek+Gemini)' (#158) from worktree-final-upload-pipeline into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 42s

This commit was merged in pull request #158.
This commit is contained in:
2026-06-08 09:04:16 +00:00
10 changed files with 726 additions and 25 deletions

View File

@@ -181,6 +181,73 @@ export function useDeleteDraft(caseNumber: string) {
});
}
/* ── Chair's signed final decision — clean upload path + staged pipeline ── */
export type FinalUploadResult = {
final_filename: string;
training_copy: string;
pair_id: string | null;
draft_words: number;
final_words: number;
status: string;
};
export type FinalTaskResult = {
status: string;
sub_issue_id?: string;
curator_id?: string;
reason?: string;
error?: string;
};
/** Upload Dafna's signed final decision (distinct from "upload a revised draft"). */
export function useUploadFinalDecision(caseNumber: string) {
const qc = useQueryClient();
return useMutation({
mutationFn: async (file: File): Promise<FinalUploadResult> => {
const form = new FormData();
form.append("file", file);
const res = await fetch(`/api/cases/${caseNumber}/final/upload`, {
method: "POST",
body: form,
});
if (!res.ok) {
const err = await res
.json()
.catch(() => ({ detail: "שגיאה בהעלאת ההחלטה הסופית" }));
throw new Error(err.detail ?? "שגיאה בהעלאת ההחלטה הסופית");
}
return res.json() as Promise<FinalUploadResult>;
},
onSuccess: () => {
qc.invalidateQueries({ queryKey: exportsKeys.list(caseNumber) });
qc.invalidateQueries({ queryKey: casesKeys.detail(caseNumber) });
},
});
}
/** Staged step 1 — voice learning (Opus distillation + DeepSeek+Gemini style panel). */
export function useRunFinalLearning(caseNumber: string) {
return useMutation({
mutationFn: () =>
apiRequest<FinalTaskResult>(
`/api/cases/${caseNumber}/final/run-learning`,
{ method: "POST" },
),
});
}
/** Staged step 2 — halacha validation (cited-halacha extraction + 3-judge panel). */
export function useRunFinalHalacha(caseNumber: string) {
return useMutation({
mutationFn: () =>
apiRequest<FinalTaskResult>(
`/api/cases/${caseNumber}/final/run-halacha`,
{ method: "POST" },
),
});
}
export function useMarkFinal(caseNumber: string) {
const qc = useQueryClient();
return useMutation({

View File

@@ -469,7 +469,9 @@ export type DecisionLesson = {
style_corpus_id: string;
lesson_text: string;
category: "style" | "structure" | "lexicon" | "tabular" | "general";
source: "manual" | "curator" | "chair" | "style_analyzer";
// "panel:deepseek+gemini" — the two-judge style panel; (string) keeps it open
// to future panel sources without a type break.
source: "manual" | "curator" | "chair" | "style_analyzer" | (string & {});
applied_to_skill: boolean;
created_by: string;
created_at: string;