API 參考
圖片
透過 app.capabilities 判斷功能支援,透過 app.access 和主機權限判斷存取授權。範例使用合成值;呼叫前請替換路徑、ID、輸入和篩選條件。
型別定義
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!
}操作
subscription
imageModelsUpdated
接收圖片搜尋模型下載或可用性更新。
graphql
subscription imageModelsUpdated {
imageModelsUpdated { version status downloadProgress errorMessage modelSize modelDir isIndexing totalImages }
}mutation
cancelImageIndex
取消正在執行的索引工作。
graphql
mutation cancelImageIndex {
cancelImageIndex
}mutation
cancelImageModelDownload
取消正在進行的 AI 模型下載。
graphql
mutation cancelImageModelDownload {
cancelImageModelDownload
}mutation
disableImageSearch
停用 AI 圖片語意搜尋並釋放資源。
graphql
mutation disableImageSearch {
disableImageSearch
}mutation
enableImageSearch
啟用 AI 圖片語意搜尋;本機模型不存在時下載模型。
graphql
mutation enableImageSearch {
enableImageSearch
}mutation
importImageSearchModel
驗證並啟用已完整上傳的圖片搜尋模型包。
graphql
mutation importImageSearchModel {
importImageSearchModel
}mutation
startImageIndex
開始為 AI 搜尋建立圖片索引;force=true 時全部重新索引。
graphql
# `force` re-scans images that already have an embedding.
mutation startImageIndex($force: Boolean) {
startImageIndex(force: $force)
}query
imageCount
統計符合查詢條件的圖片數。
graphql
query imageCount($query: String!) {
imageCount(query: $query)
}query
imageSearchStatus
取得 AI 語意搜尋目前的索引狀態。
graphql
query imageSearchStatus {
imageSearchStatus { status downloadProgress errorMessage modelSize modelDir isIndexing totalImages indexedImages }
}query
images
搜尋圖片目錄,支援篩選、分頁和排序。
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 }
}