diff --git a/mcp-server/src/legal_mcp/services/block_writer.py b/mcp-server/src/legal_mcp/services/block_writer.py index fd8c8d0..1faf203 100644 --- a/mcp-server/src/legal_mcp/services/block_writer.py +++ b/mcp-server/src/legal_mcp/services/block_writer.py @@ -913,6 +913,8 @@ async def _build_style_context(practice_area: str = "") -> str: ("golden_ratios", "יחסי-זהב (אחוזי-סעיפים)"), ("discussion_rules", "כללי-דיון"), ("content_checklists", "צ׳קליסטים"), + ("transition_phrases", "ביטויי-מעבר"), + ("anti_patterns", "אנטי-דפוסים (להימנע)"), ): ov = await db.get_methodology_overrides(cat) if ov: diff --git a/web-ui/src/app/methodology/page.tsx b/web-ui/src/app/methodology/page.tsx index 62767b0..1374051 100644 --- a/web-ui/src/app/methodology/page.tsx +++ b/web-ui/src/app/methodology/page.tsx @@ -6,6 +6,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { GoldenRatiosPanel } from "@/components/methodology/golden-ratios-panel"; import { DiscussionRulesPanel } from "@/components/methodology/discussion-rules-panel"; import { ContentChecklistsPanel } from "@/components/methodology/content-checklists-panel"; +import { GenericMethodologyPanel } from "@/components/methodology/generic-methodology-panel"; export default function MethodologyPage() { return ( @@ -25,6 +26,8 @@ export default function MethodologyPage() { יחסי זהב כללי דיון צ׳קליסטים + ביטויי מעבר + אנטי-דפוסים @@ -38,6 +41,20 @@ export default function MethodologyPage() { + + + + + + + + diff --git a/web-ui/src/components/methodology/generic-methodology-panel.tsx b/web-ui/src/components/methodology/generic-methodology-panel.tsx new file mode 100644 index 0000000..bc7f167 --- /dev/null +++ b/web-ui/src/components/methodology/generic-methodology-panel.tsx @@ -0,0 +1,103 @@ +"use client"; + +import { useState } from "react"; +import { Loader2, Save, RotateCcw } from "lucide-react"; +import { toast } from "sonner"; +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; +import { Textarea } from "@/components/ui/textarea"; +import { + useMethodology, + useUpdateMethodology, + useResetMethodology, +} from "@/lib/api/methodology"; + +/** + * Generic key→JSON editor for methodology categories whose value shape is + * arbitrary (T12: transition_phrases, anti_patterns). Each key is editable as + * formatted JSON; Save validates + upserts an override, Reset restores default. + * These edits flow to the writer via the accumulated-learning channel (T15). + */ +function Row({ category, k, value, isOverride }: { + category: string; k: string; value: unknown; isOverride: boolean; +}) { + const [draft, setDraft] = useState(JSON.stringify(value, null, 2)); + const [err, setErr] = useState(null); + const update = useUpdateMethodology(category); + const reset = useResetMethodology(category); + + const dirty = draft !== JSON.stringify(value, null, 2); + + const onSave = () => { + let parsed: unknown; + try { + parsed = JSON.parse(draft); + } catch { + setErr("JSON לא תקין"); + return; + } + setErr(null); + update.mutate({ key: k, value: parsed }, { + onSuccess: () => toast.success(`${k} נשמר`), + onError: (e) => toast.error(e instanceof Error ? e.message : "שגיאה"), + }); + }; + + const onReset = () => { + reset.mutate(k, { + onSuccess: () => { toast.success(`${k} אופס לברירת-מחדל`); setDraft(""); }, + onError: (e) => toast.error(e instanceof Error ? e.message : "שגיאה"), + }); + }; + + return ( +
+
+ {k} + + {isOverride ? "מותאם" : "ברירת-מחדל"} + +
+