Spaces:
Running
Running
Update log.html
Browse files
log.html
CHANGED
|
@@ -23,10 +23,6 @@ body {
|
|
| 23 |
border: 1px solid #10b981;
|
| 24 |
box-shadow: 0 20px 30px rgba(0,0,0,0.08);
|
| 25 |
}
|
| 26 |
-
|
| 27 |
-
.active-match {
|
| 28 |
-
border: 2px solid #10b981 !important;
|
| 29 |
-
}
|
| 30 |
</style>
|
| 31 |
</head>
|
| 32 |
|
|
@@ -52,9 +48,10 @@ body {
|
|
| 52 |
</p>
|
| 53 |
</section>
|
| 54 |
|
| 55 |
-
<!--
|
| 56 |
<section class="px-10 space-y-8">
|
| 57 |
|
|
|
|
| 58 |
<div class="card bg-white p-8 rounded-xl">
|
| 59 |
|
| 60 |
<h2 class="text-2xl font-bold mb-6">Food Details</h2>
|
|
@@ -80,7 +77,7 @@ body {
|
|
| 80 |
|
| 81 |
</div>
|
| 82 |
|
| 83 |
-
<!-- AI
|
| 84 |
<div class="card bg-white p-8 rounded-xl">
|
| 85 |
|
| 86 |
<h2 class="text-2xl font-bold">AI Recommendation</h2>
|
|
@@ -89,7 +86,6 @@ body {
|
|
| 89 |
Click “Ask AI” to get recommendation...
|
| 90 |
</p>
|
| 91 |
|
| 92 |
-
<!-- 🔥 NEW BUTTON -->
|
| 93 |
<button onclick="runAI()"
|
| 94 |
class="mt-5 bg-emerald-600 text-white px-6 py-2 rounded-full">
|
| 95 |
Ask AI
|
|
@@ -97,12 +93,41 @@ body {
|
|
| 97 |
|
| 98 |
</div>
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
</section>
|
| 101 |
|
| 102 |
<!-- SCRIPT -->
|
| 103 |
<script>
|
| 104 |
|
| 105 |
-
//
|
| 106 |
const portions = document.getElementById("portions");
|
| 107 |
const portionValue = document.getElementById("portionValue");
|
| 108 |
|
|
@@ -110,7 +135,7 @@ portions.addEventListener("input", () => {
|
|
| 110 |
portionValue.innerText = portions.value;
|
| 111 |
});
|
| 112 |
|
| 113 |
-
// 🔥 GROQ
|
| 114 |
async function runAI() {
|
| 115 |
|
| 116 |
const meals = document.getElementById("portions").value;
|
|
@@ -121,28 +146,20 @@ async function runAI() {
|
|
| 121 |
|
| 122 |
const distance = 5;
|
| 123 |
|
| 124 |
-
const prompt = `
|
| 125 |
-
You are NourishNet AI
|
| 126 |
|
| 127 |
-
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
- Think like a logistics coordinator
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
- Food type: ${foodType}
|
| 140 |
-
|
| 141 |
-
Output format:
|
| 142 |
-
|
| 143 |
-
Priority: HIGH / MEDIUM / LOW
|
| 144 |
-
Reason: (2-3 lines, explain logic clearly)
|
| 145 |
-
Action: (specific next step, where to send food)
|
| 146 |
`;
|
| 147 |
|
| 148 |
try {
|
|
@@ -161,14 +178,13 @@ Action: (specific next step, where to send food)
|
|
| 161 |
});
|
| 162 |
|
| 163 |
const data = await response.json();
|
| 164 |
-
|
| 165 |
const result = data.choices[0].message.content;
|
| 166 |
|
| 167 |
document.getElementById("aiText").innerText = result;
|
| 168 |
|
| 169 |
-
} catch (
|
| 170 |
document.getElementById("aiText").innerText =
|
| 171 |
-
"AI failed. Check API key or internet
|
| 172 |
}
|
| 173 |
}
|
| 174 |
|
|
|
|
| 23 |
border: 1px solid #10b981;
|
| 24 |
box-shadow: 0 20px 30px rgba(0,0,0,0.08);
|
| 25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
</style>
|
| 27 |
</head>
|
| 28 |
|
|
|
|
| 48 |
</p>
|
| 49 |
</section>
|
| 50 |
|
| 51 |
+
<!-- MAIN -->
|
| 52 |
<section class="px-10 space-y-8">
|
| 53 |
|
| 54 |
+
<!-- INPUT CARD -->
|
| 55 |
<div class="card bg-white p-8 rounded-xl">
|
| 56 |
|
| 57 |
<h2 class="text-2xl font-bold mb-6">Food Details</h2>
|
|
|
|
| 77 |
|
| 78 |
</div>
|
| 79 |
|
| 80 |
+
<!-- AI CARD -->
|
| 81 |
<div class="card bg-white p-8 rounded-xl">
|
| 82 |
|
| 83 |
<h2 class="text-2xl font-bold">AI Recommendation</h2>
|
|
|
|
| 86 |
Click “Ask AI” to get recommendation...
|
| 87 |
</p>
|
| 88 |
|
|
|
|
| 89 |
<button onclick="runAI()"
|
| 90 |
class="mt-5 bg-emerald-600 text-white px-6 py-2 rounded-full">
|
| 91 |
Ask AI
|
|
|
|
| 93 |
|
| 94 |
</div>
|
| 95 |
|
| 96 |
+
<!-- MAP SECTION -->
|
| 97 |
+
<div class="card bg-white p-8 rounded-xl">
|
| 98 |
+
|
| 99 |
+
<h2 class="text-2xl font-bold mb-4">Delivery Route Map</h2>
|
| 100 |
+
|
| 101 |
+
<p class="text-gray-600 mb-4">
|
| 102 |
+
Visual representation of donation flow across UAE
|
| 103 |
+
</p>
|
| 104 |
+
|
| 105 |
+
<!-- MAP (NO API KEY NEEDED) -->
|
| 106 |
+
<div class="rounded-xl overflow-hidden border">
|
| 107 |
+
<iframe
|
| 108 |
+
src="https://www.google.com/maps?q=Dubai+UAE&output=embed"
|
| 109 |
+
width="100%"
|
| 110 |
+
height="350"
|
| 111 |
+
style="border:0;"
|
| 112 |
+
loading="lazy">
|
| 113 |
+
</iframe>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<!-- INFO -->
|
| 117 |
+
<div class="flex justify-between mt-4 text-sm text-gray-600">
|
| 118 |
+
<p>📍 Restaurant</p>
|
| 119 |
+
<p>➡️ 5 km</p>
|
| 120 |
+
<p>📍 Recipient Center</p>
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
</section>
|
| 126 |
|
| 127 |
<!-- SCRIPT -->
|
| 128 |
<script>
|
| 129 |
|
| 130 |
+
// slider UI
|
| 131 |
const portions = document.getElementById("portions");
|
| 132 |
const portionValue = document.getElementById("portionValue");
|
| 133 |
|
|
|
|
| 135 |
portionValue.innerText = portions.value;
|
| 136 |
});
|
| 137 |
|
| 138 |
+
// 🔥 GROQ AI FUNCTION
|
| 139 |
async function runAI() {
|
| 140 |
|
| 141 |
const meals = document.getElementById("portions").value;
|
|
|
|
| 146 |
|
| 147 |
const distance = 5;
|
| 148 |
|
| 149 |
+
const prompt = `
|
| 150 |
+
You are NourishNet AI for food redistribution.
|
| 151 |
|
| 152 |
+
Analyze:
|
| 153 |
|
| 154 |
+
Meals: ${meals}
|
| 155 |
+
Hours left: ${hours}
|
| 156 |
+
Distance: ${distance}
|
| 157 |
+
Food type: ${foodType}
|
|
|
|
| 158 |
|
| 159 |
+
Return:
|
| 160 |
+
Priority (HIGH/MEDIUM/LOW)
|
| 161 |
+
Reason (2 lines)
|
| 162 |
+
Action (clear next step)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
`;
|
| 164 |
|
| 165 |
try {
|
|
|
|
| 178 |
});
|
| 179 |
|
| 180 |
const data = await response.json();
|
|
|
|
| 181 |
const result = data.choices[0].message.content;
|
| 182 |
|
| 183 |
document.getElementById("aiText").innerText = result;
|
| 184 |
|
| 185 |
+
} catch (err) {
|
| 186 |
document.getElementById("aiText").innerText =
|
| 187 |
+
"AI failed. Check API key or internet.";
|
| 188 |
}
|
| 189 |
}
|
| 190 |
|