mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 01:51:21 +08:00
refactor(cli): clarify icon mime handling
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
kiloconnect[bot]
parent
1a1c0bd86a
commit
165009df5f
@@ -3,7 +3,7 @@ import { HttpClient, HttpClientRequest } from "effect/unstable/http"
|
||||
import * as Tool from "./tool"
|
||||
import TurndownService from "turndown"
|
||||
import DESCRIPTION from "./webfetch.txt"
|
||||
import { isImageAttachment } from "@/util/media"
|
||||
import { isIconMimeType, isImageAttachment } from "@/util/media" // kilocode_change
|
||||
import { normalizeUrls } from "@/kilocode/util/url" // kilocode_change
|
||||
|
||||
const MAX_RESPONSE_SIZE = 5 * 1024 * 1024 // 5MB
|
||||
@@ -126,12 +126,7 @@ export const WebFetchTool = Tool.define(
|
||||
}
|
||||
|
||||
// kilocode_change start
|
||||
if (
|
||||
mime.startsWith("image/") &&
|
||||
!isImageAttachment(mime) &&
|
||||
mime !== "image/svg+xml" &&
|
||||
mime !== "image/vnd.fastbidsheet"
|
||||
) {
|
||||
if (isIconMimeType(mime)) {
|
||||
return {
|
||||
title,
|
||||
output: `Unsupported image format: ${mime}.`,
|
||||
|
||||
@@ -10,8 +10,12 @@ export function isMedia(mime: string) {
|
||||
}
|
||||
|
||||
// kilocode_change start
|
||||
export function isIconMimeType(mime: string) {
|
||||
return icons.has(mime)
|
||||
}
|
||||
|
||||
export function isImageAttachment(mime: string) {
|
||||
return mime.startsWith("image/") && mime !== "image/svg+xml" && mime !== "image/vnd.fastbidsheet" && !icons.has(mime)
|
||||
return mime.startsWith("image/") && mime !== "image/svg+xml" && mime !== "image/vnd.fastbidsheet" && !isIconMimeType(mime)
|
||||
}
|
||||
// kilocode_change end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user