fix: use public model ids and render media results

This commit is contained in:
wlx committed 2026-09-29 01:26:28 +08:00
1 parent 9a946b29e6
commit ba98b47618
5 files changed
+62 -15

No files matched your search

+8
View File
@@ -16,3 +16,11 @@ test('mediaResult identifies image/audio and rejects unsafe URLs', () => {
assert.equal(image.imageUrl, 'https://cdn.example.test/image.png')
assert.equal(audio.audioUrl, 'https://cdn.example.test/sound.mp3')
})
test('mediaResult supports provider base64 output and nested media objects', () => {
const image = mediaResult({ b64_json: 'iVBORw0KGgo=', format: 'png' }, '')
assert.match(image.imageUrl, /^data:image\/png;base64,iVBORw0KGgo=$/)
const nested = mediaResult({ image_url: { b64_json: 'iVBORw0KGgo=', mime_type: 'image/png' } }, '')
assert.match(nested.imageUrl, /^data:image\/png;base64,iVBORw0KGgo=$/)
assert.equal(safeMediaUrl('data:text/html;base64,PGh0bWw+'), undefined)
})