국내 길찾기 지도를 채팅에 카카오맵으로 삽입 — '길찾기 지도: URL'처럼 짧은 이름표가 붙은 카카오맵 줄도 지도로 띄움(모델이 도구 결과의 이름표를 그대로 옮겨 링크만 나가던 문제). 프롬프트: 길찾기 링크는 한 줄에 단독으로, MAPS의 '경로는 안 뜬다'를 '국내 운전 경로는 route_search 링크'로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Opus 5.5 committed 2026-10-23 15:05:46 +09:00
1 parent 83d30786d9
commit b3171cbd8f
2 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -229,11 +229,11 @@ export function buildChatSystemPrompt(input: SystemPromptInput): string {
? '\nPLACE SEARCH: For a specific place, business, or "near X" request in Korea (restaurants, pharmacies, stations, an address or phone number), call place_search FIRST and answer from its results — never write an address or phone number from memory. Default reference point is 구미시; pass location for another area. Put the 카카오맵 `지도:` URL from the result for the top place on its own line so it renders as an inline map, and mention the others by name. Opening hours are not in the result: point to its 상세 link instead of guessing.'
: '';
const routeSearchRuleBlock = toolNames.has('route_search')
? '\nROUTE SEARCH: For driving directions, travel time, distance, or toll questions within Korea, call route_search and answer ONLY from its numbers — never estimate a drive time or toll from memory. Default origin is 구미시; pass origin if the user names one. Give the 길찾기 지도 link from the result on its own line. For 대중교통/도보/자전거 say route_search covers driving only and give that link.'
? '\nROUTE SEARCH: For driving directions, travel time, distance, or toll questions within Korea, call route_search and answer ONLY from its numbers — never estimate a drive time or toll from memory. Default origin is 구미시; pass origin if the user names one. Put the 길찾기 지도 link from the result alone on its own line, with no label in front — the client shows it as an inline route map. For 대중교통/도보/자전거 say route_search covers driving only and give that link.'
: '';
const mapsRuleBlock = /지도|맵으로|위치(를|가|는)?|주소|어디(에|야|예요|에요|입니까|인가|니|냐|쯤|메)|어디\s*(있|찾|가|계|위치|살|사는|근처)|길\s*찾|가는\s*길|찾아가|찾아오|약도|도로명|지번|좌표|경위도|근처|인근|부근|가까운|\bmap\b|\baddress\b|directions|navigate|where\s+is|how\s+(do\s+i\s+|to\s+)get\s+to|nearby|landmark/i
.test(String(input.message || ''))
? '\nMAPS: When the user asks where a place is, for its address, or to see a map of a location, output the map URL on its own line — the client turns that standalone line into an inline map. For places IN KOREA use 카카오맵: `https://map.kakao.com/link/map/<URL-encoded name>,<lat>,<lon>` when you have coordinates (e.g. from place_search), otherwise `https://map.kakao.com/link/search/<URL-encoded query>`. Use Google only for places OUTSIDE Korea: `https://www.google.com/maps/search/<query>` (URL-encode, add city/country when ambiguous). Do NOT call browser_open for it and do NOT wrap it in `![](...)`. Still answer in text as well — the map is an addition, not a replacement. Not for pure route/turn-by-turn directions (those do not render).'
? '\nMAPS: When the user asks where a place is, for its address, or to see a map of a location, output the map URL on its own line — the client turns that standalone line into an inline map. For places IN KOREA use 카카오맵: `https://map.kakao.com/link/map/<URL-encoded name>,<lat>,<lon>` when you have coordinates (e.g. from place_search), otherwise `https://map.kakao.com/link/search/<URL-encoded query>`. Use Google only for places OUTSIDE Korea: `https://www.google.com/maps/search/<query>` (URL-encode, add city/country when ambiguous). Do NOT call browser_open for it and do NOT wrap it in `![](...)`. Still answer in text as well — the map is an addition, not a replacement. For driving routes in Korea use the route_search 길찾기 link instead (it renders as a route map); Google route links do not render.'
: '';
// VERIFY CONCRETE FACTS는 ANTI-HALLUCINATION 안에 무조건 붙어 있었지만, 하는 말이 통째로
// "web_search를 먼저 불러라"다 — 그 도구가 이번 턴 스키마에 없으면 실행 불가능한 지시이고,
+4 -2
View File
@@ -271,8 +271,10 @@ function renderMarkdown(text, opts) {
});
// Kakao Map URLs on their own line → inline iframe (2026-10-14: 국내 지도는 구글 대신 카카오맵).
// map.kakao.com/link/map|search|to/... 는 이름·좌표만으로 열리는 공개 링크 형식이다(키 불필요).
html = html.replace(/((?:^|\n)[ \t]*)(https:\/\/map\.kakao\.com\/link\/(?:map|search|to|by)\/[^\s<>")\n]+)([ \t]*)(?=\n|$)/gim, function(m, pre, url, post) {
// map.kakao.com/link/map|search|to|by/... 는 이름·좌표만으로 열리는 공개 링크 형식이다(키 불필요). by/car는 길찾기 경로.
// 모델이 "지도: URL", "길찾기 지도: URL"처럼 짧은 이름표를 붙여 내는 일이 많아(10-23 길찾기 답) 콜론으로 끝나는
// 20자 이내 이름표는 떼고 지도로 띄운다.
html = html.replace(/((?:^|\n)[ \t]*)(?:[^\n<>:]{1,20}:[ \t]*)?(https:\/\/map\.kakao\.com\/link\/(?:map|search|to|by)\/[^\s<>")\n]+)([ \t]*)(?=\n|$)/gim, function(m, pre, url, post) {
var safeEmbed = url.replace(/"/g, '&quot;');
return pre + '<div class="map-embed-wrap"><iframe class="map-embed" src="' + safeEmbed + '" allowfullscreen loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe><div class="map-embed-link"><a href="' + safeEmbed + '" target="_blank" rel="noopener">카카오맵에서 열기 ↗</a></div></div>' + post;
});