fix: 测试页同时兼容 base64 与 URL 图片字段
直连 worker 返回 *_base64、经网关则改写为 *_url;统一 resolveImgSrc 后接口1/2/3/5/6 测试页都能正确显示结果图。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
.diff-list { font-size: 12px; color: #6b7280; margin-top: 6px; line-height: 1.7; }
|
||||
.diff-list li { margin-left: 18px; }
|
||||
</style>
|
||||
<script src="/static/img_downscale.js"></script>
|
||||
<script src="/static/img_downscale.js?v=2"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
@@ -161,12 +161,9 @@ async function submitTest() {
|
||||
|
||||
if (json.code === 0) {
|
||||
setStatus('✅ 请求成功 (' + _elapsed + 's) — request_id: ' + json.request_id, 'success');
|
||||
// 兼容本地直连 worker(返回 *_base64)与网关(改写为 *_url)两种情况
|
||||
// 兼容本地直连 worker(*_base64)与网关(*_url)
|
||||
const _d = json.data || {};
|
||||
const annoUrl = _d.annotated_image_url
|
||||
|| (_d.annotated_image_base64
|
||||
? ('data:image/png;base64,' + _d.annotated_image_base64.replace(/^data:image\/\w+;base64,/, ''))
|
||||
: '');
|
||||
const annoUrl = resolveImgSrc(_d.annotated_image_url, _d.annotated_image_base64, 'image/png');
|
||||
showOverlay(annoUrl);
|
||||
renderMetrics(json.data);
|
||||
$('metricsBar').classList.remove('hidden');
|
||||
|
||||
Reference in New Issue
Block a user