tomwatto09 commited on
Commit
b64c4e9
·
verified ·
1 Parent(s): 823c814

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +191 -0
index.html ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <title>UniSolve - Academic Assistant</title>
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
8
+ <style>
9
+ body {
10
+ margin: 0;
11
+ font-family: Arial, sans-serif;
12
+ background-color: #f5faff;
13
+ color: #002f5f;
14
+ }
15
+ header {
16
+ display: flex;
17
+ align-items: center;
18
+ padding: 1rem 2rem;
19
+ background-color: #e0f0ff;
20
+ border-bottom: 1px solid #cce4ff;
21
+ }
22
+ header img {
23
+ height: 60px;
24
+ margin-right: 1rem;
25
+ }
26
+ header h1 {
27
+ font-size: 2rem;
28
+ margin: 0;
29
+ }
30
+ main {
31
+ padding: 2rem;
32
+ max-width: 900px;
33
+ margin: auto;
34
+ }
35
+ textarea, select {
36
+ width: 100%;
37
+ padding: 1rem;
38
+ margin-top: 0.5rem;
39
+ margin-bottom: 1.5rem;
40
+ border: 1px solid #c2defc;
41
+ border-radius: 10px;
42
+ font-size: 1rem;
43
+ background-color: #ffffff;
44
+ color: #002244;
45
+ box-shadow: 0 1px 3px rgba(0, 92, 192, 0.1);
46
+ }
47
+ button {
48
+ background-color: #0066cc;
49
+ color: white;
50
+ padding: 0.9rem 1.5rem;
51
+ font-size: 1rem;
52
+ border: none;
53
+ border-radius: 8px;
54
+ cursor: pointer;
55
+ margin-right: 10px;
56
+ box-shadow: 0 2px 5px rgba(0, 92, 192, 0.2);
57
+ transition: background-color 0.3s ease;
58
+ }
59
+ button:hover {
60
+ background-color: #004e99;
61
+ }
62
+ label {
63
+ font-weight: bold;
64
+ display: block;
65
+ margin-top: 1rem;
66
+ color: #004080;
67
+ }
68
+ #outputBox {
69
+ white-space: pre-wrap;
70
+ margin-top: 2rem;
71
+ padding: 1.5rem;
72
+ background-color: #ffffff;
73
+ border: 1px solid #cce4ff;
74
+ border-radius: 10px;
75
+ box-shadow: 0 1px 4px rgba(0, 92, 192, 0.1);
76
+ color: #002244;
77
+ }
78
+ #loading {
79
+ margin-top: 1.5rem;
80
+ font-style: italic;
81
+ color: #0057a3;
82
+ animation: blink 1.2s infinite;
83
+ }
84
+ @keyframes blink {
85
+ 0% {opacity: 1;}
86
+ 50% {opacity: 0.3;}
87
+ 100% {opacity: 1;}
88
+ }
89
+ </style>
90
+ </head>
91
+ <body>
92
+ <header>
93
+ <img src="UniSolve-Emblem.PNG" alt="UniSolve Logo" />
94
+ <h1>UniSolve</h1>
95
+ </header>
96
+ <main>
97
+ <label for="category">Subject Category</label>
98
+ <select id="category">
99
+ <option>Arts, Humanities & Social Sciences</option>
100
+ <option>Law & Legal Studies</option>
101
+ <option>Business & Management</option>
102
+ <option>Psychology & Health Sciences</option>
103
+ <option>Media, Communication & Creative Arts</option>
104
+ <option>Education & Teaching</option>
105
+ <option>Indigenous & Global Studies</option>
106
+ <option>Social Work & Human Services</option>
107
+ <option>Criminology, Justice & Law Enforcement</option>
108
+ <option>Science & Technology</option>
109
+ </select>
110
+
111
+ <label for="citationStyle">Citation Style</label>
112
+ <select id="citationStyle">
113
+ <option>Harvard</option>
114
+ <option>APA 7th</option>
115
+ <option>AGLC</option>
116
+ <option>Chicago A (footnote)</option>
117
+ <option>Chicago B (author-date)</option>
118
+ <option>IEEE</option>
119
+ <option>MLA</option>
120
+ <option>AMA (Vancouver)</option>
121
+ </select>
122
+
123
+ <label for="caseStudy">Case Study</label>
124
+ <textarea id="caseStudy" rows="6" placeholder="Paste your case study here..."></textarea>
125
+
126
+ <label for="questions">Questions</label>
127
+ <textarea id="questions" rows="6" placeholder="Paste your assignment questions here..."></textarea>
128
+
129
+ <button onclick="generateResponse()">Generate Response</button>
130
+ <button onclick="downloadPDF()" id="pdfButton" style="display:none;">Download PDF</button>
131
+
132
+ <div id="loading"></div>
133
+ <div id="outputBox"></div>
134
+ </main>
135
+
136
+ <script>
137
+ async function generateResponse() {
138
+ const subject = document.getElementById("category").value;
139
+ const style = document.getElementById("citationStyle").value;
140
+ const caseStudy = document.getElementById("caseStudy").value;
141
+ const questions = document.getElementById("questions").value;
142
+ const button = document.querySelector("button");
143
+ const output = document.getElementById("outputBox");
144
+ const loading = document.getElementById("loading");
145
+ const pdfButton = document.getElementById("pdfButton");
146
+
147
+ // Clear previous content
148
+ output.innerText = "";
149
+ loading.innerText = "⏳ Generating your answer, please wait...";
150
+
151
+ button.disabled = true;
152
+
153
+ try {
154
+ const response = await fetch("/generate", {
155
+ method: "POST",
156
+ headers: { "Content-Type": "application/json" },
157
+ body: JSON.stringify({
158
+ case_study: caseStudy,
159
+ questions: questions,
160
+ category: subject,
161
+ citation: style
162
+ })
163
+ });
164
+
165
+ const result = await response.json();
166
+
167
+ if (result.answer) {
168
+ output.innerText = result.answer;
169
+ pdfButton.style.display = "inline-block";
170
+ } else {
171
+ output.innerText = `⚠️ Error: ${result.error}`;
172
+ }
173
+ } catch (err) {
174
+ output.innerText = `❌ Network error: ${err.message}`;
175
+ }
176
+
177
+ loading.innerText = "";
178
+ button.disabled = false;
179
+ }
180
+
181
+ function downloadPDF() {
182
+ const { jsPDF } = window.jspdf;
183
+ const doc = new jsPDF();
184
+ const content = document.getElementById("outputBox").innerText;
185
+ const lines = doc.splitTextToSize(content, 180);
186
+ doc.text(lines, 10, 20);
187
+ doc.save("unisolv_response.pdf");
188
+ }
189
+ </script>
190
+ </body>
191
+ </html>