feat: 优化

This commit is contained in:
张德辉 2025-06-27 17:34:05 +08:00
parent be289b72b3
commit 0414f0b654
10 changed files with 299 additions and 16 deletions

View File

@ -21,9 +21,12 @@ export type { Body_update_model_api_models__model_id__put } from './models/Body_
export type { Body_upload_image_api_upload_post } from './models/Body_upload_image_api_upload_post';
export type { HTTPValidationError } from './models/HTTPValidationError';
export type { ImageEditItem } from './models/ImageEditItem';
export type { PaginationResponse } from './models/PaginationResponse';
export type { TaskQueryRequest } from './models/TaskQueryRequest';
export type { UploadResponse } from './models/UploadResponse';
export type { ValidationError } from './models/ValidationError';
export type { VideoDataPaginationRequest } from './models/VideoDataPaginationRequest';
export type { VideoDataResponse } from './models/VideoDataResponse';
export type { VideoTaskRequest } from './models/VideoTaskRequest';
export type { VideoTaskStatus } from './models/VideoTaskStatus';
@ -41,9 +44,12 @@ export { $Body_update_model_api_models__model_id__put } from './schemas/$Body_up
export { $Body_upload_image_api_upload_post } from './schemas/$Body_upload_image_api_upload_post';
export { $HTTPValidationError } from './schemas/$HTTPValidationError';
export { $ImageEditItem } from './schemas/$ImageEditItem';
export { $PaginationResponse } from './schemas/$PaginationResponse';
export { $TaskQueryRequest } from './schemas/$TaskQueryRequest';
export { $UploadResponse } from './schemas/$UploadResponse';
export { $ValidationError } from './schemas/$ValidationError';
export { $VideoDataPaginationRequest } from './schemas/$VideoDataPaginationRequest';
export { $VideoDataResponse } from './schemas/$VideoDataResponse';
export { $VideoTaskRequest } from './schemas/$VideoTaskRequest';
export { $VideoTaskStatus } from './schemas/$VideoTaskStatus';

View File

@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { VideoDataResponse } from './VideoDataResponse';
export type PaginationResponse = {
status: boolean;
data: Array<VideoDataResponse>;
pagination: Record<string, any>;
msg: string;
};

View File

@ -0,0 +1,27 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type VideoDataPaginationRequest = {
/**
* 1
*/
page?: number;
/**
* 100
*/
page_size?: number;
/**
* ID筛选
*/
task_id?: string;
/**
*
*/
img_status?: string;
/**
*
*/
video_status?: string;
};

View File

@ -0,0 +1,16 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type VideoDataResponse = {
id: number;
task_id?: string;
img_id?: string;
img_url?: string;
img_status?: string;
video_id?: string;
video_url?: string;
video_status?: string;
create_time?: string;
};

View File

@ -12,8 +12,11 @@ export * from './Body_update_model_api_models__model_id__put';
export * from './Body_upload_image_api_upload_post';
export * from './HTTPValidationError';
export * from './ImageEditItem';
export * from './PaginationResponse';
export * from './TaskQueryRequest';
export * from './UploadResponse';
export * from './ValidationError';
export * from './VideoDataPaginationRequest';
export * from './VideoDataResponse';
export * from './VideoTaskRequest';
export * from './VideoTaskStatus';

View File

@ -0,0 +1,31 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $PaginationResponse = {
properties: {
status: {
type: 'boolean',
isRequired: true,
},
data: {
type: 'array',
contains: {
type: 'VideoDataResponse',
},
isRequired: true,
},
pagination: {
type: 'dictionary',
contains: {
properties: {
},
},
isRequired: true,
},
msg: {
type: 'string',
isRequired: true,
},
},
} as const;

View File

@ -0,0 +1,31 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $VideoDataPaginationRequest = {
properties: {
page: {
type: 'number',
description: `页码从1开始`,
minimum: 1,
},
page_size: {
type: 'number',
description: `每页数量最大100`,
maximum: 100,
minimum: 1,
},
task_id: {
type: 'string',
description: `任务ID筛选可选`,
},
img_status: {
type: 'string',
description: `图片状态筛选(可选)`,
},
video_status: {
type: 'string',
description: `视频状态筛选(可选)`,
},
},
} as const;

View File

@ -0,0 +1,37 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $VideoDataResponse = {
properties: {
id: {
type: 'number',
isRequired: true,
},
task_id: {
type: 'string',
},
img_id: {
type: 'string',
},
img_url: {
type: 'string',
},
img_status: {
type: 'string',
},
video_id: {
type: 'string',
},
video_url: {
type: 'string',
},
video_status: {
type: 'string',
},
create_time: {
type: 'string',
format: 'date-time',
},
},
} as const;

View File

