chore: checkpoint admin editor and perf work
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
import type {
|
||||
AdminAnalyticsResponse,
|
||||
AdminAiImageProviderTestResponse,
|
||||
AdminAiReindexResponse,
|
||||
AdminAiProviderTestResponse,
|
||||
AdminImageUploadResponse,
|
||||
AdminMediaDeleteResponse,
|
||||
AdminMediaListResponse,
|
||||
AdminPostCoverImageRequest,
|
||||
AdminPostCoverImageResponse,
|
||||
AdminDashboardResponse,
|
||||
AdminPostMetadataResponse,
|
||||
AdminPostPolishResponse,
|
||||
AdminReviewPolishRequest,
|
||||
AdminReviewPolishResponse,
|
||||
AdminR2ConnectivityResponse,
|
||||
AdminSessionResponse,
|
||||
AdminSiteSettingsResponse,
|
||||
CommentListQuery,
|
||||
@@ -117,6 +127,7 @@ export const adminApi = {
|
||||
method: 'DELETE',
|
||||
}),
|
||||
dashboard: () => request<AdminDashboardResponse>('/api/admin/dashboard'),
|
||||
analytics: () => request<AdminAnalyticsResponse>('/api/admin/analytics'),
|
||||
getSiteSettings: () => request<AdminSiteSettingsResponse>('/api/admin/site-settings'),
|
||||
updateSiteSettings: (payload: SiteSettingsPayload) =>
|
||||
request<AdminSiteSettingsResponse>('/api/admin/site-settings', {
|
||||
@@ -139,6 +150,48 @@ export const adminApi = {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ provider }),
|
||||
}),
|
||||
testAiImageProvider: (provider: {
|
||||
provider: string
|
||||
api_base: string | null
|
||||
api_key: string | null
|
||||
image_model: string | null
|
||||
}) =>
|
||||
request<AdminAiImageProviderTestResponse>('/api/admin/ai/test-image-provider', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
provider: provider.provider,
|
||||
api_base: provider.api_base,
|
||||
api_key: provider.api_key,
|
||||
image_model: provider.image_model,
|
||||
}),
|
||||
}),
|
||||
uploadReviewCoverImage: (file: File) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file, file.name)
|
||||
|
||||
return request<AdminImageUploadResponse>('/api/admin/storage/review-cover', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
},
|
||||
testR2Storage: () =>
|
||||
request<AdminR2ConnectivityResponse>('/api/admin/storage/r2/test', {
|
||||
method: 'POST',
|
||||
}),
|
||||
listMediaObjects: (query?: { prefix?: string; limit?: number }) =>
|
||||
request<AdminMediaListResponse>(
|
||||
appendQueryParams('/api/admin/storage/media', {
|
||||
prefix: query?.prefix,
|
||||
limit: query?.limit,
|
||||
}),
|
||||
),
|
||||
deleteMediaObject: (key: string) =>
|
||||
request<AdminMediaDeleteResponse>(
|
||||
`/api/admin/storage/media?key=${encodeURIComponent(key)}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
},
|
||||
),
|
||||
generatePostMetadata: (markdown: string) =>
|
||||
request<AdminPostMetadataResponse>('/api/admin/ai/post-metadata', {
|
||||
method: 'POST',
|
||||
@@ -149,6 +202,32 @@ export const adminApi = {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ markdown }),
|
||||
}),
|
||||
polishReviewDescription: (payload: AdminReviewPolishRequest) =>
|
||||
request<AdminReviewPolishResponse>('/api/admin/ai/polish-review', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
title: payload.title,
|
||||
review_type: payload.reviewType,
|
||||
rating: payload.rating,
|
||||
review_date: payload.reviewDate,
|
||||
status: payload.status,
|
||||
tags: payload.tags,
|
||||
description: payload.description,
|
||||
}),
|
||||
}),
|
||||
generatePostCoverImage: (payload: AdminPostCoverImageRequest) =>
|
||||
request<AdminPostCoverImageResponse>('/api/admin/ai/post-cover', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
title: payload.title,
|
||||
description: payload.description,
|
||||
category: payload.category,
|
||||
tags: payload.tags,
|
||||
post_type: payload.postType,
|
||||
slug: payload.slug,
|
||||
markdown: payload.markdown,
|
||||
}),
|
||||
}),
|
||||
listPosts: (query?: PostListQuery) =>
|
||||
request<PostRecord[]>(
|
||||
appendQueryParams('/api/posts', {
|
||||
|
||||
Reference in New Issue
Block a user