Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/gpt integration #801

Merged
merged 65 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2904471
first basic functionality of the ai feature works
SponsoredByPuma Mar 14, 2024
3eada9b
Google Java Format
Mar 14, 2024
9893317
add poetry dependency file
SponsoredByPuma Mar 14, 2024
4b96d47
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Mar 14, 2024
fbfc52a
add test property for python container, test classes
SponsoredByPuma Mar 14, 2024
0068f51
Google Java Format
Mar 14, 2024
1d790c0
improve design of markdown, userstories & add markdown to member
SponsoredByPuma Mar 14, 2024
3489b0b
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Mar 14, 2024
55d219b
add title functionality + style, improve Codebase
SponsoredByPuma Mar 15, 2024
f1289d2
styling of the description improved, removed overflow for ai buttons
SponsoredByPuma Mar 15, 2024
88f6dc0
logic for description, styling of description, modal, title
SponsoredByPuma Mar 18, 2024
95b4752
add AiControllerTest Logic
SponsoredByPuma Mar 18, 2024
2eaebd4
Google Java Format
Mar 18, 2024
24d96e7
add grammar check logic + JUnitTests Backend, add spinner to fe,
SponsoredByPuma Mar 19, 2024
0f9c7f2
Google Java Format
Mar 19, 2024
0f41cb9
add PyTest to Python Container
SponsoredByPuma Mar 19, 2024
73bd800
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Mar 19, 2024
3ef3c27
Merge branch 'main' into feature/gpt-integration
SponsoredByPuma Mar 28, 2024
4c10970
Merge branch 'main' into feature/gpt-integration
SponsoredByPuma Apr 4, 2024
9f1410f
change prettier to warn
SponsoredByPuma Apr 4, 2024
40ca9cd
add confidental masking for grammar check
SponsoredByPuma Apr 9, 2024
74c27e8
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Apr 9, 2024
cd7159d
Google Java Format
Apr 9, 2024
aab328c
add confidental masking for description, add jira2md converter, us.id…
SponsoredByPuma Apr 11, 2024
abc382c
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Apr 11, 2024
f8ae0d5
Google Java Format
Apr 11, 2024
ad72c74
Merge remote-tracking branch 'origin/main' into feature/gpt-integration
SponsoredByPuma Apr 11, 2024
ce7198e
privacy modal added, 3 categories of confidential data, tried few-sho…
SponsoredByPuma Apr 15, 2024
776f15f
Google Java Format
Apr 15, 2024
df03563
added language selector to privacy modal for better prompting results
SponsoredByPuma Apr 16, 2024
d1cc4de
Google Java Format
Apr 16, 2024
3e7bf69
added user story estimation feature, translation
SponsoredByPuma Apr 16, 2024
46ba276
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Apr 16, 2024
1cd775a
Google Java Format
Apr 16, 2024
76724a7
add cancel button translation
SponsoredByPuma Apr 17, 2024
61952dc
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma Apr 17, 2024
1d86ef7
prompts are now in extra files, add docker env variable
SponsoredByPuma Apr 18, 2024
3a752cc
Merge remote-tracking branch 'origin/main' into feature/gpt-integration
SponsoredByPuma Apr 18, 2024
c55a050
remove docker env, and logic for python service
SponsoredByPuma Apr 18, 2024
4c2f411
improve modal design, functionality
SponsoredByPuma Apr 18, 2024
de53933
fix deletion bug
SponsoredByPuma Apr 18, 2024
71ca362
splitting a user story now works
SponsoredByPuma Apr 22, 2024
63ea64b
Google Java Format
Apr 22, 2024
3e9f13f
improve optic of split feature
Apr 24, 2024
79629ea
improve german prompt & design of splitting modal
SponsoredByPuma Apr 26, 2024
9d62d0e
fix title bug, remove unnecessary variable
SponsoredByPuma Apr 26, 2024
49ac2ee
fix deletion bug for splitted User Stories
SponsoredByPuma Apr 26, 2024
01ca545
improve title prompt_title.txt
SponsoredByPuma Apr 26, 2024
c74fc3e
fix prompt_grammar_check.txt
SponsoredByPuma Apr 30, 2024
1ec806c
adjust styling of modal
SponsoredByPuma May 2, 2024
3839d1a
add function to check if api key exists
SponsoredByPuma May 7, 2024
484baaa
Google Java Format
May 7, 2024
ad91839
increase max_tokens for prompts
SponsoredByPuma May 13, 2024
11595b0
Merge remote-tracking branch 'origin/feature/gpt-integration' into fe…
SponsoredByPuma May 13, 2024
42fee54
fix two prompting mistakes
SponsoredByPuma May 21, 2024
7863f9b
marking important content now works
SponsoredByPuma May 29, 2024
de27bde
Google Java Format
May 29, 2024
4b87286
remove unnecessary prints
Aug 7, 2024
193c6a0
add ai container to pipeline
Aug 7, 2024
9b86546
Merge remote-tracking branch 'refs/remotes/origin/main' into feature/…
Aug 7, 2024
be6f1ee
fix: merge conflicts & remove cat gif
Aug 7, 2024
bc6b692
add ai container to docker
Aug 7, 2024
762b0a1
add new properties
Aug 7, 2024
dba20b1
rename file
Aug 7, 2024
1516693
change env profile
Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/diveni-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- 'backend/**'
- 'frontend/**'
- 'proxy/**'
- 'ai/**'
- '.github/workflows/diveni-deploy.yaml'
workflow_dispatch:

