개선관리 요구사항과 Google 로그인을 완료
This commit is contained in:
parent
cc0a15b7c6
commit
2a39636163
112 changed files with 10166 additions and 527 deletions
|
|
@ -27,6 +27,89 @@ class _SourcePackConn:
|
|||
|
||||
|
||||
class LiveCoachSourcePackTest(unittest.TestCase):
|
||||
def test_local_grounding_preserves_each_source_license_policy(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_root:
|
||||
root = Path(temp_root)
|
||||
workbook_path = root / "live_coaching_workbook_0615.json"
|
||||
source_dir = root / "live_coaching_sources"
|
||||
source_dir.mkdir()
|
||||
|
||||
def write_pack(
|
||||
path: Path,
|
||||
*,
|
||||
source_id: str,
|
||||
license_class: str,
|
||||
external_llm_ok: bool,
|
||||
) -> None:
|
||||
path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"source": {
|
||||
"source_id": source_id,
|
||||
"title": source_id,
|
||||
"kb_kind": "theory",
|
||||
"license_class": license_class,
|
||||
"external_llm_ok": external_llm_ok,
|
||||
},
|
||||
"chunks": [
|
||||
{
|
||||
"id": f"{source_id}-chunk",
|
||||
"summary": f"{source_id} policy guidance",
|
||||
"keywords": ["policy"],
|
||||
}
|
||||
],
|
||||
},
|
||||
ensure_ascii=False,
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
write_pack(
|
||||
workbook_path,
|
||||
source_id="allow-a",
|
||||
license_class="A",
|
||||
external_llm_ok=True,
|
||||
)
|
||||
for filename, source_id, license_class, external_llm_ok in (
|
||||
("allow-b.json", "allow-b", "B", True),
|
||||
("block-c.json", "block-c", "C", True),
|
||||
("block-d.json", "block-d", "D", True),
|
||||
("block-false.json", "block-false", "A", False),
|
||||
):
|
||||
write_pack(
|
||||
source_dir / filename,
|
||||
source_id=source_id,
|
||||
license_class=license_class,
|
||||
external_llm_ok=external_llm_ok,
|
||||
)
|
||||
|
||||
item = live_coach.LiveCoachInput(
|
||||
session_id="source-policy-session",
|
||||
turn_seq=1,
|
||||
stage="exploration",
|
||||
effective_openness=0.5,
|
||||
theory_mode="humanistic",
|
||||
persona_code="P1",
|
||||
persona_name="서연",
|
||||
learner_text="policy",
|
||||
)
|
||||
with (
|
||||
patch.object(live_coach, "_REPO_ROOT", root),
|
||||
patch.object(live_coach, "_WORKBOOK_PATH", workbook_path),
|
||||
patch.object(live_coach, "_SOURCE_DIR", source_dir),
|
||||
):
|
||||
live_coach.clear_local_source_pack_cache()
|
||||
try:
|
||||
grounding = live_coach._local_reference_grounding(item)
|
||||
finally:
|
||||
live_coach.clear_local_source_pack_cache()
|
||||
|
||||
by_source = {entry.source_id: entry for entry in grounding}
|
||||
self.assertEqual(set(by_source), {"allow-a", "allow-b"})
|
||||
self.assertEqual(by_source["allow-a"].license_class, "A")
|
||||
self.assertEqual(by_source["allow-b"].license_class, "B")
|
||||
self.assertTrue(all(entry.external_llm_ok for entry in grounding))
|
||||
|
||||
def test_manifest_refresh_reads_changed_repo_source_pack_after_cache_warm(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_root:
|
||||
root = Path(temp_root)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue