diff --git a/src/app.controller.ts b/src/app.controller.ts index 40ef671..ad93b43 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -9,14 +9,17 @@ import { import { MidjourneyService } from './midjourney.service'; import { FastifyReply } from 'fastify'; import { AvatarBody, PromptMessageBody } from './interfaces'; -@Controller('vs1/midjourney') +@Controller('midjourney') export class AppController { constructor(private readonly MjService: MidjourneyService) {} @Post('imagine') @UseInterceptors() async Imagine(@Body() data: PromptMessageBody, @Res() res: FastifyReply) { - res.raw.setHeader('Content-Type', 'text/plain'); + res.raw.setHeader('Content-Type', 'text/html'); res.raw.setHeader('Transfer-Encoding', 'chunked'); + res.raw.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); + res.raw.setHeader('Pragma', 'no-cache'); + res.raw.setHeader('Expires', '0'); const msg = await this.MjService.Imagine(data.prompt, (uri: string) => { res.raw.write(JSON.stringify({ uri })); }); @@ -27,8 +30,12 @@ export class AppController { @Post('avatar') @UseInterceptors() async Avatar(@Body() data: AvatarBody, @Res() res: FastifyReply) { - res.raw.setHeader('Content-Type', 'text/plain'); + res.raw.setHeader('Content-Type', 'text/html'); res.raw.setHeader('Transfer-Encoding', 'chunked'); + res.raw.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); + res.raw.setHeader('Pragma', 'no-cache'); + res.raw.setHeader('Expires', '0'); + const msg = await this.MjService.Avatar(data.img, (uri: string) => { res.raw.write(JSON.stringify({ uri })); });