message-file.ts 405 B

1234567891011121314
  1. import type { FilePart } from "@kirincode-ai/sdk/v2"
  2. export function attached(part: FilePart) {
  3. return part.url.startsWith("data:")
  4. }
  5. export function inline(part: FilePart) {
  6. if (attached(part)) return false
  7. return part.source?.text?.start !== undefined && part.source?.text?.end !== undefined
  8. }
  9. export function kind(part: FilePart) {
  10. return part.mime.startsWith("image/") ? "image" : "file"
  11. }