Skip to content

Commit

Permalink
Merge pull request #62 from abolfazl8131/master
Browse files Browse the repository at this point in the history
feat(response mock): added mock data as a response
  • Loading branch information
abolfazl8131 authored Nov 14, 2024
2 parents 95b68ef + b117600 commit 5a38b29
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
Binary file modified app/__pycache__/main.cpython-311.pyc
Binary file not shown.
Binary file modified app/routes/__pycache__/helm.cpython-311.pyc
Binary file not shown.
Binary file modified app/routes/__pycache__/terraform.cpython-311.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions app/routes/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from app.services import (write_installation,edit_directory_generator,execute_pythonfile)
from app.models import (HelmTemplateGeneration,Output)
from app.prompt_generators import (helm_template_generator)

import os
@app.post("/Helm-template/")
async def Helm_template_generation(request:HelmTemplateGeneration) -> Output:

if os.environ.get("TEST"):
return Output(output='output')
generated_prompt = helm_template_generator(request)
output = gpt_service(generated_prompt)
edit_directory_generator("helm_generator",output)
Expand Down
23 changes: 15 additions & 8 deletions app/routes/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,37 @@
IaC_installation_generator,
)
from app.template_generators.terraform.docker import (IaC_template_generator_docker)

import os

@app.post("/IaC-basic/")
async def IaC_basic_generation(request:IaCBasicInput) -> Output:

if os.environ.get("TEST"):
return Output(output='Terraform developed by hashicorp and it is very usefull')
generated_prompt = IaC_basics_generator(request)
output = gpt_service(generated_prompt)
return Output(output=output)

@app.post("/IaC-bugfix/")
async def IaC_bugfix_generation(request:IaCBugfixInput) -> Output:

if os.environ.get("TEST"):
return Output(output='fix this bug by adding x to the y')
generated_prompt = IaC_bugfix_generator(request)
output = gpt_service(generated_prompt)
return Output(output=output)


@app.post("/IaC-install/")
async def IaC_install_generation(request:IaCInstallationInput) -> Output:

if os.environ.get("TEST"):
return Output(output='apt-get install xyz \n apt-get update (covert them to shell file output)')
generated_prompt = IaC_installation_generator(request)
output = gpt_service(generated_prompt)
return Output(output=output)

@app.post("/IaC-template/docker")
async def IaC_template_generation_docker(request:IaCTemplateGenerationDocker) -> Output:

if os.environ.get("TEST"):
return Output(output='output (nothing special)')
generated_prompt = IaC_template_generator_docker(request)
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
Expand All @@ -55,7 +59,8 @@ async def IaC_template_generation_docker(request:IaCTemplateGenerationDocker) ->

@app.post("/IaC-template/aws/ec2")
async def IaC_template_generation_aws_ec2(request:IaCTemplateGenerationEC2) -> Output:

if os.environ.get("TEST"):
return Output(output='output (nothing special)')
generated_prompt = IaC_template_generator_docker(request)
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
Expand All @@ -64,7 +69,8 @@ async def IaC_template_generation_aws_ec2(request:IaCTemplateGenerationEC2) -> O

@app.post("/IaC-template/aws/s3")
async def IaC_template_generation_aws_s3(request:IaCTemplateGenerationS3) -> Output:

if os.environ.get("TEST"):
return Output(output='output (nothing special)')
generated_prompt = IaC_template_generator_docker(request)
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
Expand All @@ -73,7 +79,8 @@ async def IaC_template_generation_aws_s3(request:IaCTemplateGenerationS3) -> Out

@app.post("/IaC-template/aws/iam")
async def IaC_template_generation_aws_iam(request:IaCTemplateGenerationIAM) -> Output:

if os.environ.get("TEST"):
return Output(output='output (nothing special)')
generated_prompt = IaC_template_generator_docker(request)
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
environment:
<<: *common-variables
OPENAI_API_KEY: ${KEY:-}
TEST: ${TEST:-}
MONGO_HOST: mongo_gpt
MONGO_PORT: 27017

Expand Down

0 comments on commit 5a38b29

Please sign in to comment.