diff --git a/Backend/__pycache__/sign_in_handler.cpython-312.pyc b/Backend/__pycache__/sign_in_handler.cpython-312.pyc index ecba0f1..3f3eef5 100644 Binary files a/Backend/__pycache__/sign_in_handler.cpython-312.pyc and b/Backend/__pycache__/sign_in_handler.cpython-312.pyc differ diff --git a/Backend/__pycache__/sign_up_handler.cpython-312.pyc b/Backend/__pycache__/sign_up_handler.cpython-312.pyc index df6daaf..4d0cbcb 100644 Binary files a/Backend/__pycache__/sign_up_handler.cpython-312.pyc and b/Backend/__pycache__/sign_up_handler.cpython-312.pyc differ diff --git a/Backend/main.py b/Backend/main.py index d0d9657..d8b5b98 100644 --- a/Backend/main.py +++ b/Backend/main.py @@ -158,9 +158,11 @@ async def analyze_image_or_question( logging.debug(f"Final stripped answer: {answer}") + plant_name = extract_plant_name(answer) + return { "answer": answer, - "plant_name": "Dummy Example" + "plant_name": plant_name } except Exception as e: @@ -241,4 +243,52 @@ def extract_plant_name(answer: str) -> str: # Run the app (for development / debugging only) if __name__ == "__main__": import uvicorn - uvicorn.run(app, host="0.0.0.0", port=8000) \ No newline at end of file + uvicorn.run(app, host="0.0.0.0", port=8000) + +@app.post("/check_plant_name") +async def check_plant_name(request: PlantNameRequest): + """ + Check if the recognized plant name exists in the known plants list. + """ + known_plants = [ + "Aloe vera", + "Basil", + "Boston fern", + "Calathea", + "Cactus", + "Chili Plant", + "Citrus Plant", + "Dumb Cane (Dieffenbachia)", + "Dragon Tree (Dracaena)", + "Elephant Ear", + "Fern", + "Flamingo Flower", + "Maple", + "Mint", + "Monstera", + "Oak", + "Orchid", + "Parsley", + "Peace Lily", + "Philodendron", + "Pothos", + "Rosemary", + "Rose", + "Snake Plant (Sansevieria)", + "Spider Plant", + "Succulent", + "Sunflower", + "Tomato Plant", + "Tulip", + "Weeping Fig (Ficus Benjamina)", + "ZZ Plant (Zamioculcas Zamiifolia)" + ] + + # Check if the plant name is in the known plants list (case-insensitive) + plant_name = request.plant_name.strip().lower() + + for known_plant in known_plants: + if plant_name == known_plant.lower(): + return {"plant_name": known_plant} + + return {"plant_name": "Unknown Plant"} \ No newline at end of file diff --git a/Backend/users.json b/Backend/users.json index 3e98f43..2a3df4b 100644 --- a/Backend/users.json +++ b/Backend/users.json @@ -38,5 +38,10 @@ "username": "Klemens", "email": "klemens@mustermann.de", "password": "$argon2id$v=19$m=65536,t=3,p=4$MjpB+q+Dux8q4geeYnmBLw$XFAdo4Re3hISCIpyl/EbeKiZWzxZBafT2AnP7I1rH14" + }, + { + "username": "Ben", + "email": "ben@mustermann.de", + "password": "$argon2id$v=19$m=65536,t=3,p=4$wtfYMnaSCMhsBqWvnynMzQ$FchOvoK3AGCqlyVoq/naE4DPVNEXg9T2FVY7hQYwHPg" } ] \ No newline at end of file diff --git a/Frontend/theme/app-calender.html b/Frontend/theme/app-calender.html index e84c3c5..bf65434 100644 --- a/Frontend/theme/app-calender.html +++ b/Frontend/theme/app-calender.html @@ -259,5 +259,61 @@ + + \ No newline at end of file diff --git a/Frontend/theme/dashboard.html b/Frontend/theme/dashboard.html index 0dc369f..254b4d8 100644 --- a/Frontend/theme/dashboard.html +++ b/Frontend/theme/dashboard.html @@ -148,212 +148,167 @@ ***********************************--> -
-
-
-
-
-
-

Plants Identified

-
-

15

-
- -
+ Content body start +***********************************--> +
+
+
+
+
+
+

Plants Identified

+
+

15

+
-
-
-
-

Health Assessments

-
-

9

-
- -
+
+
+
+
+
+

Health Assessments

+
+

9

+
-
-
-
-

Plants Watered

-
-

1,245

-
- -
+
+
+
+
+
+

Plants Watered

+
+

1,245

+
-
-
-
-

Tasks Fulfilled

-
-

88%

-
- -
+
+
+
+
+
+

Tasks Fulfilled

+
+

88%

+
- - -
-
-
-
-
-
-
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
- -
+
+
+ + +
+
+
+
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
- -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name/DescriptionPlant IdentifiedRoomHealth StatusLast Watered
Monstera #1MonsteraLiving Room -
-
-
-
-
-
- 2 days ago -
Fiddle Leaf Fig - Corner PlantFiddle Leaf FigBedroom -
-
-
-
-
-
- 5 days ago -
Snake Plant - Office DeskSnake PlantOffice -
-
-
-
-
-
- 1 week ago -
Peace Lily - Kitchen CounterPeace LilyKitchen -
-
-
-
-
-
- 1 day ago -
Succulent - Bathroom ShelfSucculentBathroom -
-
-
-
-
-
- 3 days ago -
Spider Plant - Hanging BasketSpider PlantLiving Room -
-
-
-
-
-
- 4 days ago -
-
-
+
+
+ + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name/DescriptionPlant IdentifiedRoomHealth StatusLast WateredActions
Monstera #1MonsteraLiving RoomHealthy2 days ago
Fiddle Leaf Fig - Corner PlantFiddle Leaf FigBedroomModerate5 days ago
Snake Plant - Office DeskSnake PlantOfficeUnhealthy1 week ago
Peace Lily - Kitchen CounterPeace LilyKitchenHealthy1 day ago
Succulent - Bathroom ShelfSucculentBathroomHealthy3 days ago
Spider Plant - Hanging BasketSpider PlantLiving RoomModerate4 days ago
-
+
-
- - +
+
+
+
+
+
Forgot your password?

Don't Have an account? SIGN UP

@@ -85,14 +86,21 @@

Sign in to To Your Account

document.getElementById('signinForm').addEventListener('submit', function(event) { event.preventDefault(); - const email = document.getElementById('signinEmail').value; - const password = document.getElementById('signinPassword').value; + const email = document.getElementById('signinEmail'); + const password = document.getElementById('signinPassword'); const userData = { - email: email, - password: password + email: email.value, + password: password.value }; - + + // Clear any previous error messages + email.style.borderColor = ''; + password.style.borderColor = ''; + const errorMessage = document.getElementById('formMessage'); + errorMessage.textContent = ''; + errorMessage.style.color = ''; // Reset color + // Send the user data to the sign-in handler fetch('http://localhost:8080/signin', { method: 'POST', @@ -107,13 +115,20 @@

Sign in to To Your Account

alert('Login successful!'); window.location.href = 'dashboard.html'; // Redirect to dashboard } else { - alert('Error: ' + data.message); + // Display error in the input boxes + errorMessage.textContent = data.message; + errorMessage.style.color = 'red'; + + // Highlight the email and password fields with a red border + email.style.borderColor = 'red'; + password.style.borderColor = 'red'; } }) .catch(error => { alert('Error: ' + error.message); }); }); - + + \ No newline at end of file