@ -9,8 +9,10 @@ import type { Body_local_async_change_bg_api_v2_local_batch_change_bg_post } fro
import type { Body_local_async_gen_images_api_v2_local_batch_edit_images_post } from '../models/Body_local_async_gen_images_api_v2_local_batch_edit_images_post';
import type { Body_local_async_gen_images_api_v2_local_batch_images_post } from '../models/Body_local_async_gen_images_api_v2_local_batch_images_post';
import type { Body_upload_image_api_upload_post } from '../models/Body_upload_image_api_upload_post';
import type { PaginationResponse } from '../models/PaginationResponse';
import type { TaskQueryRequest } from '../models/TaskQueryRequest';
import type { UploadResponse } from '../models/UploadResponse';
import type { VideoDataPaginationRequest } from '../models/VideoDataPaginationRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
@ -186,6 +188,14 @@ export class DefaultService {
}
/**
*
*
*
* Args:
* request: 包含任务ID列表的请求
* db: 数据库会话
*
* Returns:
* dict: 查询结果
* @returns any Successful Response
* @throws ApiError
*/
@ -204,4 +214,61 @@ export class DefaultService {
},
});
}
/**
*
*
*
* Args:
* request: 分页查询请求参数
* db: 数据库会话
*
* Returns:
* PaginationResponse: 分页查询结果
* @returns PaginationResponse Successful Response
* @throws ApiError
*/
public static getImageDataListApiImageDataListGet({
requestBody,
}: {
requestBody: VideoDataPaginationRequest,
}): CancelablePromise<PaginationResponse> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/image/data/list',
body: requestBody,
mediaType: 'application/json',
errors: {
422: `Validation Error`,
},
});
}
/**
* ID查询单条视频生成数据
* ID查询单条视频生成数据
*
* Args:
* data_id: 数据ID
* db: 数据库会话
*
* Returns:
* dict: 查询结果
* @returns any Successful Response
* @throws ApiError
*/
public static getVideoDataByIdApiVideoDataDataIdGet({
dataId,
}: {
dataId: number,
}): CancelablePromise<any> {
return __request(OpenAPI, {
method: 'GET',
url: '/api/video/data/{data_id}',
path: {
'data_id': dataId,
},
errors: {
422: `Validation Error`,
},
});
}
}

View File

@ -77,23 +77,76 @@ const ModelPage: React.FC = () => {
</div>
<div className='grid grid-cols-1 sm:grid-cols-3 lg:grid-cols-4 gap-6'>
{models.map(item => (
<div key={item.id} className='bg-white dark:bg-zinc-900 rounded-lg shadow p-4 flex flex-col'>
<img src={item.cover_url} alt='cover' className='w-full object-cover rounded mb-4 aspect-[9/16]' />
<div className='flex-1 flex flex-col gap-2'>
<div className='text-sm text-muted-foreground'>ID: {item.id}</div>
<div className='text-sm truncate'>: {Object.values(item.tag).join('_')}</div>
<div className='text-sm'>
: <span className={item.status === 1 ? 'text-green-600' : 'text-red-500'}>{item.status === 1 ? '启用' : '禁用'}</span>
</div>
<div className='text-xs text-muted-foreground'>: {item.create_time}</div>
<div
key={item.id}
className='
relative
rounded-2xl
bg-gradient-to-br from-white/80 via-zinc-100/60 to-blue-50/60
dark:from-zinc-900/80 dark:via-zinc-800/60 dark:to-blue-950/60
shadow-xl
border border-zinc-200 dark:border-zinc-800
backdrop-blur-md
p-5 flex gap-4
transition-transform hover:-translate-y-1 hover:shadow-2xl
group
'
>
<div className='relative'>
<img
src={item.cover_url}
alt='cover'
className='
w-[120px] aspect-[9/16] object-cover rounded-xl
shadow-md
transition-transform group-hover:scale-105
'
/>
<span className='absolute top-2 left-2 bg-blue-500/80 text-white text-xs px-2 py-0.5 rounded-full shadow'>
{item.status === 1 ? '启用' : '禁用'}
</span>
</div>
<div className='mt-4 flex gap-2'>
<Button size='sm' variant='outline' onClick={() => handleEdit(item)} className='flex-1'>
</Button>
<Button size='sm' variant='destructive' onClick={() => handleDelete(item.id)} className='flex-1'>
</Button>
<div className='flex-1 flex flex-col gap-2'>
<div className='flex-1 flex flex-col gap-1'>
<div className='text-xs text-zinc-400'>ID: {item.id}</div>
<div className='text-sm font-medium text-zinc-700 dark:text-zinc-200 truncate'>
:
{Object.values(item.tag).map((t, i) => (
<span
key={i}
className='inline-block bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 rounded px-2 py-0.5 mx-1 text-xs'
>
{t}
</span>
))}
</div>
<div className='text-xs text-zinc-400'>: {item.create_time}</div>
</div>
<div className='mt-4 flex gap-2'>
<Button
variant='outline'
onClick={() => handleEdit(item)}
className='
flex-1 rounded-lg border-blue-400
hover:border-blue-600 hover:bg-blue-50
transition-all
'
>
</Button>
<Button
variant='destructive'
onClick={() => handleDelete(item.id)}
className='
flex-1 rounded-lg border-pink-400
hover:border-pink-600 hover:bg-pink-50
transition-all
'
disabled={item.status === 1}
>
</Button>
</div>
</div>
</div>
))}