Expand All @@ -18,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
service: [backend, frontend, proxy]
service: [ai, backend, frontend, proxy]
permissions:
contents: read
packages: write
Expand Down
14 changes: 14 additions & 0 deletions ai/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.11.2

WORKDIR /ai

RUN pip install poetry

COPY . .

RUN poetry install
RUN poetry self add poetry-dotenv-plugin

EXPOSE 8000

CMD ["poetry","run", "uvicorn", "controller.gpt_controller:app", "--host", "0.0.0.0", "--port", "8000"]
2 changes: 2 additions & 0 deletions ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is our python container, used for the communication between our Java Spring Boot Backend
and the openAI API.
63 changes: 63 additions & 0 deletions ai/controller/gpt_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from fastapi import FastAPI
import service.gpt_service as service
from dto.user_story import UserStory
from dto.title import Title
from dto.estimation_data import Estimation_data

app = FastAPI()


@app.post("/improve-title")
async def improve_title(title: Title):
print("gpt_controller: --> improve_title(), title={", title.name, "}")
response = await service.improve_title(title.name, title.confidential_data)
print("gpt_controller: <-- improve_title()")
return {"improvedTitle": response}


@app.post("/improve-description")
async def improve_description(data: UserStory):
print("gpt_controller: --> improve_description(), description={", data, "}")
response = await service.improve_description(data)
print("gpt_controller: <-- improve_description()")
return {"improved_description": response.description, "improved_acceptance_criteria": response.acceptance_criteria}


@app.post("/grammar-check")
async def grammar_check(data: UserStory):
print("gpt_controller: --> grammar_check(), description={", data, "}")
response = await service.grammar_check(data)
print("gpt_controller: <-- grammar_check()")
return {"improved_description": response}


@app.post("/estimate-user-story")
async def estimate_user_story(data: Estimation_data):
print("gpt_controller: --> estimate_user_story(), data={", data, "}")
response = await service.estimate_user_story(data)
print("gpt_controller: <-- estimate_user_story()")
return {"estimation": response}


@app.post("/split-user-story")
async def split_user_story(data: UserStory):
print("gpt_controller: --> split_user_story(), data={", data, "}")
response = await service.split_user_story(data)
print("gpt_controller: <-- split_user_story()")
return {"new_user_stories": response}


@app.post("/mark-description")
async def mark_description(data: UserStory):
print("gpt_controller: --> mark_description(), data={", data, "}")
response = await service.mark_description(data)
print("gpt_controller: <-- mark_description()")
return {"description": response}


@app.get("/check-api-key")
def check_api_key():
print("gpt_controller: --> check_api_key()")
response = service.check_api_key()
print("gpt_controller: <-- check_api_key()")
return {"has_api_key": response}
7 changes: 7 additions & 0 deletions ai/dto/description_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Description_Response:
description: str
acceptance_criteria: list

