Tham chiếu API

Hình ảnh

Kiểm tra app.capabilities để biết tính năng và app.access cùng quyền máy chủ để xác định quyền truy cập. Thay giá trị mẫu trước khi gọi.

Định nghĩa kiểu

graphql
type Subscription {
  imageModelsUpdated: ImageModelsUpdate!
}

type Mutation {
  cancelImageIndex: Boolean!
  cancelImageModelDownload: Boolean!
  disableImageSearch: Boolean!
  enableImageSearch: Boolean!
  importImageSearchModel: Boolean!
  startImageIndex(force: Boolean): Boolean!
}

type Query {
  imageCount(query: String!): Int!
  imageSearchStatus: ImageSearchStatus!
  images(query: String!, offset: Int!, limit: Int!, sortBy: ImageSortBy!): [Image!]!
}

enum DataType {
	DEFAULT
	AUDIO
	VIDEO
	IMAGE
	SMS
	CONTACT
	NOTE
	FEED_ENTRY
	CALL
	PACKAGE
	FILE
	APP_FILE
	DOC
}

type Image implements MediaItem {
	id: ID!
	title: String!
	path: String!
	size: Long!
	width: Int!
	height: Int!
	rotation: Int!
	bucketId: ID!
	createdAt: Instant!
	updatedAt: Instant!
	takenAt: Instant
	isFavorite: Boolean!
	tags: [Tag!]!
}

type ImageModelsUpdate {
	version: Long!
	status: ImageSearchStatusType!
	downloadProgress: Int!
	errorMessage: String!
	modelSize: Long!
	modelDir: String!
	isIndexing: Boolean!
	totalImages: Int!
	indexedImages: Int!
}

type ImageSearchStatus {
	status: ImageSearchStatusType!
	downloadProgress: Int!
	errorMessage: String!
	modelSize: Long!
	modelDir: String!
	isIndexing: Boolean!
	totalImages: Int!
	indexedImages: Int!
}

enum ImageSearchStatusType {
	UNAVAILABLE
	DOWNLOADING
	LOADING
	READY
	ERROR
}

enum ImageSortBy {
	UPDATED_AT_ASC
	UPDATED_AT_DESC
	SIZE_ASC
	SIZE_DESC
	NAME_ASC
	NAME_DESC
	TAKEN_AT_DESC
}

scalar Instant

scalar Long

interface MediaItem {
	id: ID!
	title: String!
	path: String!
	size: Long!
	bucketId: ID!
	createdAt: Instant!
	updatedAt: Instant!
}

type Tag {
	id: ID!
	name: String!
	type: DataType!
	count: Int!
}

Thao tác

subscription

imageModelsUpdated

Nhận cập nhật tải mô hình tìm kiếm hình ảnh hoặc tính khả dụng.

graphql
subscription imageModelsUpdated {
  imageModelsUpdated { version status downloadProgress errorMessage modelSize modelDir isIndexing totalImages }
}
mutation

cancelImageIndex

Hủy quá trình lập chỉ mục đang chạy.

graphql
mutation cancelImageIndex {
  cancelImageIndex
}
mutation

cancelImageModelDownload

Hủy tải mô hình AI đang tiến hành.

graphql
mutation cancelImageModelDownload {
  cancelImageModelDownload
}
mutation

disableImageSearch

Tắt tìm kiếm hình ảnh ngữ nghĩa AI và giải phóng tài nguyên.

graphql
mutation disableImageSearch {
  disableImageSearch
}
mutation

enableImageSearch

Bật tìm kiếm hình ảnh ngữ nghĩa AI. Tải mô hình trên thiết bị nếu chưa có.

graphql
mutation enableImageSearch {
  enableImageSearch
}
mutation

importImageSearchModel

Xác thực và kích hoạt gói mô hình tìm kiếm hình ảnh hoàn chỉnh đã tải lên.

graphql
mutation importImageSearchModel {
  importImageSearchModel
}
mutation

startImageIndex

Bắt đầu lập chỉ mục hình ảnh cho tìm kiếm AI. Truyền force=true để lập lại chỉ mục tất cả.

graphql
# `force` re-scans images that already have an embedding.
mutation startImageIndex($force: Boolean) {
  startImageIndex(force: $force)
}
query

imageCount

Đếm hình ảnh khớp truy vấn.

graphql
query imageCount($query: String!) {
  imageCount(query: $query)
}
query

imageSearchStatus

Lấy trạng thái lập chỉ mục tìm kiếm ngữ nghĩa AI hiện tại.

graphql
query imageSearchStatus {
  imageSearchStatus { status downloadProgress errorMessage modelSize modelDir isIndexing totalImages indexedImages }
}
query

images

Tìm danh mục hình ảnh có lọc, phân trang và sắp xếp.

graphql
query images($query: String!, $offset: Int!, $limit: Int!, $sortBy: ImageSortBy!) {
  images(query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { id title path size width height rotation bucketId }
}