2 files changed
+22
-3
No files matched your search
@@ -154,7 +154,7 @@ object ToolViewBuilder {
|
|||||||
): String? {
|
): String? {
|
||||||
val candidate =
|
val candidate =
|
||||||
ToolJson
|
ToolJson
|
||||||
.firstString(result, listOf("image_url", "url", "path", "image_path"))
|
.firstString(result, listOf("image_url", "image", "url", "path", "image_path"))
|
||||||
.ifEmpty { ToolJson.firstString(args, listOf("image_url", "url", "path")) }
|
.ifEmpty { ToolJson.firstString(args, listOf("image_url", "url", "path")) }
|
||||||
|
|
||||||
if (candidate.isEmpty()) {
|
if (candidate.isEmpty()) {
|
||||||
|
|||||||
+21
-2
@@ -592,8 +592,27 @@ class ToolViewCharacterizationTest {
|
|||||||
|
|
||||||
assertEquals("https://img.example/cat.png (image)", view.subtitle)
|
assertEquals("https://img.example/cat.png (image)", view.subtitle)
|
||||||
assertEquals("🖼️ a cat\n\n🔗 https://img.example/cat.png", view.detail)
|
assertEquals("🖼️ a cat\n\n🔗 https://img.example/cat.png", view.detail)
|
||||||
// Pinned: imageUrlFor does not read the "image" key, so no thumbnail.
|
assertEquals("https://img.example/cat.png", view.imageUrl)
|
||||||
assertNull(view.imageUrl)
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `image_generate data image reaches inline image view`() {
|
||||||
|
val view = build("image_generate", """{"prompt":"a cat"}""", """{"image":"data:image/png;base64,AAA"}""")
|
||||||
|
|
||||||
|
assertEquals("data:image/png;base64,AAA", view.imageUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `image_generate http image reaches inline image view`() {
|
||||||
|
val view = build("image_generate", "{}", """{"image":"http://img.example/cat.webp"}""")
|
||||||
|
|
||||||
|
assertEquals("http://img.example/cat.webp", view.imageUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `image_generate local path and non-image url do not reach inline image view`() {
|
||||||
|
assertNull(build("image_generate", "{}", """{"image":"/tmp/cat.png"}""").imageUrl)
|
||||||
|
assertNull(build("image_generate", "{}", """{"image":"https://img.example/page"}""").imageUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in new issue
Block a user