라이브코치 소스팩 새로고침 보강
This commit is contained in:
parent
84599bbaa2
commit
1e9f293fda
5 changed files with 182 additions and 8 deletions
|
|
@ -40,9 +40,11 @@ class RepoSourcePackSyncResult:
|
|||
items: list[RepoSourcePackSyncItem]
|
||||
|
||||
|
||||
def build_repo_source_pack_manifest() -> tuple[list[dict[str, Any]], list[dict[str, Any]]]:
|
||||
def build_repo_source_pack_manifest(*, refresh: bool = False) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]:
|
||||
"""Return repo-managed source rows and RAG index payloads without DB access."""
|
||||
|
||||
if refresh:
|
||||
live_coach.clear_local_source_pack_cache()
|
||||
return live_coach.build_rag_source_rows(), live_coach.build_rag_index_payloads()
|
||||
|
||||
|
||||
|
|
@ -92,7 +94,12 @@ async def _upsert_source_rows(conn: Any, source_rows: list[dict[str, Any]]) -> N
|
|||
)
|
||||
|
||||
|
||||
async def sync_repo_source_packs(conn: Any, *, apply: bool = False) -> RepoSourcePackSyncResult:
|
||||
async def sync_repo_source_packs(
|
||||
conn: Any,
|
||||
*,
|
||||
apply: bool = False,
|
||||
refresh: bool = False,
|
||||
) -> RepoSourcePackSyncResult:
|
||||
"""Compare or apply repo-managed source packs against kb.document.
|
||||
|
||||
Dry-run mode still reads the active DB document row so it can report whether
|
||||
|
|
@ -100,7 +107,7 @@ async def sync_repo_source_packs(conn: Any, *, apply: bool = False) -> RepoSourc
|
|||
happen only when apply=True.
|
||||
"""
|
||||
|
||||
source_rows, index_payloads = build_repo_source_pack_manifest()
|
||||
source_rows, index_payloads = build_repo_source_pack_manifest(refresh=refresh)
|
||||
source_row_by_id = {row["source_id"]: row for row in source_rows}
|
||||
if apply:
|
||||
await _upsert_source_rows(conn, source_rows)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue