feat(796-1): 수식 모델 — 엔진 로직 ↔ 수식 나무 양방향 · 변수 표 · 추가 · 삭제 · 이름 전파 · 검사 · M01 길

- scripts/master_equation.py: 로직 줄 → 그림용 나무(이름식 · 값식 · 분수 · 퍼센트 · 조건 · 블록) · 풀이 · 변수 표 · 원문 「여기서」 기호 후보
- scripts/master_equation_edit.py: 나무 · 키보드 한 줄 식 → 엔진 식 · 더함 · 지움(쓰는 곳 막음) · 이름 · 기호 · 첨자(변수표 칸 · 식 그대로) · 고친 중간 줄 표시 4 자리 · 검사
- M01 길 셋(/logic/equation · preview · save — 기존 /save · 개정확인) · M02 사본 이음 export_row · edit_row
- _틀.md 로직 열 차례 끝 변수표 · 셈 값 바뀜 0(791-1 지문 같음)
- 시험 test_796_1_formula_model.py 17

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 11:14:25 +09:00
co-authored by Claude Opus 5.5
parent 785f5793a7
commit 771e89c983
6 changed files with 1430 additions and 1 deletions
+27
View File
@@ -12,6 +12,7 @@ from typing import Any, Literal
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
from M01_MasterData import M01_MasterData_Equation as equation
from M01_MasterData import M01_MasterData_Sheet as line_sheet
from M01_MasterData import M01_MasterData_Store as store
from M01_MasterData import M01_MasterData_Store_Combo as combo_store
@@ -344,6 +345,32 @@ def post_logic_sheet_check(body: SheetCheck) -> dict:
return _call(line_sheet.check, body.row, body.갈래, body.차례, body.식)
class EquationBody(BaseModel):
key: str
inputs: dict[str, Any] = {}
고침: list[dict[str, Any]] = []
version: str = ""
개정확인: bool = False
@router.post("/logic/equation")
def post_logic_equation(body: EquationBody) -> dict:
"""수식 탭(796-1) — 줄마다 이름식 · 값식 나무 · 풀이 · 변수표 · 합계(셈 · 쓰기 없음)."""
return _call(equation.read, body.key, body.inputs)
@router.post("/logic/equation/preview")
def post_logic_equation_preview(body: EquationBody) -> dict:
"""수식 고침 미리 셈 — {되나, 까닭, 줄, 수식, 전, 후} · 저장 안 함."""
return _call(equation.preview, body.key, body.고침, body.inputs)
@router.post("/logic/equation/save")
def post_logic_equation_save(body: EquationBody) -> dict:
"""수식 고침 저장 — 검사 통과 뒤 `/save` 길(정본 = 개정확인 · 판 다르면 409)."""
return _call(equation.save, body.key, body.고침, body.inputs, body.version, body.개정확인)
# ── 일위대가 조합 — 조합 길은 M02 층 길(`/api/m02/layers/{layer}/combos` · PLAN 27-2a) ──
@router.get("/logic/combos")
def get_logic_combos(key: str) -> dict: