mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-30 11:46:36 +08:00
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { api } from './client'
|
|
import type { Media } from '../types'
|
|
|
|
export interface SearchIntent {
|
|
query: string
|
|
year?: number
|
|
genre?: string
|
|
type?: string
|
|
sort?: string
|
|
language?: string
|
|
}
|
|
|
|
export interface ExternalMediaResult {
|
|
source: string
|
|
media_type?: string
|
|
title: string
|
|
overview?: string
|
|
poster_url?: string
|
|
backdrop_url?: string
|
|
year?: number
|
|
rating?: number
|
|
tmdb_id?: number
|
|
bangumi_id?: number
|
|
douban_id?: string
|
|
subscribe_keyword: string
|
|
total_episodes?: number
|
|
downloaded_episodes?: number
|
|
local_media_count?: number
|
|
missing_episodes?: number[]
|
|
in_library?: boolean
|
|
}
|
|
|
|
export const aiAPI = {
|
|
status: () =>
|
|
api
|
|
.get<{ enabled: boolean; provider: string; model: string }>('/ai/status')
|
|
.then((r) => r.data),
|
|
|
|
smartSearch: (query: string) =>
|
|
api
|
|
.post<{ intent: SearchIntent; items: Media[]; external_items: ExternalMediaResult[] }>(
|
|
'/ai/search',
|
|
{ query },
|
|
)
|
|
.then((r) => r.data),
|
|
|
|
recommend: () => api.get<{ titles: string[] }>('/ai/recommend').then((r) => r.data.titles),
|
|
}
|