This commit is contained in:
2026-01-10 11:38:01 +08:00
parent 3775d125f2
commit 813c0709c8
6 changed files with 12 additions and 194 deletions

View File

@@ -34,7 +34,7 @@ export const app = useContextKey('app', new App());
export const ai = useContextKey('ai', new Kevisual({
apiKey: config.KEVISUAL_NEW_API_KEY,
model: 'qwen-turbo',
model: 'qwen-plus',
}));
export const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

View File

@@ -35,6 +35,7 @@ export interface ImageCreatorJobData {
export interface ImageGenerateJobData {
itemId: string;
prompt: string;
ratio?: string;
collectionName?: string;
}
@@ -173,7 +174,7 @@ export async function runImageGenerateWorker(): Promise<void> {
const worker = new Worker(
IMAGE_GENERATE_JOB,
async (job: Job<ImageGenerateJobData>) => {
const { itemId, prompt } = job.data;
const { itemId, prompt, ratio = '9:16' } = job.data;
const attemptsMade = job.attemptsMade;
console.log(`[ImageGenerate] Processing item: ${itemId}, attempt: ${attemptsMade + 1}/${GENERATE_MAX_RETRIES}`);
@@ -181,7 +182,7 @@ export async function runImageGenerateWorker(): Promise<void> {
// 调用 jimeng API 生成图片
const result = await jimengService.generateImage({
prompt,
ratio: '9:16',
ratio: ratio,
});
if (result.code !== 200 || !result.data?.data?.length) {