fix(lmstudio): 모델 전환 시 다른 모델 전부 자동 언로드 (v2.2.210)

VRAM 부족으로 12b 등 다른 모델 로드 실패하던 문제 강화.
- lifecycleManager.doSwitch: 추적 중인 currentModel 만이 아니라 listLoaded()
  기반으로 *로드된 모든 LLM* 을 타깃 전 언로드(VRAM 회수). draft 모델·임베딩
  모델은 보호. listLoaded 실패 시 기존 동작(tracked unload)으로 폴백.
- extension.ts: defaultModel 설정 변경(설정 패널/settings.json 포함) 시
  lifecycle.onModelSelected 호출 → 설정 패널 전환도 unload→load 발동.
- 테스트 FakeLMStudioClient 가 실제 로드 상태를 추적하도록 갱신.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 11:27:43 +09:00
parent b4ddd4f79a
commit 6d06311d60
5 changed files with 46 additions and 22 deletions
+8
View File
@@ -142,6 +142,14 @@ export async function activate(context: vscode.ExtensionContext) {
// _sendModels is best-effort; the provider may not have a webview
// attached yet during very early activation.
void provider?._sendModels(touchedUrl);
// 모델이 *어디서든*(설정 패널·settings.json·사이드바) 바뀌면 lifecycle 을
// 깨워 이전 모델 자동 언로드 → 새 모델 로드. 이게 없으면 설정 패널에서
// 전환 시 lifecycle 이 모른 채 추론 시점에 JIT 로드만 돼 VRAM 이 안 비고
// 로드 실패가 난다.
if (touchedModel) {
const newModel = (vscode.workspace.getConfiguration('g1nation').get<string>('defaultModel', '') || '').trim();
if (newModel) lifecycle.onModelSelected(newModel);
}
})
);