refactor(tool-scope): 일반 채팅 날씨 도구 축소 (보조 2종 앱 전용, airkorea 대기질 키워드 게이트)
weather_search·weather_airpollution은 wt_ 앱 세션 전용으로, weather_airkorea는 대기질 키워드가 있을 때만 연다. 일반 예보 질문의 도구 스키마가 약 4,100자에서 약 2,150자로 줄어든다. 날씨 도구 설명 블록의 RULES도 kma/openmeteo 기준으로 정정. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a355ebcec0
commit
18895a4213
3 files changed
+27
-6
No files matched your search
@@ -181,8 +181,8 @@ speech_bubble: text, position("top-left"|"top-right"|"bottom-left"|"bottom-right
|
||||
IMAGE STYLE TRANSFORM TOOL (FLUX.1-dev+PuLID via ComfyUI, 고품질 화풍): image_style_transform(image, style) → style="cartoon"(캐리커쳐/만화 일러스트)만 지원. image_edit의 stylize cartoon은 기계적 필터라 은은한 보정에 가깝고, 이 툴은 FLUX img2img로 실제 화풍을 새로 그려서 훨씬 더 그림다운 결과를 냄. 얼굴이 감지되면 PuLID(insightface+EVA-CLIP)로 identity를 고정해서 원본과 다른 사람이 되는 문제를 막음. 대신 60~95초로 느림(2026-08-05 SDXL+IP-Adapter-FaceID에서 이전, 품질은 더 좋아졌지만 속도는 오히려 느려짐). 사용자가 "캐리커쳐로", "화질 좋게 카툰으로" 등 고품질 화풍 변환을 명시적으로 요청할 때만 사용 — 기본 카툰 요청에는 image_edit(stylize)를 먼저 쓰고, 결과가 밋밋하다고 하면 이 툴을 제안. watercolor와 sketch는 (구 SDXL 시절) 시도했다가 모두 되돌렸음(시드 고정 없이 강한 strength가 필요해서 원본과 다른 사람 얼굴로 드리프트하는 경우가 있었음) — 항상 image_edit 사용. anime/흑백 요청에도 이 툴 대신 image_edit 사용(더 빠름).`,
|
||||
|
||||
weather: `WEATHER TOOLS (8개):
|
||||
① weather_search(location, type?, units?) → OpenWeather 현재날씨/5일예보. type:"current"|"forecast".
|
||||
② weather_airpollution(location, type?) → OpenWeather 대기질. AQI/PM2.5/PM10/O3/NO2/CO/SO2. type:"current"|"forecast"(96h).
|
||||
① weather_search(location, type?, units?) → [날씨 앱 전용] OpenWeather 현재날씨/5일예보. type:"current"|"forecast".
|
||||
② weather_airpollution(location, type?) → [날씨 앱 전용] OpenWeather 대기질. AQI/PM2.5/PM10/O3/NO2/CO/SO2. type:"current"|"forecast"(96h).
|
||||
③ weather_openmeteo(location, hours?, variables?) → Open-Meteo 시간별 예보(무료). ECMWF/GFS. 최대 384시간. UV지수·강수확률 포함.
|
||||
④ weather_kma(location, type?) → 기상청 공식 API. 한국 전용. type:"current"|"forecast". API 키 필요.
|
||||
⑤ weather_airkorea(sido) → 에어코리아 실시간 대기질. 시도명. API 키 필요.
|
||||
@@ -190,7 +190,7 @@ IMAGE STYLE TRANSFORM TOOL (FLUX.1-dev+PuLID via ComfyUI, 고품질 화풍): ima
|
||||
⑦ weather_era5(location, start_date, end_date?, variables?, hourly?) → ERA5 재분석 일별/시간별 데이터(키 불필요). 1940년~5일 전. 과거 날씨 사실 확인·특정 사건 당시 기상에 사용.
|
||||
⑧ weather_cds(location, year, month, dataset?, preset?, request?) → Copernicus CDS 정식 API. ERA5 압력면·ERA5-Land·CMIP6 SSP 시나리오 비교. cds.api_key vault 등록 필요. preset: surface_daily|pressure_500hpa|cmip6_ssp126|cmip6_ssp245|cmip6_ssp585.
|
||||
⑨ weather_cmip6(location, start_date, end_date, variables?, aggregate?) → CMIP6 기후 모델 데이터(키 불필요). 1950~2050년. aggregate:"daily"|"monthly"|"annual". 기후 변화 추이 분석. 2015년 이후 SSP2-4.5 추정.
|
||||
RULES: 현재날씨/예보 → weather_search. 대기질(국내) → weather_airkorea. 대기질(해외) → weather_airpollution. 한국 정확도 → 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.`,
|
||||
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보다 느리지만 모델이 결과를 직접 해석해서 반환.`,
|
||||
|
||||
|
||||
@@ -87,7 +87,12 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string)
|
||||
// Air quality is a separate concern from the forecast, and weather_search is a redundant
|
||||
// fallback whose schema costs as much as openmeteo while carrying less data — so they load
|
||||
// on the weather keyword but are not part of the everyday pair above.
|
||||
const weatherToolNames = new Set(['weather_search', 'weather_airpollution', 'weather_airkorea']);
|
||||
// 2026-10-14: weather_search·weather_airpollution은 일반 채팅에서 뺐다(wt_ 앱 전용).
|
||||
// weather_kma/openmeteo와 기능이 겹치는 보조 도구인데 날씨 키워드 한 번에 1,428자가 같이 붙었다.
|
||||
// weather_airkorea만 대기질 키워드가 있을 때 연다 — 예보 질문엔 필요 없고, 미세먼지 질문엔
|
||||
// 필수(09-02 사고: kma에는 대기질 데이터가 없어 창작 답이 나왔다).
|
||||
const weatherAppOnlyToolNames = new Set(['weather_search', 'weather_airpollution']);
|
||||
const hasAirQualityKeyword = /미세먼지|초미세|대기\s*질|공기\s*질|황사|pm\s*2\.?5|pm\s*10|air\s*quality|\baqi\b/i.test(topicText);
|
||||
// 2026-09-02 (efficiency audit): these four are climate-reanalysis/projection archives, not
|
||||
// "what's the weather" tools — ERA5 and CDS are Copernicus reanalysis, CMIP6 is scenario
|
||||
// projections, NASA POWER is agro-climate history. They were riding the plain weather keyword,
|
||||
@@ -331,7 +336,8 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string)
|
||||
if (name.startsWith('mcp__dental-dict-sqlite__') && !isDentalAppSession) return false;
|
||||
if ((name.startsWith('mcp__psychotherapy-cases-sqlite__') || name.startsWith('mcp__psychiatry-cases-sqlite__')) && !isMindAppSession) return false;
|
||||
if (basicWeatherToolNames.has(name) && !isWeatherAppSession && !hasWeatherKeyword) return false;
|
||||
if (weatherToolNames.has(name) && !isWeatherAppSession && !hasWeatherKeyword) return false;
|
||||
if (weatherAppOnlyToolNames.has(name) && !isWeatherAppSession) return false;
|
||||
if (name === 'weather_airkorea' && !isWeatherAppSession && !hasAirQualityKeyword) return false;
|
||||
if (climateToolNames.has(name) && !isWeatherAppSession && !hasClimateKeyword) return false;
|
||||
// Windy map screenshots only make sense inside the dedicated weather app tab (the
|
||||
// model there has already generated the embed.windy.com URL to capture) — unlike the
|
||||
|
||||
@@ -119,11 +119,26 @@ describe('키워드 게이트 — 필요할 때 확실히 나타난다', () => {
|
||||
// 있었다. papa의 meteorologist:false 때문에 "오늘 미세먼지 어때?"가 weather_kma/openmeteo
|
||||
// 만 받았고, weather_kma엔 대기질 데이터가 아예 없어서 실패 아니면 창작밖에 안 나왔다.
|
||||
// 이제 키워드만으로 결정한다.
|
||||
test('일반 예보 질문엔 대기질·보조 날씨 도구를 싣지 않는다', () => {
|
||||
const f = filterFor('내일 서울 날씨 어때?');
|
||||
assert.equal(f('weather_kma'), true);
|
||||
assert.equal(f('weather_openmeteo'), true);
|
||||
for (const n of ['weather_airkorea', 'weather_airpollution', 'weather_search']) assert.equal(f(n), false, n);
|
||||
});
|
||||
|
||||
test('wt_ 앱 세션에선 보조 날씨 도구가 열린다', () => {
|
||||
const f = buildSkillToolFilter({ ...allSkills, message: '안녕', sessionId: 'wt_1' });
|
||||
for (const n of ['weather_airkorea', 'weather_airpollution', 'weather_search']) assert.equal(f(n), true, n);
|
||||
});
|
||||
|
||||
test('대기질 도구는 스킬 토글과 무관하게 날씨 키워드로 열린다', () => {
|
||||
const f = filterFor('오늘 서울 미세먼지 어때?');
|
||||
for (const n of ['weather_airkorea', 'weather_airpollution', 'weather_kma', 'weather_openmeteo']) {
|
||||
for (const n of ['weather_airkorea', 'weather_kma', 'weather_openmeteo']) {
|
||||
assert.equal(f(n), true, `${n} 이(가) 레거시 토글 때문에 막힘`);
|
||||
}
|
||||
// 2026-10-14: 보조 도구 2종은 일반 채팅에서 빠지고 wt_ 앱 전용이다
|
||||
assert.equal(f('weather_airpollution'), false);
|
||||
assert.equal(f('weather_search'), false);
|
||||
// 기후 아카이브는 여전히 별도 키워드를 요구한다
|
||||
assert.equal(f('weather_era5'), false);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user