feat: 去除所有接口中的 vo

This commit is contained in:
xingyu4j
2025-06-25 18:48:16 +08:00
parent 2855eb4e08
commit c59ebbecfd
51 changed files with 232 additions and 236 deletions

View File

@@ -16,7 +16,7 @@ import { AiImageStatusEnum } from '#/utils';
const props = defineProps({
detail: {
type: Object as PropType<AiImageApi.ImageVO>,
type: Object as PropType<AiImageApi.Image>,
default: () => ({}),
},
});
@@ -25,13 +25,13 @@ const emits = defineEmits(['onBtnClick', 'onMjBtnClick']);
const cardImageRef = ref<any>(); // 卡片 image ref
/** 处理点击事件 */
async function handleButtonClick(type: string, detail: AiImageApi.ImageVO) {
async function handleButtonClick(type: string, detail: AiImageApi.Image) {
emits('onBtnClick', type, detail);
}
/** 处理 Midjourney 按钮点击事件 */
async function handleMidjourneyBtnClick(
button: AiImageApi.ImageMidjourneyButtonsVO,
button: AiImageApi.ImageMidjourneyButtons,
) {
// 确认窗体
await confirm(`确认操作 "${button.label} ${button.emoji}" ?`);

View File

@@ -23,7 +23,7 @@ const props = defineProps({
required: true,
},
});
const detail = ref<AiImageApi.ImageVO>({} as AiImageApi.ImageVO);
const detail = ref<AiImageApi.Image>({} as AiImageApi.Image);
/** 获取图片详情 */
async function getImageDetail(id: number) {

View File

@@ -35,7 +35,7 @@ const queryParams = reactive({
pageSize: 10,
});
const pageTotal = ref<number>(0); // page size
const imageList = ref<AiImageApi.ImageVO[]>([]); // image 列表
const imageList = ref<AiImageApi.Image[]>([]); // image 列表
const imageListRef = ref<any>(); // ref
// 图片轮询相关的参数(正在生成中的)
const inProgressImageMap = ref<{}>({}); // 监听的 image 映射一般是生成中需要轮询key 为 image 编号value 为 image
@@ -85,7 +85,7 @@ async function refreshWatchImages() {
if (imageIds.length === 0) {
return;
}
const list = (await getImageListMyByIds(imageIds)) as AiImageApi.ImageVO[];
const list = (await getImageListMyByIds(imageIds)) as AiImageApi.Image[];
const newWatchImages: any = {};
list.forEach((image) => {
if (image.status === AiImageStatusEnum.IN_PROGRESS) {
@@ -106,7 +106,7 @@ async function refreshWatchImages() {
/** 图片的点击事件 */
async function handleImageButtonClick(
type: string,
imageDetail: AiImageApi.ImageVO,
imageDetail: AiImageApi.Image,
) {
// 详情
if (type === 'more') {
@@ -138,14 +138,14 @@ async function handleImageButtonClick(
/** 处理 Midjourney 按钮点击事件 */
async function handleImageMidjourneyButtonClick(
button: AiImageApi.ImageMidjourneyButtonsVO,
imageDetail: AiImageApi.ImageVO,
button: AiImageApi.ImageMidjourneyButtons,
imageDetail: AiImageApi.Image,
) {
// 1. 构建 params 参数
const data = {
id: imageDetail.id,
customId: button.customId,
} as AiImageApi.ImageMidjourneyActionVO;
} as AiImageApi.ImageMidjourneyAction;
// 2. 发送 action
await midjourneyAction(data);
// 3. 刷新列表

View File

@@ -17,8 +17,8 @@ import { AiPlatformEnum, ImageHotWords, OtherPlatformEnum } from '#/utils';
// 接收父组件传入的模型列表
const props = defineProps({
models: {
type: Array<AiModelModelApi.ModelVO>,
default: () => [] as AiModelModelApi.ModelVO[],
type: Array<AiModelModelApi.Model>,
default: () => [] as AiModelModelApi.Model[],
},
});
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
@@ -31,7 +31,7 @@ const prompt = ref<string>(''); // 提示词
const width = ref<number>(512); // 图片宽度
const height = ref<number>(512); // 图片高度
const otherPlatform = ref<string>(AiPlatformEnum.TONG_YI); // 平台
const platformModels = ref<AiModelModelApi.ModelVO[]>([]); // 模型列表
const platformModels = ref<AiModelModelApi.Model[]>([]); // 模型列表
const modelId = ref<number>(); // 选中的模型
/** 选择热词 */
@@ -64,7 +64,7 @@ async function handleGenerateImage() {
width: width.value, // 图片宽度
height: height.value, // 图片高度
options: {},
} as unknown as AiImageApi.ImageDrawReqVO;
} as unknown as AiImageApi.ImageDrawReq;
await drawImage(form);
} finally {
// 回调
@@ -75,7 +75,7 @@ async function handleGenerateImage() {
}
/** 填充值 */
async function settingValues(detail: AiImageApi.ImageVO) {
async function settingValues(detail: AiImageApi.Image) {
prompt.value = detail.prompt;
width.value = detail.width;
height.value = detail.height;
@@ -85,7 +85,7 @@ async function settingValues(detail: AiImageApi.ImageVO) {
async function handlerPlatformChange(platform: any) {
// 根据选择的平台筛选模型
platformModels.value = props.models.filter(
(item: AiModelModelApi.ModelVO) => item.platform === platform,
(item: AiModelModelApi.Model) => item.platform === platform,
);
modelId.value =
platformModels.value.length > 0 && platformModels.value[0]

View File

@@ -2,7 +2,7 @@
<script setup lang="ts">
import type { AiImageApi } from '#/api/ai/image';
import type { AiModelModelApi } from '#/api/ai/model/model';
import type { ImageModelVO, ImageSizeVO } from '#/utils';
import type { ImageModel, ImageSize } from '#/utils';
import { ref } from 'vue';
@@ -22,8 +22,8 @@ import {
// 接收父组件传入的模型列表
const props = defineProps({
models: {
type: Array<AiModelModelApi.ModelVO>,
default: () => [] as AiModelModelApi.ModelVO[],
type: Array<AiModelModelApi.Model>,
default: () => [] as AiModelModelApi.Model[],
},
});
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
@@ -50,7 +50,7 @@ async function handleHotWordClick(hotWord: string) {
}
/** 选择 model 模型 */
async function handleModelClick(model: ImageModelVO) {
async function handleModelClick(model: ImageModel) {
selectModel.value = model.key;
// 可以在这里添加模型特定的处理逻辑
// 例如,如果未来需要根据不同模型设置不同参数
@@ -76,12 +76,12 @@ async function handleModelClick(model: ImageModelVO) {
}
/** 选择 style 样式 */
async function handleStyleClick(imageStyle: ImageModelVO) {
async function handleStyleClick(imageStyle: ImageModel) {
style.value = imageStyle.key;
}
/** 选择 size 大小 */
async function handleSizeClick(imageSize: ImageSizeVO) {
async function handleSizeClick(imageSize: ImageSize) {
selectSize.value = imageSize.key;
}
@@ -107,7 +107,7 @@ async function handleGenerateImage() {
emits('onDrawStart', AiPlatformEnum.OPENAI);
const imageSize = Dall3SizeList.find(
(item) => item.key === selectSize.value,
) as ImageSizeVO;
) as ImageSize;
const form = {
platform: AiPlatformEnum.OPENAI,
prompt: prompt.value, // 提示词
@@ -118,7 +118,7 @@ async function handleGenerateImage() {
options: {
style: style.value, // 图像生成的风格
},
} as AiImageApi.ImageDrawReqVO;
} as AiImageApi.ImageDrawReq;
// 发送请求
await drawImage(form);
} finally {
@@ -130,13 +130,13 @@ async function handleGenerateImage() {
}
/** 填充值 */
async function settingValues(detail: AiImageApi.ImageVO) {
async function settingValues(detail: AiImageApi.Image) {
prompt.value = detail.prompt;
selectModel.value = detail.model;
style.value = detail.options?.style;
const imageSize = Dall3SizeList.find(
(item) => item.key === `${detail.width}x${detail.height}`,
) as ImageSizeVO;
) as ImageSize;
await handleSizeClick(imageSize);
}

View File

@@ -2,7 +2,7 @@
<script setup lang="ts">
import type { AiImageApi } from '#/api/ai/image';
import type { AiModelModelApi } from '#/api/ai/model/model';
import type { ImageModelVO, ImageSizeVO } from '#/utils';
import type { ImageModel, ImageSize } from '#/utils';
import { ref } from 'vue';
@@ -33,8 +33,8 @@ import {
// 接收父组件传入的模型列表
const props = defineProps({
models: {
type: Array<AiModelModelApi.ModelVO>,
default: () => [] as AiModelModelApi.ModelVO[],
type: Array<AiModelModelApi.Model>,
default: () => [] as AiModelModelApi.Model[],
},
});
const emits = defineEmits(['onDrawStart', 'onDrawComplete']);
@@ -64,12 +64,12 @@ async function handleHotWordClick(hotWord: string) {
}
/** 点击 size 尺寸 */
async function handleSizeClick(imageSize: ImageSizeVO) {
async function handleSizeClick(imageSize: ImageSize) {
selectSize.value = imageSize.key;
}
/** 点击 model 模型 */
async function handleModelClick(model: ImageModelVO) {
async function handleModelClick(model: ImageModel) {
selectModel.value = model.key;
versionList.value =
model.key === 'niji' ? NijiVersionList : MidjourneyVersions;
@@ -99,7 +99,7 @@ async function handleGenerateImage() {
// 发送请求
const imageSize = MidjourneySizeList.find(
(item) => selectSize.value === item.key,
) as ImageSizeVO;
) as ImageSize;
const req = {
prompt: prompt.value,
modelId: matchedModel.id,
@@ -107,7 +107,7 @@ async function handleGenerateImage() {
height: imageSize.height,
version: selectVersion.value,
referImageUrl: referImageUrl.value,
} as AiImageApi.ImageMidjourneyImagineReqVO;
} as AiImageApi.ImageMidjourneyImagineReq;
await midjourneyImagine(req);
} finally {
// 回调
@@ -118,18 +118,18 @@ async function handleGenerateImage() {
}
/** 填充值 */
async function settingValues(detail: AiImageApi.ImageVO) {
async function settingValues(detail: AiImageApi.Image) {
// 提示词
prompt.value = detail.prompt;
// image size
const imageSize = MidjourneySizeList.find(
(item) => item.key === `${detail.width}:${detail.height}`,
) as ImageSizeVO;
) as ImageSize;
selectSize.value = imageSize.key;
// 选中模型
const model = MidjourneyModels.find(
(item) => item.key === detail.options?.model,
) as ImageModelVO;
) as ImageModel;
await handleModelClick(model);
// 版本
selectVersion.value = versionList.value.find(

View File

@@ -28,8 +28,8 @@ import {
// 接收父组件传入的模型列表
const props = defineProps({
models: {
type: Array<AiModelModelApi.ModelVO>,
default: () => [] as AiModelModelApi.ModelVO[],
type: Array<AiModelModelApi.Model>,
default: () => [] as AiModelModelApi.Model[],
},
});
@@ -106,7 +106,7 @@ async function handleGenerateImage() {
clipGuidancePreset: clipGuidancePreset.value, // 文本提示相匹配的图像 CLIP
stylePreset: stylePreset.value, // 风格
},
} as unknown as AiImageApi.ImageDrawReqVO;
} as unknown as AiImageApi.ImageDrawReq;
await drawImage(form);
} finally {
// 回调
@@ -117,7 +117,7 @@ async function handleGenerateImage() {
}
/** 填充值 */
async function settingValues(detail: AiImageApi.ImageVO) {
async function settingValues(detail: AiImageApi.Image) {
prompt.value = detail.prompt;
width.value = detail.width;
height.value = detail.height;

View File

@@ -44,7 +44,7 @@ const platformOptions = [
},
];
const models = ref<AiModelModelApi.ModelVO[]>([]); // 模型列表
const models = ref<AiModelModelApi.Model[]>([]); // 模型列表
/** 绘画 start */
const handleDrawStart = async () => {};
@@ -55,7 +55,7 @@ const handleDrawComplete = async () => {
};
/** 重新生成:将画图详情填充到对应平台 */
const handleRegeneration = async (image: AiImageApi.ImageVO) => {
const handleRegeneration = async (image: AiImageApi.Image) => {
// 切换平台
selectPlatform.value = image.platform;
// 根据不同平台填充 image

View File

@@ -24,7 +24,7 @@ function onRefresh() {
}
/** 删除 */
async function handleDelete(row: AiImageApi.ImageVO) {
async function handleDelete(row: AiImageApi.Image) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.id]),
key: 'action_key_msg',
@@ -41,7 +41,7 @@ async function handleDelete(row: AiImageApi.ImageVO) {
}
}
/** 修改是否发布 */
const handleUpdatePublicStatusChange = async (row: AiImageApi.ImageVO) => {
const handleUpdatePublicStatusChange = async (row: AiImageApi.Image) => {
try {
// 修改状态的二次确认
const text = row.publicStatus ? '公开' : '私有';
@@ -82,7 +82,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
refresh: { code: 'query' },
search: true,
},
} as VxeTableGridOptions<AiImageApi.ImageVO>,
} as VxeTableGridOptions<AiImageApi.Image>,
});
onMounted(async () => {
// 获得下拉数据

View File

@@ -11,7 +11,7 @@ import { Image, Input, Pagination } from 'ant-design-vue';
import { getImagePageMy } from '#/api/ai/image';
const loading = ref(true); // 列表的加载中
const list = ref<AiImageApi.ImageVO[]>([]); // 列表的数据
const list = ref<AiImageApi.Image[]>([]); // 列表的数据
const total = ref(0); // 列表的总页数
const queryParams = reactive({
pageNo: 1,