mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-30 17:56:44 +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"
|
|
}
|