From b9f8025e34b2adb54f228f32443a441de2f16409 Mon Sep 17 00:00:00 2001 From: kim Date: Sat, 17 Oct 2026 12:36:53 +0900 Subject: [PATCH] =?UTF-8?q?python=5Feval=20=EC=B0=A8=ED=8A=B8:=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=EC=9D=B4=20/api/files/=20=EC=97=86=EC=9D=B4=20?= =?UTF-8?q?=EC=93=B4=20=EC=83=81=EB=8C=80=EA=B2=BD=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EB=A7=81=ED=81=AC=EB=A5=BC=20=EC=98=AC?= =?UTF-8?q?=EB=B0=94=EB=A5=B8=20=EC=A3=BC=EC=86=8C=EB=A1=9C=20=EA=B5=90?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- src/gateway/chat/reply-content.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gateway/chat/reply-content.ts b/src/gateway/chat/reply-content.ts index 97863aa..9339347 100644 --- a/src/gateway/chat/reply-content.ts +++ b/src/gateway/chat/reply-content.ts @@ -62,12 +62,16 @@ export function appendGeneratedChartImages( ): string { if (!toolResults?.length) return finalText; const missing: string[] = []; + let text = finalText; for (const r of toolResults) { if (r?.name !== 'python_eval' || r.error || !r.result) continue; for (const md of r.result.match(FILES_IMG_MD_G) || []) { - const url = md.slice(md.indexOf('](') + 2, -1); - if (!finalText.includes(url) && !missing.includes(md)) missing.push(md); + const url = md.slice(md.indexOf('](') + 2, -1); // /api/files/ + const bare = url.replace(/^\/api\/files\//, ''); + // 모델이 `![설명](squares.png)`처럼 /api/files/ 없이 쓰면 브라우저가 못 찾아 "불러올 수 없습니다"가 뜬다 — 주소만 고친다. + if (bare) text = text.split(`](${bare})`).join(`](${url})`).split(`](./${bare})`).join(`](${url})`); + if (!text.includes(url) && !missing.includes(md)) missing.push(md); } } - return missing.length ? `${finalText}\n\n${missing.join('\n\n')}`.trim() : finalText; + return missing.length ? `${text}\n\n${missing.join('\n\n')}`.trim() : text; }