mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-02 23:23:45 +00:00
15 lines
404 B
TypeScript
15 lines
404 B
TypeScript
import type { FilePart } from "@opencode-ai/sdk/v2"
|
|
|
|
export function attached(part: FilePart) {
|
|
return part.url.startsWith("data:")
|
|
}
|
|
|
|
export function inline(part: FilePart) {
|
|
if (attached(part)) return false
|
|
return part.source?.text?.start !== undefined && part.source?.text?.end !== undefined
|
|
}
|
|
|
|
export function kind(part: FilePart) {
|
|
return part.mime.startsWith("image/") ? "image" : "file"
|
|
}
|