설계 개편

This commit is contained in:
DongHyeonka
2026-07-24 16:31:12 +09:00
parent f43e909162
commit 8daa568746
70 changed files with 6554 additions and 956 deletions
+16 -2
View File
@@ -6,6 +6,7 @@ from pathlib import Path
from techviz.document import build_context
from techviz.prompt import build_agent_prompt
from techviz.reference_catalog import select_reference_cases
from techviz.spec import validate_raw_spec
@@ -19,12 +20,15 @@ class PromptTests(unittest.TestCase):
marker_id="payment-request",
)
prompt = build_agent_prompt(context)
section_start = prompt.index("## VizSpec 1.0 shape")
section_start = prompt.index("## VizSpec 1.1 shape")
json_start = prompt.index("{\n", section_start)
json_end = prompt.index("\n\nFor a sequence diagram", json_start)
json_end = prompt.index("\n\n## Final self-check", json_start)
scaffold = json.loads(prompt[json_start:json_end])
validate_raw_spec(scaffold)
self.assertEqual(scaffold["version"], "1.1")
self.assertTrue(scaffold["composition"]["diagram_only"])
self.assertTrue(scaffold["composition"]["reference_ids"])
self.assertEqual(
scaffold["source_context"],
{
@@ -35,6 +39,16 @@ class PromptTests(unittest.TestCase):
)
self.assertFalse(scaffold["groups"])
self.assertFalse(scaffold["legend"])
self.assertIn("disconnected rounded cards", prompt)
self.assertIn("diagram-only", prompt)
def test_reference_selection_is_context_sensitive(self) -> None:
context = {
"numbered_context": "1 | Port와 Adapter를 통해 hexagonal core에 의존한다.",
"current_section": {"text": "Inbound adapter와 outbound port를 분리한다."},
}
selected = select_reference_cases(context, limit=2)
self.assertEqual(selected[0].profile, "ports-adapters")
if __name__ == "__main__":