import { Body, Controller, Get, Post } from "@nestjs/common";
import OllamaProvider from "./ollama.provider";
import ResponseDto from "../../dto/response.dto";
import { OllamaAskDto } from "../../dto/ollama.dto";
import { ApiBody } from "@nestjs/swagger";

@Controller("/api/v1/ollama")
export default class OllamaController {

    constructor(private readonly ollamaProvider: OllamaProvider){}

    @Get("/hasAIInstalled")
    async hasAIInstalled(): Promise<ResponseDto>{
        return await this.ollamaProvider.hasAIInstalled();
    }

    @ApiBody({type: OllamaAskDto})
    @Post("/ask")
    async ask(@Body() payload: OllamaAskDto): Promise<ResponseDto>{
        return await this.ollamaProvider.ask(payload);
    }

}