fix: 비전 없는 모델이 이미지 못 본다는 걸 명시 (환각 방지)
weather_map_screenshot 같은 도구의 stdout에는 "위 이미지에서 실제로 보이는 것만 설명하라" 같은 비전 모델 대상 지시문이 섞여 있는 경우가 있는데, 이걸 비전 없는 모델이 받으면 응답 안 된 명령으로 읽고 색상·좌표·아이콘 같은 시각적 디테일을 그럴듯하게 지어내는 문제가 있었음. 경로 힌트 뒤에 "이 모델은 이미지를 볼 수 없다"는 명시적 안내를 덧붙여 추측 대신 솔직히 모른다고 답하도록 함. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -420,11 +420,18 @@ function resolveToolImageContent(content: string, workspacePath: string, embedVi
|
||||
imageRe.lastIndex = 0;
|
||||
|
||||
if (!embedVision) {
|
||||
// Path-hint only: inject [편집 결과: path] before each image markdown
|
||||
return content.replace(/!\[([^\]]*)\]\(\/api\/files\/([^)]+)\)/g, (m, alt, p) => {
|
||||
// Path-hint only: inject [편집 결과: path] before each image markdown. This model
|
||||
// never receives the actual pixels, but tool stdout (e.g. weather_map_screenshot)
|
||||
// often embeds instructions like "describe only what you actually see in the image
|
||||
// above" written for vision-capable models — left unanswered, that instruction
|
||||
// reads as a direct order to a model with nothing to look at, and it fabricates
|
||||
// plausible-sounding visual detail (colors, icons, coordinates) to comply. Append
|
||||
// an explicit override so the model knows it cannot see anything and must not guess.
|
||||
const withHints = content.replace(/!\[([^\]]*)\]\(\/api\/files\/([^)]+)\)/g, (m, alt, p) => {
|
||||
try { p = decodeURIComponent(p); } catch {}
|
||||
return `[편집 결과 경로: ${p}]\n${m}`;
|
||||
});
|
||||
return `${withHints}\n\n[시스템 안내: 이 모델은 이미지를 볼 수 없습니다. 위 파일 경로는 참고용일 뿐이며, 이미지의 실제 시각적 내용(색상·좌표·아이콘·범례 등)은 알 수 없습니다. 절대 추측해서 설명하지 말고, 이미지 내용을 봐야 답할 수 있는 질문이면 볼 수 없다고 솔직히 말하세요.]`;
|
||||
}
|
||||
|
||||
// Full vision: convert to ContentPart[] with base64 thumbnails
|
||||
|
||||
Reference in New Issue
Block a user