def __init__(self, description, acceptance_criteria):
self.description = description
self.acceptance_criteria = acceptance_criteria
8 changes: 8 additions & 0 deletions ai/dto/estimation_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pydantic import BaseModel


class Estimation_data(BaseModel):
title: str
description: str
voteSet: list
confidential_data: dict
6 changes: 6 additions & 0 deletions ai/dto/title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from pydantic import BaseModel


class Title(BaseModel):
name: str
confidential_data: dict
8 changes: 8 additions & 0 deletions ai/dto/user_story.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pydantic import BaseModel


class UserStory(BaseModel):
title: str
description: str
language: str
confidential_data: dict
24 changes: 24 additions & 0 deletions ai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tool.poetry]
name = "ai"
version = "0.1.0"
description = ""
authors = ["SponsoredByPuma"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
fastapi = "^0.110.0"
uvicorn = "^0.28.0"
openai = "^1.13.3"
pytest = "^8.1.1"
mock = "^5.1.0"


[tool.poetry.group.dev.dependencies]
pytest = "^8.1.1"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

100 changes: 100 additions & 0 deletions ai/resource/names.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Alice Johnson
Benjamin Lee
Catherine Adams
David Martinez
Ella Thompson
Franklin White
Grace Robinson
Henry Harris
Isabella Turner
James Edwards
Katherine Scott
Liam Walker
Mia Lewis
Noah Hall
Olivia Green
Patrick Carter
Quinn Foster
Rachel King
Samuel Miller
Taylor Allen
Victoria Young
William Brown
Zoe Adams
Alexander Clark
Brooklyn Hill
Christopher Turner
Daisy Martinez
Ethan Johnson
Faith Robinson
Gabriel Lee
Hannah White
Isaac Harris
Jasmine Thompson
Kevin Edwards
Lily Scott
Mason Walker
Nora Lewis
Owen Hall
Penelope Green
Quentin Foster
Ruby King
Sebastian Miller
Tessa Allen
Ulysses Young
Violet Brown
Wyatt Adams
Xander Clark
Yara Hill
Zachary Turner
Ava Carter
Bryce Foster
Chloe Robinson
Daniel Lee
Emily Harris
Finn Thompson
Grace Turner
Henry Walker
Isabella Green
Jacob Hall
Kylie Scott
Liam Young
Mila Adams
Nathan Clark
Olivia Hill
Parker Foster
Quinn Lewis
Ryan Martinez
Sophia Turner
Thomas Edwards
Uma Robinson
Vincent Lee
Willow Harris
Xavier Thompson
Yasmine Turner
Zara Walker
Adam Green
Bella Hall
Caleb Scott
Diana Young
Eli Adams
Fiona Clark
George Hill
Hazel Foster
Ian Lewis
Jade Martinez
Kai Turner
Luna Edwards
Max Robinson
Nina Lee
Oscar Harris
Paige Thompson
Quincy Walker
Riley Green
Sofia Hall
Theo Scott
Una Young
Vera Adams
Wyatt Clark
Xena Hill
Yuki Foster
13 changes: 13 additions & 0 deletions ai/resource/prompts/prompt_estimation_fibo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: filter numbers out of the input field
Description: The existing Backend Service should filter numbers out of the input, since the system crashes with numbers.
Valid Options are: ['1','2','3','5','8','13','21']
Answer: {"estimation": "2"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: Create a webapp like amazon
Description: Our Company should have a web application like amazon, but better
## Acceptance Criteria:
* robust and fast backend with java
* good looking design
* nosql database should be implemented
Valid Options are: ['1','2','3','5','8','13','21']
Answer: {"estimation": "21"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title:
13 changes: 13 additions & 0 deletions ai/resource/prompts/prompt_estimation_hour.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: filter numbers out of the input field
Description: The existing Backend Service should filter numbers out of the input, since the system crashes with numbers.
Valid Options are: ['1','2','3','4','5','6','8','10','12','16']
Answer: {"estimation": "2"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: Create a webapp like amazon
Description: Our Company should have a web application like amazon, but better
## Acceptance Criteria:
* robust and fast backend with java
* good looking design
* nosql database should be implemented
Valid Options are: ['1','2','3','4','5','6','8','10','12','16']
Answer: {"estimation": "16"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title:
13 changes: 13 additions & 0 deletions ai/resource/prompts/prompt_estimation_number.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: filter numbers out of the input field
Description: The existing Backend Service should filter numbers out of the input, since the system crashes with numbers.
Valid Options are: ['1','2','3','4','5','6','7','8','9','10']
Answer: {"estimation": "2"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: Create a webapp like amazon
Description: Our Company should have a web application like amazon, but better
## Acceptance Criteria:
* robust and fast backend with java
* good looking design
* nosql database should be implemented
Valid Options are: ['1','2','3','4','5','6','7','8','9','10']
Answer: {"estimation": "10"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title:
13 changes: 13 additions & 0 deletions ai/resource/prompts/prompt_estimation_shirt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: filter numbers out of the input field
Description: The existing Backend Service should filter numbers out of the input, since the system crashes with numbers.
Valid Options are: ['XS','S','M','L','XL']
Answer: {"estimation": "S"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title: Create a webapp like amazon
Description: Our Company should have a web application like amazon, but better
## Acceptance Criteria:
* robust and fast backend with java
* good looking design
* nosql database should be implemented
Valid Options are: ['XS','S','M','L','XL']
Answer: {"estimation": "XL"}
Task: Send a JSON with "estimation" and estimate the effort for this user story: Title:
11 changes: 11 additions & 0 deletions ai/resource/prompts/prompt_grammar_check.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Task: Send a JSON with "description" & "acceptance_criteria" and fix grammar & syntax mistakes, but do not add new elements, for this markdown-text: As a user i want 2 be able to accessed a homepage so that I can easily navigate to different sections of the website.
##### Acceptance Criteria:
* The homepage should have a visualy appealing design.
* The homepage should have an clear and concise navigation menü
Solution: {"description" : "As a user, I want to be able to access a homepage so that I can easily navigate to different sections of the website.
##### Acceptance Criteria:\n ",
"acceptance_criteria" : ["* The homepage should have a visually appealing design.","* The homepage should have a clear and concise navigation menu."]}
Task: Send a JSON with "description" & "acceptance_criteria" and fix grammar & syntax mistakes, but do not add new elements, for this markdown-text: As a devloper, i want to crete a backend servize with a REST API so dhat i can easily manage and manipulate dayta from the database
Solution: {"description" : "As a developer, I want to create a backend service with a REST API so that I can easily manage and manipulate data from the database.",
"acceptance_criteria" : []}
Task: Send a JSON with "description" & "acceptance_criteria" and fix grammar & syntax mistakes, but do not add new elements, for this markdown-text:
18 changes: 18 additions & 0 deletions ai/resource/prompts/prompt_improve_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Task: Send JSON with "description" & "acceptance_criteria" for this User Story: create rest service for backend
Solution: {"description" : "As a developer, I want to create a REST service for the backend so that I can easily access and manipulate data from the database.",
"acceptance_criteria" : ["
"The REST service should have endpoints for GET, POST, PUT & DELETE requests",
"Unit Tests should be written"]}
Task: Send JSON with "description" & "acceptance_criteria" for this User Story: create Homepage
Solution: {"description" : "As a user, I want to be able to access a homepage so that I can easily navigate to different sections of the website.",
"acceptance_criteria" : ["The homepage should have a visually appealing design.", "The homepage should have a clear and concise navigation menu.", "It should have a search bar for easy navigation.","The homepage should be accessible on different devices."]}
Task: Send JSON with "description" & "acceptance_criteria" for this User Story: create a homepage for placerholder-company-1 with a java backend. It should not cost more than 100 thousand euros
### Acceptance Criteria:
* good looking design
* logo of placerholder-company-1 should be on the navbar
Solution: {"description" : "As a developer, I want to create a visually appealing homepage for placerholder-company-1. The website should have a modern design and incorporate a Java backend.",
"acceptance_criteria" : [
"The homepage should have an aesthetically pleasing layout.",
"Use responsive design principles to ensure it looks great on various devices",
"The placerholder-company-1 logo must be prominently displayed on the navigation bar"]}
Task: Send JSON with "description" & "acceptance_criteria" for this User Story (at least 6 acceptance criteria):
10 changes: 10 additions & 0 deletions ai/resource/prompts/prompt_improve_description_german.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Aufgabe: Sende ein JSON mit "description" & "acceptance_criteria" für diese User Story: Erstelle einen REST Service für das Backend
Antwort: {"description": "Als Entwickler im Backend-Team möchte ich einen RESTful Service erstellen, um die Kommunikation zwischen dem Frontend und dem Backend zu ermöglichen.",
"acceptance_criteria": ["Die Anfragen können GET, POST, PUT oder DELETE sein.","Der Service muss sicherstellen, dass nur autorisierte Benutzer auf die Endpunkte zugreifen können.","Der Service sollte die eingehenden Anfragen validieren, um sicherzustellen, dass sie den erwarteten Parametern und Formaten entsprechen."]}
Aufgabe: Sende ein JSON mit "description" & "acceptance_criteria" für diese User Story: Erstelle eine Homepage für placeholder-company-1 mit einem java Backend. Es sollte nicht mehr als 100 tausend Euro kosten
## Akzeptanz Kriterien
* gut aussehende Webseite
* Das Logo von placeholder-company-1 sollte auf der Navigationsleiste zu sehen sein
Antwort: {"description" : "Als Entwickler möchte ich eine professionelle Homepage, mit einem Java-Backend für placeholder-company-1 erstellen, um eine benutzerfreundliche Plattform zu schaffen, die das Unternehmen online repräsentiert.",
"acceptance_criteria" : ["Die Kosten für die Erstellung der Homepage dürfen 100.000 Euro nicht überschreiten","Das Java-Backend muss robust und sicher sein, um die Funktionalität der Website zu unterstützen.", "Die Website sollte eine klare Navigation haben, um Benutzern das Auffinden von Informationen zu erleichtern"]}
Aufgabe: Sende ein JSON mit "description" & "acceptance_criteria" für diese User Story (mindestens 6 Akzeptanz Kriterien):
23 changes: 23 additions & 0 deletions ai/resource/prompts/prompt_mark_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Task: Send JSON with "description" for this User Story and mark all important content: As a backend developer, I want to create a reliable and scalable RESTful API service, so that our application can efficiently handle client requests and data processing.
##### Acceptance Criteria:
* The API service should support common HTTP methods (GET, POST, PUT, DELETE) for CRUD operations.
* The service should implement proper error handling and return appropriate HTTP status codes.
* Authentication and authorization mechanisms should be implemented to secure the API endpoints
Solution: {"description" : "As a *backend developer*, I want to create a **reliable and scalable RESTful API service**, so that our application can efficiently handle client requests and data processing.
##### Acceptance Criteria:
* The API service should **support** common HTTP methods (GET, POST, PUT, DELETE) for **CRUD operations**.
* The service should **implement proper error handling** and return **appropriate HTTP status codes**.
* **Authentication and authorization mechanisms** should be implemented to secure the API endpoints" }
Task: Send JSON with "description" for this User Story and mark all important content: As a web developer, I want to create an engaging and informative homepage for our website, so that visitors can easily understand our product or service offerings.
Solution: {"description" : "As a *web developer*, I want to create an **engaging and informative homepage** for our website, so that visitors can easily understand our product or service offerings."}
Task: Send JSON with "description" for this User Story and mark all important content: As a web developer, I want to create a homepage for Placeholder Company 1 with a Java backend, while ensuring that the total cost does not exceed 100,000 euros.
##### Acceptance Criteria:
* The homepage should be built using Java for the backend and a modern frontend framework (e.g., React, Angular, Vue.js).
* The homepage should accurately represent Placeholder Company 1's brand, products, and services.
* The total cost of development, including labor, hosting, and any third-party tools or services, must not exceed 100,000 euros
Solution: {"description" : "As a *web developer*, I want to create a **homepage for Placeholder Company 1 with a Java backend**, while ensuring that the total cost does not exceed **100,000 euros**.
##### Acceptance Criteria:
* The homepage should be **built using Java** for the backend and a modern frontend framework (e.g., React, Angular, Vue.js).
* The homepage should **accurately represent** Placeholder Company 1's brand, products, and services.
* The total cost of development, including **labor, hosting, and any third-party tools or services**, must not exceed **100,000 euros**"}
Task: Send JSON with "description" for this User Story and mark all important content:
Loading
Loading