fix(llm): resolve score runtime config from saved profiles

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-26 20:34:01 +08:00
parent 754a30ad59
commit 1df4010acc
5 changed files with 117 additions and 6 deletions

View File

@@ -148,6 +148,13 @@ def update_profile(profile_id: str, request: CreateProfileRequest) -> LLMProfile
if updated is None:
logger.warning("[update_profile] not found id=%s", profile_id)
raise HTTPException(status_code=404, detail=f"Profile not found: {profile_id}")
# Invalidate scorer cache so next request picks up the new profile settings.
try:
from webapp.services.inline_scorer import inline_scorer
inline_scorer.invalidate_cache()
logger.info("[update_profile] scorer cache invalidated id=%s", profile_id)
except Exception: # noqa: BLE001
pass
logger.info("[update_profile] updated id=%s", profile_id)
return updated
@@ -160,6 +167,12 @@ def delete_profile(profile_id: str) -> dict:
if not deleted:
logger.warning("[delete_profile] not found id=%s", profile_id)
raise HTTPException(status_code=404, detail=f"Profile not found: {profile_id}")
# Invalidate scorer cache in case the deleted profile was in use.
try:
from webapp.services.inline_scorer import inline_scorer
inline_scorer.invalidate_cache()
except Exception: # noqa: BLE001
pass
logger.info("[delete_profile] deleted id=%s", profile_id)
return {"deleted": True}