fix: 컨텍스트 윈도우가 이전 모델 값에 고정되던 문제
게이지가 8192로 표시됐으나 지서버 gemma4:26b의 실제 값은 262144, 32배 차이. 원인이 세 겹이었다. 1. resolveNumCtx()의 _cachedNumCtx가 아무 키 없이 프로세스 수명 내내 유지됐다. 6곳에서 설정되는데 무효화하는 코드가 어디에도 없어, 모델/provider를 바꿔도 이전 값을 계속 반환했다(클로서버로 바꿨는데 지서버의 262k가 계속 보이던 증상). → (provider, models.primary, provider별 model, llm.num_ctx) 키에 연동 2. 활성 provider가 아니라 localhost:11434를 하드코딩해 조회했다. provider가 ollama_local(지서버)일 때 클로서버 로컬 Ollama에 물어보니 "model not found" → 최후 폴백 8192로 떨어졌다. → activeOllamaEndpoint() 추가, /api/model-context의 per-model 조회에도 적용 3. 프론트엔드 _fetchAppCtxMax()가 페이지 로드 시 한 번만 조회했다. → force 인자 추가, 설정 저장 직후 재조회 검증: 게이지 8192 → 262144(지서버 실제값 일치), 반복 호출 5회 안정. 캐시 키는 모델 전환 시 무효화되고 설정 동일 시 적중. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -108,7 +108,7 @@ import { getPaths } from '../config/paths';
|
||||
import { getVault, SecretValue } from '../security/vault';
|
||||
import { getOllamaClient } from '../agents/ollama-client';
|
||||
import { spawnAgent } from '../agents/spawner';
|
||||
import { getSession, addMessage, getHistory, getHistoryForApiCall, getWorkspace, setWorkspace, clearHistory, setContextTokens, cleanupSessions, cleanupEmptySessions, migrateGlobalSessionsToUser, listAllSessions, resolveNumCtx } from './session';
|
||||
import { getSession, addMessage, getHistory, getHistoryForApiCall, getWorkspace, setWorkspace, clearHistory, setContextTokens, cleanupSessions, cleanupEmptySessions, migrateGlobalSessionsToUser, listAllSessions, resolveNumCtx, activeOllamaEndpoint } from './session';
|
||||
import { hookBus } from './hooks/hooks';
|
||||
import { loadWorkspaceHooks } from './hooks/hook-loader';
|
||||
import { validateLinksInText, filterImageMarkdown } from './guards/link-validator';
|
||||
@@ -3545,9 +3545,10 @@ app.get('/api/model-context', async (req, res) => {
|
||||
const manifestCtx = _readOllamaManifestNumCtx(model);
|
||||
if (manifestCtx) { res.json({ contextWindow: manifestCtx }); return; }
|
||||
|
||||
// Fall back to /api/show model_info
|
||||
// Fall back to /api/show model_info — on the active provider's endpoint, since
|
||||
// the model being asked about may live on a remote box (지서버) rather than local.
|
||||
try {
|
||||
const ollamaEndpoint = (getConfig().getConfig() as any).ollama?.endpoint || 'http://localhost:11434';
|
||||
const ollamaEndpoint = activeOllamaEndpoint();
|
||||
const response = await fetch(`${ollamaEndpoint}/api/show`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
Reference in New Issue
Block a user