-
Notifications
You must be signed in to change notification settings - Fork 909
feat: fetch-url supports inline images (PNG/JPEG/GIF/WebP) #2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
57f1eec
8a55f6f
2ff4c2f
3f4c3e9
dff0a80
cfdbb02
a30582b
ceed3fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": patch | ||
| "@moonshot-ai/vis-server": patch | ||
| --- | ||
|
|
||
| feat(vis): show LAN URLs when binding to 0.0.0.0 for remote control | ||
|
|
||
| When vis-server binds to 0.0.0.0 or :: (all interfaces), the startup | ||
| banner and CLI output now display the actual LAN IP addresses that | ||
| other devices on the same network can use to connect. This enables | ||
| lan-range remote control from phones, tablets, or other machines. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,7 +58,19 @@ export class FetchURLTool implements BuiltinTool<FetchURLInput> { | |
| { toolCallId, signal }: ExecutableToolContext, | ||
| ): Promise<ExecutableToolResult> { | ||
| try { | ||
| const { content, kind } = await this.fetcher.fetch(args.url, { toolCallId, signal }); | ||
| const { content, kind, imageUrl } = await this.fetcher.fetch(args.url, { toolCallId, signal }); | ||
|
|
||
| // When the fetcher returns an image, emit it as an image_url content part | ||
| // so the model can see it directly. | ||
| if (kind === 'image' && imageUrl !== undefined) { | ||
| return { | ||
| isError: false, | ||
| output: [ | ||
| { type: 'text', text: content }, | ||
| { type: 'image_url', image_url: { url: imageUrl } }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| ], | ||
| }; | ||
| } | ||
|
|
||
| if (!content) { | ||
| return { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an upstream response labels unsupported or non-image bytes as an accepted
Content-Typesuch asimage/png, this header-only check accepts it and builds adata:${normalizedMime}image result. Existing media policy sniffs the effective MIME because providers decode bytes and reject formats such as AVIF/HEIC even when mislabeled, so this can persist a bad image part in session history; buffer the body, sniff/canonicalize the MIME, and refuse unsupported bytes before returningkind: 'image'here and in the legacy provider.Useful? React with 👍 / 👎.