diff --git a/src/gateway/chat/build-tools.ts b/src/gateway/chat/build-tools.ts index d417c1e..418e6a2 100644 --- a/src/gateway/chat/build-tools.ts +++ b/src/gateway/chat/build-tools.ts @@ -183,34 +183,6 @@ export function createBuildTools(isOrchestrationSkillEnabled: () => boolean) { }, }, }, - { - type: 'function', - function: { - name: 'ollama_web_search', - description: 'Ollama 로컬 모델이 DuckDuckGo로 검색 후 결과를 자연어로 종합합니다. 느리고 로컬 모델 품질에 의존. 뉴스·정보 검색은 반드시 web_search를 사용. 이 툴은 web_search가 없는 환경에서만 fallback으로 사용.', - parameters: { - type: 'object', required: ['query'], - properties: { - query: { type: 'string', description: '검색 질문 또는 키워드' }, - max_results: { type: 'number', description: '최대 검색 결과 수 (기본 5)' }, - }, - }, - }, - }, - { - type: 'function', - function: { - name: 'ollama_web_fetch', - description: 'URL을 가져온 후 Ollama 모델이 내용을 요약합니다. 원문 대신 모델 요약이 필요할 때 web_fetch 대신 사용.', - parameters: { - type: 'object', required: ['url'], - properties: { - url: { type: 'string', description: '가져올 URL (https:// 포함)' }, - instruction: { type: 'string', description: '요약 지시 (선택, 예: "주요 수치만 뽑아줘")' }, - }, - }, - }, - }, { type: 'function', function: { diff --git a/src/gateway/chat/personality-context.ts b/src/gateway/chat/personality-context.ts index 60c2e86..6e03107 100644 --- a/src/gateway/chat/personality-context.ts +++ b/src/gateway/chat/personality-context.ts @@ -86,8 +86,6 @@ function detectToolCategories(text: string, sessionId?: string): Set { if (EMAIL.some(k => lower.includes(k))) cats.add('email'); const KAKAO = ['카카오톡', '카톡', 'kakao', 'kakaotalk', 'kakao_send_message']; if (KAKAO.some(k => lower.includes(k))) cats.add('kakao'); - const OLLAMA_SEARCH = ['ollama 검색', 'ollama search', 'ollama_web', 'ollama web', '올라마 검색', '올라마로 검색', '올라마 웹']; - if (OLLAMA_SEARCH.some(k => lower.includes(k))) cats.add('ollama_web'); return cats; } @@ -192,7 +190,6 @@ IMAGE STYLE TRANSFORM TOOL (FLUX.1-dev+PuLID via ComfyUI, 고품질 화풍): ima ⑨ weather_cmip6(location, start_date, end_date, variables?, aggregate?) → CMIP6 기후 모델 데이터(키 불필요). 1950~2050년. aggregate:"daily"|"monthly"|"annual". 기후 변화 추이 분석. 2015년 이후 SSP2-4.5 추정. RULES: 현재날씨/예보 → 한국은 weather_kma, 해외는 weather_openmeteo(weather_search·weather_airpollution은 날씨 앱 전용이라 일반 채팅엔 없음). 대기질(국내) → weather_airkorea. 한국 정확도 → weather_kma. 시간별/UV → weather_openmeteo. 과거 날씨(날짜 지정) → weather_era5. 30년 기후평균 → weather_nasa_power. CMIP6 기후 추이/미래전망(~2050) → weather_cmip6. SSP 시나리오 비교/압력면 → weather_cds. NEVER use web_search for weather data.`, - ollama_web: `OLLAMA WEB TOOLS: ollama_web_search(query, max_results?) → Ollama 모델이 DDG 검색 후 결과를 자연어로 요약 반환. ollama_web_fetch(url, instruction?) → URL 내용을 가져와 Ollama가 요약. instruction 예: "주요 수치만 뽑아줘". 일반 web_search/web_fetch보다 느리지만 모델이 결과를 직접 해석해서 반환.`, email: `EMAIL TOOLS (멀티 계정 지원): 모든 도구에 account? 파라미터로 계정 ID 지정 가능. 미지정 시 모든 계정 순회. 사용자별 설정에 등록된 계정만 접근 가능. email_list(folder?,limit?,account?) → 받은편지함 목록 (uid·제목·발신자·날짜·읽음여부). email_read(uid,folder?,account?) → 메일 전문 조회. email_send(to,subject,body,cc?,account?) → 메일 발송. email_search(query?,from?,subject?,since?,before?,folder?,limit?,account?) → 메일 검색. email_delete(uid,folder?,account?) → 메일 삭제. RULES: 이메일 관련 요청에는 항상 email_* 도구 사용 — web_search 사용 금지. email_list 결과는 계정별로 그룹핑된 원본 포맷(📬/📭 마커, 번호, UID 포함)을 그대로 사용자에게 전달할 것 — 자의적 재포맷팅 금지.`, @@ -343,7 +340,6 @@ return async function buildPersonalityContext( // Keep a block only when at least one tool it describes is really on offer. const CATEGORY_TOOLS: Record = { weather: ['weather_search', 'weather_openmeteo', 'weather_kma', 'weather_airpollution', 'weather_airkorea', 'weather_nasa_power', 'weather_era5', 'weather_cds', 'weather_cmip6'], - ollama_web: ['ollama_web_search', 'ollama_web_fetch'], email: ['email_list', 'email_read', 'email_send', 'email_search', 'email_delete'], kakao: ['kakao_send_message'], pdf: ['pdf_read', 'pdf_extract_images'], diff --git a/src/gateway/chat/tool-scope.ts b/src/gateway/chat/tool-scope.ts index 18ec47d..f3b4594 100644 --- a/src/gateway/chat/tool-scope.ts +++ b/src/gateway/chat/tool-scope.ts @@ -274,15 +274,6 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string) // explicit excel/spreadsheet keyword, same shape as the weather/legal gates above. Previously // ungated, so both tool schemas rode along on every single chat turn regardless of app. const hasExcelKeyword = /엑셀|xlsx|xls\b|스프레드시트|spreadsheet|excel/i.test(message); - // ollama_web_search/ollama_web_fetch are explicitly self-deprecating in their own descriptions - // ("web_search가 없는 환경에서만 fallback으로 사용") — and the provider fallback they exist for - // is already handled server-side inside executeWebSearch, so the model never needs to reach for - // them on its own. Advertising them cost 214 tokens per turn to tell the model not to use a - // tool. Gate on the same explicit phrasing personality-context.ts already uses for its - // ollama_web hint block, so the pair stays available when the user actually asks for it by name - // (otherwise that hint would describe tools no longer in the schema). - const ollamaWebToolNames = new Set(['ollama_web_search', 'ollama_web_fetch']); - const hasOllamaWebKeyword = /ollama[\s_]?(웹|web|검색|search)|올라마\s*(웹|검색|로\s*검색)/i.test(message); // Sub-agent/task-orchestration tools that tool_audit.log shows near-zero real usage for // (2026-05-04~2026-07-12: start_task/request_secondary_assist/subagent_spawn/ // delegate_to_specialist/spawn_subagent = 0 calls; task_control/spawn_agent = a handful, all @@ -368,7 +359,6 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string) // covers eonet_events/satellite_snapshot below, since "태풍" is in that keyword list. if (name === 'weather_map_screenshot' && !isWeatherAppSession && !hasSatelliteKeyword) return false; if (name === 'nhc_active_storms' && !isWeatherAppSession) return false; - if (ollamaWebToolNames.has(name) && !hasOllamaWebKeyword) return false; if (legalToolNames.has(name) && !isLawyerAppSession && !isDetectiveAppSession && !hasLegalKeyword) return false; if ((name === 'excel_read' || name === 'excel_write') && !isAccountantAppSession && !isInvestorAppSession && !hasExcelKeyword) return false; if (coderToolNames.has(name) && !hasCodeKeyword) return false; diff --git a/src/tools/registry.ts b/src/tools/registry.ts index cebf0ff..7ea686c 100644 --- a/src/tools/registry.ts +++ b/src/tools/registry.ts @@ -1,7 +1,7 @@ import { ToolResult } from '../types.js'; import { shellTool } from './shell.js'; import { readTool, writeTool, editTool, listTool, deleteTool, renameTool, copyTool, mkdirTool, statTool, appendTool, applyPatchTool } from './files.js'; -import { webSearchTool, webFetchTool, ollamaWebSearchTool, ollamaWebFetchTool } from './web.js'; +import { webSearchTool, webFetchTool } from './web.js'; import { memorySearchTool, memoryWriteTool } from './memory.js'; import { memoryReadTool } from './memory-read.js'; import { memoryFileSearchTool } from './memory-file-search.js'; @@ -176,8 +176,7 @@ class ToolRegistry { // Web tools this.registerSafe(webSearchTool); this.registerSafe(webFetchTool); - this.registerSafe(ollamaWebSearchTool); - this.registerSafe(ollamaWebFetchTool); + // ollama_web_search/fetch: 10-25 제거 — web_search 검색 체인이 실패 시 올라마 검색으로 이미 넘어감(중복, 2.5개월 1회). // Memory tools this.registerSafe(memoryWriteTool); this.registerSafe(memorySearchTool); diff --git a/tests/tool-scope.test.ts b/tests/tool-scope.test.ts index 5a18361..ea4e393 100644 --- a/tests/tool-scope.test.ts +++ b/tests/tool-scope.test.ts @@ -181,10 +181,10 @@ describe('키워드 게이트 — 필요할 때 확실히 나타난다', () => { assert.equal(filterFor('report.pdf 요약해줘')('pdf_read'), true); }); - test('[2026-07-29] ollama_web_* 는 명시 요청에만 — 평소엔 214토큰 낭비였다', () => { - assert.equal(filterFor('RTX 5090 검색해줘')('ollama_web_search'), false); - assert.equal(filterFor('올라마로 검색해줘')('ollama_web_search'), true); - assert.equal(filterFor('ollama web search 해줘')('ollama_web_fetch'), true); + test('[2026-10-25] ollama_web_* 는 제거됨 — web_search 체인이 실패 시 올라마 검색으로 이미 폴백', async () => { + const { createBuildTools } = await import('../src/gateway/chat/build-tools'); + const names = (createBuildTools(() => true) as any)().map((t: any) => t.function.name); + assert.ok(!names.includes('ollama_web_search') && !names.includes('ollama_web_fetch')); }); test('위성/재난 도구', () => {