Advay-Singh commited on
Commit
5c64755
·
verified ·
1 Parent(s): f39f001

Update templates/write.html

Browse files
Files changed (1) hide show
  1. templates/write.html +115 -115
templates/write.html CHANGED
@@ -1,116 +1,116 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Write | TaskBot v1+ AI</title>
8
- <link rel="Icon" href="TaskBot logo.png">
9
- </link>
10
- </head>
11
- <style>
12
- body {
13
- background-color: #2f2f2f;
14
- font-family: Arial, sans-serif;
15
- color: white;
16
- margin: 0;
17
- padding: 20px;
18
- }
19
-
20
- h1 {
21
- text-align: center;
22
- }
23
-
24
- #topic {
25
- width: 100%;
26
- border-radius: 50px;
27
- background-color: white;
28
- color: black;
29
- height: 40px;
30
- font-size: large;
31
- }
32
-
33
- select {
34
- border-radius: 50px;
35
- }
36
-
37
- input {
38
- border-radius: 50px;
39
- }
40
-
41
- textarea {
42
- height: 300px;
43
- width: 100%;
44
- }
45
-
46
- button {
47
- width: 100px;
48
- height: 50px;
49
- text-align: center;
50
- float: right;
51
- }
52
-
53
- small {
54
- color: gray;
55
- display: block;
56
- text-align: center;
57
- }
58
- </style>
59
-
60
- <body>
61
- <h1>Write Mate</h1>
62
- <small>Powered by gemini-2.0-flash</small>
63
-
64
- <lable for="topic">Topic:</lable>
65
- <input type="text" id="topic"><br><br><br>
66
-
67
- <label for="fruits">Type: </label>
68
- <select id="type" name="type">
69
- <option value="para">Paragraph</option>
70
- <option value="essay">Essay</option>
71
- <option value="speech">Speech</option>
72
- </select><br><br><br>
73
-
74
- <label for="word-limit">Word Limit: </label>
75
- <input type="number" id="word-limit"><br><br><br>
76
-
77
- <button onclick=answer() id="answer_button">Start Writing</button><br><br>
78
-
79
- <textarea name="answer" id="answer" placeholder="Your answer will be displayed here..."></textarea>
80
-
81
- <script>
82
- async function answer() {
83
- document.getElementById("answer_button").disabled = true
84
- const userInput = document.getElementById('topic').value;
85
- if (userInput.trim() === '') return;
86
-
87
- const word_limit = document.getElementById("word-limit").value;
88
- const type = document.getElementById("type").value;
89
-
90
- try {
91
- const response = await fetch("/write", {
92
- method: "POST",
93
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
94
- body: new URLSearchParams({ question: userInput, word_limit: word_limit, type: type })
95
- });
96
-
97
- const data = await response.json();
98
- console.log("Server Response:", data); // DEBUG LINE
99
-
100
- const answer_area = document.getElementById("answer");
101
- if (data.answer) {
102
- answer_area.value = data.answer; // set textarea value
103
- } else if (data.error) {
104
- answer_area.value = "Error: " + data.error;
105
- }
106
- } catch (err) {
107
- console.error("Fetch Error:", err);
108
- document.getElementById("answer").value = err;
109
- }
110
- document.getElementById("answer_button").disabled = false
111
- }
112
-
113
- </script>
114
- </body>
115
-
116
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Write | TaskBot AI</title>
8
+ <link rel="Icon" href="TaskBot logo.png">
9
+ </link>
10
+ </head>
11
+ <style>
12
+ body {
13
+ background-color: #2f2f2f;
14
+ font-family: Arial, sans-serif;
15
+ color: white;
16
+ margin: 0;
17
+ padding: 20px;
18
+ }
19
+
20
+ h1 {
21
+ text-align: center;
22
+ }
23
+
24
+ #topic {
25
+ width: 100%;
26
+ border-radius: 50px;
27
+ background-color: white;
28
+ color: black;
29
+ height: 40px;
30
+ font-size: large;
31
+ }
32
+
33
+ select {
34
+ border-radius: 50px;
35
+ }
36
+
37
+ input {
38
+ border-radius: 50px;
39
+ }
40
+
41
+ textarea {
42
+ height: 300px;
43
+ width: 100%;
44
+ }
45
+
46
+ button {
47
+ width: 100px;
48
+ height: 50px;
49
+ text-align: center;
50
+ float: right;
51
+ }
52
+
53
+ small {
54
+ color: gray;
55
+ display: block;
56
+ text-align: center;
57
+ }
58
+ </style>
59
+
60
+ <body>
61
+ <h1>Write Mate</h1>
62
+ <small>Powered by gemini-2.0-flash</small>
63
+
64
+ <lable for="topic">Topic:</lable>
65
+ <input type="text" id="topic"><br><br><br>
66
+
67
+ <label for="fruits">Type: </label>
68
+ <select id="type" name="type">
69
+ <option value="para">Paragraph</option>
70
+ <option value="essay">Essay</option>
71
+ <option value="speech">Speech</option>
72
+ </select><br><br><br>
73
+
74
+ <label for="word-limit">Word Limit: </label>
75
+ <input type="number" id="word-limit"><br><br><br>
76
+
77
+ <button onclick=answer() id="answer_button">Start Writing</button><br><br>
78
+
79
+ <textarea name="answer" id="answer" placeholder="Your answer will be displayed here..."></textarea>
80
+
81
+ <script>
82
+ async function answer() {
83
+ document.getElementById("answer_button").disabled = true
84
+ const userInput = document.getElementById('topic').value;
85
+ if (userInput.trim() === '') return;
86
+
87
+ const word_limit = document.getElementById("word-limit").value;
88
+ const type = document.getElementById("type").value;
89
+
90
+ try {
91
+ const response = await fetch("/write", {
92
+ method: "POST",
93
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
94
+ body: new URLSearchParams({ question: userInput, word_limit: word_limit, type: type })
95
+ });
96
+
97
+ const data = await response.json();
98
+ console.log("Server Response:", data); // DEBUG LINE
99
+
100
+ const answer_area = document.getElementById("answer");
101
+ if (data.answer) {
102
+ answer_area.value = data.answer; // set textarea value
103
+ } else if (data.error) {
104
+ answer_area.value = "Error: " + data.error;
105
+ }
106
+ } catch (err) {
107
+ console.error("Fetch Error:", err);
108
+ document.getElementById("answer").value = err;
109
+ }
110
+ document.getElementById("answer_button").disabled = false
111
+ }
112
+
113
+ </script>
114
+ </body>
115
+
116
  </html>