Advay-Singh commited on
Commit
23004ee
·
verified ·
1 Parent(s): 31eb682

Upload 14 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ static/Icon-192.png filter=lfs diff=lfs merge=lfs -text
37
+ static/images/black[[:space:]]bg.jpeg filter=lfs diff=lfs merge=lfs -text
38
+ static/images/light[[:space:]]bg.jpeg filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ COPY . .
10
+
11
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]
app.py ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import google.generativeai as generativeai
2
+ from flask import Flask, request, jsonify, render_template, send_file
3
+ from google.genai import types
4
+ from PIL import Image
5
+ from io import BytesIO
6
+ from google import genai
7
+
8
+
9
+ #Connect to index.html
10
+ app = Flask(__name__)
11
+
12
+
13
+ @app.route("/write", methods=["GET", "POST"])
14
+ def write():
15
+ if request.method == "GET":
16
+ return render_template("write.html")
17
+
18
+ if request.method == "POST":
19
+ # Getting data from form
20
+ question = request.form.get("question", "").strip()
21
+ types = request.form.get("type", "").strip()
22
+ word_limit = request.form.get("word_limit", "").strip()
23
+
24
+ print(f"\nRAW FORM DATA -> question: '{question}', type: '{types}', word_limit: '{word_limit}'\n-------------------------------\n")
25
+
26
+ if not question:
27
+ return jsonify({"error": "Please provide a question."}), 400
28
+
29
+ if word_limit:
30
+ try:
31
+ word_limit = float(word_limit)
32
+ except ValueError:
33
+ return jsonify({"error": "Word limit must be a number."}), 400
34
+ else:
35
+ word_limit = None
36
+
37
+ generativeai.configure(api_key="AIzaSyAa4WXqagEm5XgWe2jkpkb7ggYL2HiB8LU")
38
+
39
+ try:
40
+ model = generativeai.GenerativeModel("gemini-2.0-flash")
41
+ prompt = (
42
+ f"You are TaskBot AI created by Advay Singh and powered by Gemini AI. "
43
+ f"Write a {types if types else 'paragraph'} on the topic '{question}'"
44
+ )
45
+ if word_limit:
46
+ prompt += f" nearly about {word_limit} words."
47
+
48
+ response = model.generate_content(prompt)
49
+ print(f"ANSWER BY TASKBOT AI: \n {response.text}")
50
+ return jsonify({"answer": response.text})
51
+
52
+ except Exception as e:
53
+ print(f"Error: {e}")
54
+ return jsonify({"error": "An error occurred while processing your request."}), 500
55
+
56
+ @app.route("/summarize", methods=["GET", "POST"])
57
+ def summarize():
58
+ if request.method == "GET":
59
+ return render_template("summarize.html")
60
+ if request.method == "POST":
61
+ question = request.form.get("question", "").strip()
62
+ types = request.form.get("type")
63
+ minimum_lines_points = request.form.get("num_of_lines_points")
64
+ if not question:
65
+ return jsonify({"error": "Please provide a question."}), 400
66
+
67
+ generativeai.configure(api_key="AIzaSyAa4WXqagEm5XgWe2jkpkb7ggYL2HiB8LU")
68
+
69
+ try:
70
+
71
+ model = generativeai.GenerativeModel('gemini-2.0-flash')
72
+ prompt = (
73
+ f"You are TaskBot AI created by Advay Singh and powered by Gemini AI. "
74
+ f"Write a {types if types else 'paragraph'} on the topic '{question}'")
75
+ if minimum_lines_points:
76
+ prompt += f" nearly about {minimum_lines_points} {types}."
77
+ response = model.generate_content(prompt)
78
+ answer = response.text
79
+
80
+ print(f"Raw Text: \n{question}; Type: {types}; Minimum {types}: {minimum_lines_points}\n------------------------- \n {answer} \n -------------------------")
81
+
82
+ return jsonify({"answer": answer})
83
+ except Exception as e:
84
+ print(f"Error: {e}")
85
+ return jsonify({"error": "An error occurred while processing your request."}), 500
86
+
87
+
88
+ @app.route("/think", methods=["GET", "POST"])
89
+ def think():
90
+ if request.method == "GET":
91
+ return render_template("think.html")
92
+ if request.method == "POST":
93
+
94
+ question = request.form.get("question", "").strip()
95
+ if not question:
96
+ return jsonify({"error": "Please provide a question."}), 400
97
+
98
+ generativeai.configure(api_key="AIzaSyAa4WXqagEm5XgWe2jkpkb7ggYL2HiB8LU")
99
+
100
+ try:
101
+ model = generativeai.GenerativeModel('gemini-2.0-flash-thinking-exp-01-21')
102
+ response = model.generate_content(f"You are TaskBot AI created by Advay Singh and powered by Gemini AI. Remember that and don't say anything (not even ok) about that just answer me this question- {question}.")
103
+ answer = response.text
104
+
105
+
106
+ print(f"Question: {question}\n------------------------- \n {answer} \n -------------------------\n")
107
+
108
+ return jsonify({"answer": answer})
109
+ except Exception as e:
110
+ print(f"Error: {e}")
111
+ return jsonify({"error": "An error occurred while processing your request."}), 500
112
+
113
+
114
+ @app.route("/translate", methods=["GET", "POST"])
115
+ def translate():
116
+ if request.method == "GET":
117
+ return render_template("translate.html")
118
+ if request.method == "POST":
119
+ question = request.form.get("question", "").strip()
120
+ translate_from = request.form.get("translate_from", "").strip()
121
+ translate_to = request.form.get("translate_to", "").strip()
122
+ if not question:
123
+ return jsonify({"error": "Please provide a question."}), 400
124
+
125
+ generativeai.configure(api_key="AIzaSyAa4WXqagEm5XgWe2jkpkb7ggYL2HiB8LU")
126
+
127
+ try:
128
+
129
+ model = generativeai.GenerativeModel('gemini-2.0-flash')
130
+ response = model.generate_content(f"You are TaskBot AI created by Advay Singh and powered by Gemini AI remember this and don't say anything about this unitll asked (not even ok). Just translate {question} from {translate_from} to {translate_to} and nothing else. ")
131
+ answer = response.text
132
+
133
+ print(f"Translate: {question} from {translate_from} to {translate_to}\n------------------------- \n {answer} \n--------------------------")
134
+
135
+ return jsonify({"answer": answer})
136
+ except Exception as e:
137
+ print(f"Error: {e}")
138
+ return jsonify({"error": "An error occurred while processing your request."}), 500
139
+
140
+ @app.route("/imagine", methods=["GET", "POST"])
141
+ def imagine():
142
+ if request.method == "GET":
143
+ return render_template("imagine.html")
144
+ if request.method == "POST":
145
+ contents = request.form.get("contents", "").strip()
146
+ if not contents:
147
+ return jsonify({"error": "Please provide a prompt."}), 400
148
+
149
+ client = genai.Client(api_key="AIzaSyC29gcbTAWKK99f6V9T07bNLz0IefRBKWc")
150
+
151
+ response = client.models.generate_content(
152
+ model="gemini-2.0-flash-preview-image-generation",
153
+ contents=contents,
154
+ config=types.GenerateContentConfig(
155
+ response_modalities=['TEXT', 'IMAGE']
156
+ )
157
+ )
158
+ print(f"\nPROMPT: {contents}\n")
159
+ for part in response.candidates[0].content.parts:
160
+ if part.inline_data is not None:
161
+ image = Image.open(BytesIO(part.inline_data.data))
162
+ img_io = BytesIO()
163
+ image.save(img_io, format="PNG")
164
+ img_io.seek(0)
165
+ return send_file(img_io, mimetype="image/png")
166
+
167
+ return jsonify({"error": "No image returned by model"}), 500
168
+
169
+
170
+ @app.route("/")
171
+ def index():
172
+ return render_template("index.html")
173
+
174
+ @app.route("/ask", methods=["POST"])
175
+ def ask():
176
+ #getting the question from the form55
177
+ question = request.form.get("question", "").strip()
178
+ if not question:
179
+ return jsonify({"error": "Please provide a question."}), 400
180
+
181
+ generativeai.configure(api_key="AIzaSyAa4WXqagEm5XgWe2jkpkb7ggYL2HiB8LU")
182
+
183
+ try:
184
+ # use Google's Gemini-2.0-Flash nodle for generating content
185
+ model = generativeai.GenerativeModel('gemini-2.0-flash')
186
+ response = model.generate_content(f"You are TaskBot AI created by Advay Singh and powered by Gemini AI. Remember that and don't say anything (not even ok) about that just answer me this question- {question}.")
187
+ answer = response.text
188
+
189
+ # Log the question and answer for debugging
190
+ print(f"Question: {question}\n------------------------- \n {answer} \n -------------------------")
191
+ # Return the answer as JSON
192
+ return jsonify({"answer": answer})
193
+ except Exception as e:
194
+ print(f"Error: {e}")
195
+ return jsonify({"error": "An error occurred while processing your request."}), 500
196
+
197
+ if __name__ == '__main__':
198
+
199
+ app.run(host="0.0.0.0", port=7860)
200
+
static/Icon-192.png ADDED

Git LFS Details

  • SHA256: c13e44a9851ebb61da901b8756ac58e59d1380e62141610cb6eed4b73cc69b45
  • Pointer size: 131 Bytes
  • Size of remote file: 277 kB
static/Icon-512.png ADDED
static/images/black bg.jpeg ADDED

Git LFS Details

  • SHA256: 9ea70e9e443413f5d53cf636079e4bc4bf716ef9bac293ad9ea844e542e89a13
  • Pointer size: 131 Bytes
  • Size of remote file: 726 kB
static/images/light bg.jpeg ADDED

Git LFS Details

  • SHA256: 6bbd86e4ea1fe1d2878ebd576dd640511e529e2ccfffa961acdeca9fe372761f
  • Pointer size: 131 Bytes
  • Size of remote file: 525 kB
static/manifest.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "TaskBot AI",
3
+ "short_name": "TaskBot",
4
+ "start_url": "/",
5
+ "display": "standalone",
6
+ "scope": "/",
7
+ "background_color": "#2f2f2f",
8
+ "theme_color": "#2f2f2f",
9
+ "orientation": "portrait",
10
+ "icons": [
11
+ {
12
+ "src": "icon-192.png",
13
+ "sizes": "192x192",
14
+ "type": "image/png"
15
+ },
16
+ {
17
+ "src": "icon-512.png",
18
+ "sizes": "512x512",
19
+ "type": "image/png"
20
+ }
21
+ ]
22
+ }
static/service-worker.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ self.addEventListener("install", (e) => {
2
+ e.waitUntil(
3
+ caches.open("taskbot-cache").then((cache) => {
4
+ return cache.addAll(["/", "/static/style.css", "/static/script.js"]);
5
+ })
6
+ );
7
+ });
8
+
9
+ self.addEventListener("fetch", (e) => {
10
+ e.respondWith(
11
+ caches.match(e.request).then((response) => {
12
+ return response || fetch(e.request);
13
+ })
14
+ );
15
+ });
templates/imagine.html ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Imagine | TaskBot v1+ AI</title>
8
+ </head>
9
+
10
+ <style>
11
+ body {
12
+ background-color: #2f2f2f;
13
+ font-family: Arial, sans-serif;
14
+ color: white;
15
+ margin: 0;
16
+ padding: 20px;
17
+ }
18
+
19
+ input {
20
+ width: 100%;
21
+ height: 26px;
22
+ border-radius: 50px;
23
+ text-align: center;
24
+ justify-content: center;
25
+
26
+ }
27
+
28
+ #image {
29
+ text-align: center;
30
+ border: 1px solid white;
31
+ padding: 10px;
32
+ margin: 20px auto;
33
+ height: 400px;
34
+ width: 400px;
35
+ }
36
+
37
+ #inputWrapper {
38
+ text-align: center;
39
+ margin: 20px auto;
40
+ bottom: 20px;
41
+
42
+ }
43
+
44
+ button {
45
+ background-color: black;
46
+ color: greenyellow;
47
+ height: 50px
48
+ }
49
+
50
+ @media (max-width: 768px) {
51
+ #image {
52
+ width: 300px;
53
+ height: 300px;
54
+ }
55
+
56
+ input {
57
+ width: 80%;
58
+ }
59
+ }
60
+
61
+ small {
62
+ color: gray;
63
+ text-align: center;
64
+ display: block;
65
+ }
66
+
67
+ h1 {
68
+ text-align: center;
69
+ }
70
+
71
+ @keyframes color-change {
72
+ 0% {
73
+ background-color: red;
74
+ }
75
+
76
+ 20% {
77
+ background-color: blue;
78
+ }
79
+
80
+ 40% {
81
+ background-color: rgb(0, 255, 0);
82
+ }
83
+
84
+ 60% {
85
+ background-color: aqua;
86
+ }
87
+
88
+ 80% {
89
+ background-color: yellow;
90
+ }
91
+
92
+ 100% {
93
+ background-color: red;
94
+ }
95
+ }
96
+
97
+ .color_change {
98
+ animation: color-change 4s infinite;
99
+ }
100
+ </style>
101
+
102
+ <div>
103
+ <h1>Image Generator</h1><br>
104
+ <small>Powered by gemini-2.0-flash-preview-image-generation</small><br><br>
105
+ <br>
106
+ <div id="image">
107
+ <img src="" id="generated_image" style="max-width: 400px;" alt="Generated Image"><br><br><br>
108
+ </div>
109
+ <div id="inputWrapper">
110
+ <input type="text" id="contents" placeholder="Enter your prompt..."><br><br><br>
111
+ <button onclick="generate()" id="generate_button">Generate Image</button>
112
+ </div>
113
+ </body>
114
+ <script>
115
+ async function generate() {
116
+ document.getElementById("generate_button").disabled = true
117
+ document.getElementById("image").classList.add("color_change");
118
+ document.getElementById("image").src = "";
119
+ const contents = document.getElementById("contents").value;
120
+ const response = await fetch("/imagine", {
121
+ method: "POST",
122
+ headers: {
123
+ "Content-Type": "application/x-www-form-urlencoded"
124
+ },
125
+ body: new URLSearchParams({ contents })
126
+ });
127
+
128
+ if (response.ok) {
129
+ const blob = await response.blob();
130
+ const imgUrl = URL.createObjectURL(blob);
131
+ document.getElementById("generated_image").src = imgUrl;
132
+ document.getElementById("image").classList.remove("color_change")
133
+ document.getElementById("image").style.border = "none";
134
+ document.getElementById("generate_button").disabled = false
135
+ } else {
136
+ console.error("Error generating image:", response.statusText);
137
+ }
138
+ }
139
+ document.getElementById("contents").addEventListener("keypress", (event) => {
140
+ if (event.key === "Enter") {
141
+ generate()
142
+ }
143
+ })
144
+
145
+ </script>
146
+
147
+ </html>
templates/index.html ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>TaskBot v1+</title>
8
+ <script src="https://kit.fontawesome.com/cda0e70b18.js" crossorigin="anonymous"></script>
9
+ <link rel="Icon" href="TaskBot logo.png">
10
+ <link rel="manifest" href="/static/manifest.json">
11
+ </head>
12
+
13
+ <style>
14
+ body {
15
+ background-color: #2f2f2f;
16
+ font-family: Arial, sans-serif;
17
+ color: white;
18
+ margin: 0;
19
+ padding: 20px;
20
+ background: url("{{ url_for('static', filename='images/black bg.jpeg') }}");
21
+ background-size: cover;
22
+ background-repeat: no-repeat;
23
+ background-size: cover;
24
+ background-attachment: fixed;
25
+ background-position: center center;
26
+ }
27
+ nav {
28
+ background-color: #444;
29
+ padding: 5px;
30
+ border-radius: 5px;
31
+ width: 100%;
32
+ height: auto;
33
+ top: 0;
34
+ }
35
+ .sticky {
36
+ position: absolute;
37
+ top: 20px;
38
+ right: 20px;
39
+ z-index: 1000;
40
+ }
41
+ .sticky2 {
42
+ position: absolute;
43
+ top: 20px;
44
+ right: 80px;
45
+ z-index: 1000;
46
+ }
47
+ .sticky3 {
48
+ position: absolute;
49
+ top: 20px;
50
+ right: 140px;
51
+ z-index: 1000;
52
+ }
53
+ /* Dropdown Styles */
54
+ .dropdown {
55
+ position: relative;
56
+ display: inline-block;
57
+ }
58
+ .btn {
59
+ background-color: transparent;
60
+ color: white;
61
+ border: none;
62
+ cursor: pointer;
63
+ }
64
+ .btn:hover {
65
+ background-color: #494949;
66
+ }
67
+ .dropdown-content {
68
+ display: none;
69
+ position: absolute;
70
+ right: 0;
71
+ background-color: transparent;
72
+ backdrop-filter: blur(5px);
73
+ border: 1px solid black;
74
+ min-width: 160px;
75
+ box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
76
+ z-index: 1;
77
+ text-align: center;
78
+ }
79
+ .dropdown-content h3 {
80
+ margin: 5px 0;
81
+ color: white;
82
+ text-align: center;
83
+ }
84
+ .dropdown-content a {
85
+ color: white;
86
+ padding: 12px 16px;
87
+ text-decoration: none;
88
+ display: block;
89
+ border-top: 1px solid transparent;
90
+ }
91
+ .dropdown-content a:hover {
92
+ background-color: #bebebe;
93
+ }
94
+ .dropdown:hover .dropdown-content {
95
+ display: block;
96
+ }
97
+ main {
98
+ display: flex;
99
+ flex-direction: column;
100
+ align-items: center;
101
+ justify-content: center;
102
+ height: calc(100vh - 100px);
103
+ /* adjust if header height changes */
104
+ text-align: center;
105
+ }
106
+ /* Input and Button Styles */
107
+ #question {
108
+ padding: 10px;
109
+ font-size: 16px;
110
+ border-radius: 5px;
111
+ border: 1px solid #ccc;
112
+ margin-right: 10px;
113
+ }
114
+ .ai,
115
+ .user {
116
+ background-color: transparent;
117
+ backdrop-filter: blur(5px);
118
+ padding: 10px;
119
+ padding-right: 10px;
120
+ border-radius: 5px;
121
+ border: solid #ccc;
122
+ margin: 10px;
123
+ text-align: center;
124
+ justify-content: right;
125
+ width: 40%;
126
+ color: rgb(227, 227, 227)
127
+ }
128
+ .text1 {
129
+ display: flex;
130
+ justify-content: right;
131
+ align-items: center;
132
+ margin: 10px;
133
+ }
134
+ .text2 {
135
+ display: flex;
136
+ justify-content: left;
137
+ align-items: center;
138
+ margin: 10px;
139
+ }
140
+ .chat-input-container {
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ margin-top: 20px;
145
+ }
146
+ #sendButton {
147
+ margin-left: 10px;
148
+ padding: 10px 20px;
149
+ border: none;
150
+ border-radius: 5px;
151
+ background-color: #fff;
152
+ cursor: pointer;
153
+ transition: background-color 0.3s;
154
+ }
155
+ #sendButton:hover {
156
+ background-color: #e0e0e0;
157
+ }
158
+ .inputWrapper {
159
+ flex-direction: column;
160
+ align-items: center;
161
+ justify-content: center;
162
+ position: fixed;
163
+ bottom: 20px;
164
+ left: 50%;
165
+ transform: translateX(-50%);
166
+ display: flex;
167
+ gap: 10px;
168
+ z-index: 1000;
169
+ }
170
+ .inputWrapper input {
171
+ width: 100%;
172
+ padding: 10px;
173
+ }
174
+ .tools button {
175
+ font-size: 18px;
176
+ padding: 10px 20px;
177
+ border-radius: 50px;
178
+ cursor: pointer;
179
+ }
180
+ #welcomeMessage {
181
+ text-align: center;
182
+ margin-top: 20%;
183
+ }
184
+ .tools-content {
185
+ display: none;
186
+ }
187
+ .tools:hover {
188
+ .tools-content {
189
+ display: block
190
+ }
191
+ }
192
+ </style>
193
+
194
+ <body>
195
+
196
+ <H1 id="welcomeMessage">Hello 👋, what can I help with?</H1>
197
+ <div id="chatArea">
198
+ <div class="text1">
199
+ <div class="user" style="display: none;"></div>
200
+ </div>
201
+ <div class="text2">
202
+ <div class="ai" style="display: none;"></div>
203
+ </div>
204
+ </div>
205
+
206
+ <main>
207
+ <div class="inputWrapper">
208
+ <input type="text" id="userInput" placeholder="Type your message here..."
209
+ style="width: 200px;color: white; backdrop-filter: blur(100px);background-color: transparent; border-radius: 50px;border: 1px solid #ccc;margin-right: 10px;margin-left: 10px;">
210
+ <div
211
+ style="display: flex; flex-direction: row; gap: 10px; margin-top: 10px; width: 100%; justify-content: center;">
212
+ <div class="tools">
213
+ <div class="tools-content">
214
+ <a href="/write"><button
215
+ style="color: greenyellow;background-color: black;">Write</button></a><br>
216
+ <a href="/summarize"><button
217
+ style="color: greenyellow;background-color: black;">Summarize</button></a><br>
218
+ <a href="/translate"><button
219
+ style="color: greenyellow;background-color: black;">Translate</button></a><br>
220
+ <a href="/imagine"><button
221
+ style="color: greenyellow;background-color: black;">Imagine</button></a><br>
222
+ <a href="/think"><button
223
+ style="color: greenyellow;background-color: black;">Think</button></a><br>
224
+ </div>
225
+ <button style="background-color: black;">
226
+ <i class="fa-solid fa-sliders fa-2xl" style="color: #63E6BE;"></i>
227
+ </button>
228
+ </div>
229
+ <button id="sendButton" onclick="answer()"
230
+ style="font-weight: bold; background-color: black; color: greenyellow">&#8593</button>
231
+ </div>
232
+ </div>
233
+ </main>
234
+
235
+ <script>
236
+ async function answer() {
237
+ document.getElementById("sendButton").disabled = true
238
+ const welcomeMessage = document.getElementById('welcomeMessage');
239
+ welcomeMessage.style.display = 'none'; // Hide the welcome message
240
+ const userInput = document.getElementById('userInput').value;
241
+ if (userInput.trim() === '') return;
242
+ // Create wrapper for text1 (User message)
243
+ const text1 = document.createElement('div');
244
+ text1.className = 'text1';
245
+ const userMessage = document.createElement('div');
246
+ userMessage.className = 'user';
247
+ userMessage.textContent = userInput;
248
+ text1.appendChild(userMessage);
249
+ // Append user message to the chat area
250
+ document.getElementById('chatArea').appendChild(text1);
251
+ // Clear input
252
+ document.getElementById('userInput').value = '';
253
+ const question = userInput; // Use the already retrieved value
254
+ // Send a POST request to the /ask route
255
+ const response = await fetch("/ask", {
256
+ method: "POST",
257
+ headers: {
258
+ "Content-Type": "application/x-www-form-urlencoded"
259
+ },
260
+ body: new URLSearchParams({ question: question })
261
+ });
262
+ const data = await response.json();
263
+ // Create wrapper for text2 (AI response)
264
+ const text2 = document.createElement('div');
265
+ text2.className = 'text2';
266
+ const aiResponse = document.createElement('div');
267
+ aiResponse.className = 'ai';
268
+ if (data.answer) {
269
+ aiResponse.textContent = data.answer;
270
+ } else if (data.error) {
271
+ aiResponse.textContent = "Error: " + data.error;
272
+ }
273
+ text2.appendChild(aiResponse);
274
+ // Append AI response to the chat area
275
+ document.getElementById('chatArea').appendChild(text2);
276
+ document.getElementById("sendButton").disabled = false
277
+ }
278
+ if ("serviceWorker" in navigator) {
279
+ navigator.serviceWorker
280
+ .register("/static/service-worker.js")
281
+ .then(() => console.log("Service Worker Registered"))
282
+ .catch((err) => console.error("SW registration failed:", err));
283
+ }
284
+ document.getElementById("theme").addEventListener("click", () => {
285
+ if (document.getElementsByTagName("body")[0].style.backgroundColor === "black") {
286
+ document.getElementsByTagName("body")[0].style.backgroundColor = "#2f2f2f";
287
+ document.getElementById("theme").textContent = "Theme: ☀️ (Light)";
288
+ document.getElementById("welcomeMessage").style.color = "black";
289
+ document.getElementsByTagName("body")[0].style.backgroundImage = "url({{ url_for('static', filename='images/light bg.jpeg') }})";
290
+ document.getElementById("drop-down-h3-menu").style.color = "black"
291
+ document.getElementById("drop-down-h3-settings").style.color = "black"
292
+ document.getElementById("drop-down-h3-warnings").style.color = "black"
293
+ document.getElementById("btn").style.color = "black"
294
+ document.querySelectorAll(".user").forEach(element => {
295
+ element.style.color = "black"
296
+ });
297
+ document.querySelectorAll(".ai").forEach(element => {
298
+ element.style.color = "black"
299
+ })
300
+ document.querySelectorAll(".dropdown-content a").forEach(element => {
301
+ element.style.color = "black"
302
+ })
303
+ document.getElementById("i_class").style.color = "black";
304
+ document.querySelectorAll(".dropdown-content p").forEach(element => {
305
+ element.style.color = "black"
306
+ })
307
+ document.getElementById("i_class_2").style.color = "black";
308
+ document.getElementsByTagName("h2")[0].style.color = "black";
309
+ } else {
310
+ document.getElementsByTagName("body")[0].style.backgroundColor = "black";
311
+ document.getElementById("theme").textContent = "Theme: 🌙 (Dark)";
312
+ document.getElementById("welcomeMessage").style.color = "white";
313
+ document.getElementsByTagName("body")[0].style.backgroundImage = "url({{ url_for('static', filename='images/black bg.jpeg') }})";
314
+ document.getElementById("drop-down-h3-menu").style.color = "white"
315
+ document.getElementById("drop-down-h3-settings").style.color = "white"
316
+ document.getElementById("drop-down-h3-warnings").style.color = "white"
317
+ document.querySelectorAll(".user").forEach(elements => {
318
+ elements.style.color = "white"
319
+ })
320
+ document.querySelectorAll(".ai").forEach(elements => {
321
+ elements.style.color = "white"
322
+ })
323
+ document.getElementById("btn").style.color = "white"
324
+ document.querySelectorAll(".dropdown-content a").forEach(element => {
325
+ element.style.color = "white"
326
+ })
327
+ document.getElementById("i_class").style.color = "white";
328
+ document.querySelectorAll(".dropdown-content p").forEach(element => {
329
+ element.style.color = "white"
330
+ })
331
+ document.getElementById("i_class_2").style.color = "white";
332
+ document.getElementsByTagName("h2")[0].style.color = "white";
333
+ }
334
+ })
335
+ document.getElementById("userInput").addEventListener("keypress", () => {
336
+ if (event.key === "Enter") {
337
+ sendButton.click()
338
+ }
339
+ })
340
+ </script>
341
+
342
+ </body>
343
+
344
+ </html>
templates/summarize.html ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Summarize | TaskBot v1+ AI</title>
8
+ <link rel="Icon" href="TaskBot logo.png">
9
+ </head>
10
+ <style>
11
+ body {
12
+ background-color: #2f2f2f;
13
+ font-family: Arial, sans-serif;
14
+ color: white;
15
+ margin: 0;
16
+ padding: 20px;
17
+ }
18
+
19
+ h1 {
20
+ text-align: center;
21
+ }
22
+
23
+ textarea {
24
+ width: 100%;
25
+ height: 300px;
26
+ }
27
+
28
+ button {
29
+ width: 100px;
30
+ height: 50px;
31
+ text-align: center;
32
+ float: right;
33
+ }
34
+
35
+ small {
36
+ display: block;
37
+ text-align: center;
38
+ color: gray
39
+ }
40
+ </style>
41
+
42
+ <body>
43
+
44
+
45
+ <h1>Summarizer</h1>
46
+ <small>Powered by gemini-2.0-flash</small><br><br>
47
+
48
+ <textarea name="question" id="question" placeholder="Write your text here to summarize..."></textarea><br><br><br>
49
+
50
+ <button onclick=answer() id="answer_button">Start Summarizing</button>
51
+ <label for="type">Summarize to: </label>
52
+ <select name="type" id="type">
53
+ <option value="points">Points</option>
54
+ <option value="para">Paragraph</option>
55
+ </select><br><br><br>
56
+ <label for="lines_points">Minimum Lines/Points</label>
57
+ <input type="number" id="lines_points"><br><br><br>
58
+
59
+ <textarea name="answer" id="answer" placeholder="Summary will be displayed here..."></textarea>
60
+ <script>
61
+ async function answer() {
62
+ document.getElementById("answer_button").disabled = true
63
+ const userInput = document.getElementById('question').value;
64
+ if (userInput.trim() === '') return;
65
+ const question = userInput;
66
+ const type = document.getElementById("type").value;
67
+ const num_of_lines_points = document.getElementById("lines_points").value;
68
+ try {
69
+ const response = await fetch("/summarize", {
70
+ method: "POST",
71
+ headers: {
72
+ "Content-Type": "application/x-www-form-urlencoded"
73
+ },
74
+ body: new URLSearchParams({ question: question, type: type, num_of_lines_points: num_of_lines_points })
75
+ });
76
+ const data = await response.json();
77
+ const answer_area = document.getElementById("answer");
78
+ if (data.answer) {
79
+ aiResponse = data.answer;
80
+ } else if (data.error) {
81
+ aiResponse = "Error: " + data.error;
82
+ }
83
+ answer_area.value = aiResponse
84
+ } catch (err) {
85
+ console.error("Fetch Error:", err);
86
+ document.getElementById("answer").value = err;
87
+ }
88
+ document.getElementById("answer_button").disabled = false
89
+ }
90
+ </script>
91
+ </body>
92
+
93
+ </html>
templates/think.html ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Think | TaskBot v1+ AI</title>
8
+ <script src="https://kit.fontawesome.com/cda0e70b18.js" crossorigin="anonymous"></script>
9
+ <link rel="Icon" href="TaskBot logo.png">
10
+ <link rel="manifest" href="/static/manifest.json">
11
+ </head>
12
+
13
+ <style>
14
+ body {
15
+ background-color: #2f2f2f;
16
+ font-family: Arial, sans-serif;
17
+ color: white;
18
+ margin: 0;
19
+ padding: 20px;
20
+ background: url("{{ url_for('static', filename='images/black bg.jpeg') }}");
21
+ background-size: cover;
22
+ background-repeat: no-repeat;
23
+ background-size: cover;
24
+ background-attachment: fixed;
25
+ background-position: center center;
26
+ }
27
+
28
+ nav {
29
+ background-color: #444;
30
+ padding: 5px;
31
+ border-radius: 5px;
32
+ width: 100%;
33
+ height: auto;
34
+ top: 0;
35
+ }
36
+
37
+ .sticky {
38
+ position: absolute;
39
+ top: 20px;
40
+ right: 20px;
41
+ z-index: 1000;
42
+ }
43
+
44
+ .sticky2 {
45
+ position: absolute;
46
+ top: 20px;
47
+ right: 80px;
48
+ z-index: 1000;
49
+ }
50
+
51
+ .sticky3 {
52
+ position: absolute;
53
+ top: 20px;
54
+ right: 140px;
55
+ z-index: 1000;
56
+ }
57
+
58
+ /* Dropdown Styles */
59
+ .dropdown {
60
+ position: relative;
61
+ display: inline-block;
62
+ }
63
+
64
+ .btn {
65
+ background-color: transparent;
66
+ color: white;
67
+ border: none;
68
+ cursor: pointer;
69
+ }
70
+
71
+ .btn:hover {
72
+ background-color: #494949;
73
+ }
74
+
75
+ .dropdown-content {
76
+ display: none;
77
+ position: absolute;
78
+ right: 0;
79
+ background-color: transparent;
80
+ backdrop-filter: blur(5px);
81
+ border: 1px solid black;
82
+ min-width: 160px;
83
+ box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
84
+ z-index: 1;
85
+ text-align: center;
86
+ }
87
+
88
+ .dropdown-content h3 {
89
+ margin: 5px 0;
90
+ color: white;
91
+ text-align: center;
92
+ }
93
+
94
+ .dropdown-content a {
95
+ color: white;
96
+ padding: 12px 16px;
97
+ text-decoration: none;
98
+ display: block;
99
+ border-top: 1px solid transparent;
100
+ }
101
+
102
+ .dropdown-content a:hover {
103
+ background-color: #bebebe;
104
+ }
105
+
106
+ .dropdown:hover .dropdown-content {
107
+ display: block;
108
+ }
109
+
110
+ main {
111
+ display: flex;
112
+ flex-direction: column;
113
+ align-items: center;
114
+ justify-content: center;
115
+ height: calc(100vh - 100px);
116
+ /* adjust if header height changes */
117
+ text-align: center;
118
+ }
119
+
120
+ /* Input and Button Styles */
121
+ #question {
122
+ padding: 10px;
123
+ font-size: 16px;
124
+ border-radius: 5px;
125
+ border: 1px solid #ccc;
126
+ margin-right: 10px;
127
+ }
128
+
129
+ .ai,
130
+ .user {
131
+ background-color: transparent;
132
+ backdrop-filter: blur(5px);
133
+ padding: 10px;
134
+ padding-right: 10px;
135
+ border-radius: 5px;
136
+ border: solid #ccc;
137
+ margin: 10px;
138
+ text-align: center;
139
+ justify-content: right;
140
+ width: 40%;
141
+ color: rgb(227, 227, 227)
142
+ }
143
+
144
+ .text1 {
145
+ display: flex;
146
+ justify-content: right;
147
+ align-items: center;
148
+ margin: 10px;
149
+ }
150
+
151
+ .text2 {
152
+ display: flex;
153
+ justify-content: left;
154
+ align-items: center;
155
+ margin: 10px;
156
+ }
157
+
158
+ .chat-input-container {
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ margin-top: 20px;
163
+ }
164
+
165
+ #sendButton {
166
+ margin-left: 10px;
167
+ padding: 10px 20px;
168
+ border: none;
169
+ border-radius: 5px;
170
+ background-color: #fff;
171
+ cursor: pointer;
172
+ transition: background-color 0.3s;
173
+ }
174
+
175
+ #sendButton:hover {
176
+ background-color: #e0e0e0;
177
+ }
178
+
179
+ .inputWrapper {
180
+ flex-direction: column;
181
+ align-items: center;
182
+ justify-content: center;
183
+ position: fixed;
184
+ bottom: 20px;
185
+ left: 50%;
186
+ transform: translateX(-50%);
187
+ display: flex;
188
+ gap: 10px;
189
+ z-index: 1000;
190
+ }
191
+
192
+ .inputWrapper input {
193
+ width: 100%;
194
+ padding: 10px;
195
+ }
196
+
197
+ .tools button {
198
+ font-size: 18px;
199
+ padding: 10px 20px;
200
+ border-radius: 50px;
201
+ cursor: pointer;
202
+ }
203
+
204
+ #welcomeMessage {
205
+ text-align: center;
206
+ margin-top: 20%;
207
+ }
208
+
209
+ .tools-content {
210
+ display: none;
211
+
212
+ }
213
+
214
+ .tools:hover {
215
+ .tools-content {
216
+ display: block
217
+ }
218
+ }
219
+ </style>
220
+
221
+ <body>
222
+ <H1 id="welcomeMessage">Hello 👋, what can I help with?</H1>
223
+ <div id="chatArea">
224
+ <div class="text1">
225
+ <div class="user" style="display: none;"></div>
226
+ </div>
227
+ <div class="text2">
228
+ <div class="ai" style="display: none;"></div>
229
+ </div>
230
+ </div>
231
+
232
+ <main>
233
+ <div class="inputWrapper">
234
+ <input type="text" id="userInput" placeholder="Type your message here..."
235
+ style="width: 200px;color: white; backdrop-filter: blur(100px);background-color: transparent; border-radius: 50px;border: 1px solid #ccc;margin-right: 10px;margin-left: 10px;">
236
+ <div
237
+ style="display: flex; flex-direction: row; gap: 10px; margin-top: 10px; width: 100%; justify-content: center;">
238
+ <div class="tools">
239
+ <div class="tools-content">
240
+ <a href="/write"><button
241
+ style="color: greenyellow;background-color: black;">Write</button></a><br>
242
+ <a href="/summarize"><button
243
+ style="color: greenyellow;background-color: black;">Summarize</button></a><br>
244
+ <a href="/translate"><button
245
+ style="color: greenyellow;background-color: black;">Translate</button></a><br>
246
+ <a href="/imagine"><button
247
+ style="color: greenyellow;background-color: black;">Imagine</button></a><br>
248
+ </div>
249
+ <button style="background-color: black;">
250
+ <i class="fa-solid fa-sliders fa-2xl" style="color: #63E6BE;"></i>
251
+ </button>
252
+ </div>
253
+ <button id="sendButton" onclick="answer()"
254
+ style="font-weight: bold; background-color: black; color: greenyellow">&#8593</button>
255
+ </div>
256
+ </div>
257
+ </main>
258
+
259
+ <script>
260
+
261
+ async function answer() {
262
+ document.getElementById("sendButton").disabled = true
263
+ const welcomeMessage = document.getElementById('welcomeMessage');
264
+ welcomeMessage.style.display = 'none'; // Hide the welcome message
265
+ const userInput = document.getElementById('userInput').value;
266
+ if (userInput.trim() === '') return;
267
+ // Create wrapper for text1 (User message)
268
+ const text1 = document.createElement('div');
269
+ text1.className = 'text1';
270
+ const userMessage = document.createElement('div');
271
+ userMessage.className = 'user';
272
+ userMessage.textContent = userInput;
273
+ text1.appendChild(userMessage);
274
+ // Append user message to the chat area
275
+ document.getElementById('chatArea').appendChild(text1);
276
+ // Clear input
277
+ document.getElementById('userInput').value = '';
278
+ const question = userInput; // Use the already retrieved value
279
+ // Send a POST request to the /ask route
280
+ const response = await fetch("/think", {
281
+ method: "POST",
282
+ headers: {
283
+ "Content-Type": "application/x-www-form-urlencoded"
284
+ },
285
+ body: new URLSearchParams({ question: question })
286
+ });
287
+ const data = await response.json();
288
+ // Create wrapper for text2 (AI response)
289
+ const text2 = document.createElement('div');
290
+ text2.className = 'text2';
291
+ const aiResponse = document.createElement('div');
292
+ aiResponse.className = 'ai';
293
+ if (data.answer) {
294
+ aiResponse.textContent = data.answer;
295
+ } else if (data.error) {
296
+ aiResponse.textContent = "Error: " + data.error;
297
+ }
298
+ text2.appendChild(aiResponse);
299
+ // Append AI response to the chat area
300
+ document.getElementById('chatArea').appendChild(text2);
301
+ document.getElementById("sendButton").disabled = false
302
+ }
303
+ if ("serviceWorker" in navigator) {
304
+ navigator.serviceWorker
305
+ .register("/static/service-worker.js")
306
+ .then(() => console.log("Service Worker Registered"))
307
+ .catch((err) => console.error("SW registration failed:", err));
308
+ }
309
+
310
+ document.getElementById("theme").addEventListener("click", () => {
311
+ if (document.getElementsByTagName("body")[0].style.backgroundColor === "black") {
312
+ document.getElementsByTagName("body")[0].style.backgroundColor = "#2f2f2f";
313
+ document.getElementById("theme").textContent = "Theme: ☀️ (Light)";
314
+ document.getElementById("welcomeMessage").style.color = "black";
315
+ document.getElementsByTagName("body")[0].style.backgroundImage = "url({{ url_for('static', filename='images/light bg.jpeg') }})";
316
+ document.getElementById("drop-down-h3-menu").style.color = "black"
317
+ document.getElementById("drop-down-h3-settings").style.color = "black"
318
+ document.getElementById("drop-down-h3-warnings").style.color = "black"
319
+ document.getElementById("btn").style.color = "black"
320
+ document.querySelectorAll(".user").forEach(element => {
321
+ element.style.color = "black"
322
+ });
323
+ document.querySelectorAll(".ai").forEach(element => {
324
+ element.style.color = "black"
325
+ })
326
+ document.querySelectorAll(".dropdown-content a").forEach(element => {
327
+ element.style.color = "black"
328
+ })
329
+ document.getElementById("i_class").style.color = "black";
330
+ document.querySelectorAll(".dropdown-content p").forEach(element => {
331
+ element.style.color = "black"
332
+ })
333
+ document.getElementById("i_class_2").style.color = "black";
334
+ document.getElementsByTagName("h2")[0].style.color = "black";
335
+ } else {
336
+ document.getElementsByTagName("body")[0].style.backgroundColor = "black";
337
+ document.getElementById("theme").textContent = "Theme: 🌙 (Dark)";
338
+ document.getElementById("welcomeMessage").style.color = "white";
339
+ document.getElementsByTagName("body")[0].style.backgroundImage = "url({{ url_for('static', filename='images/black bg.jpeg') }})";
340
+ document.getElementById("drop-down-h3-menu").style.color = "white"
341
+ document.getElementById("drop-down-h3-settings").style.color = "white"
342
+ document.getElementById("drop-down-h3-warnings").style.color = "white"
343
+ document.querySelectorAll(".user").forEach(elements => {
344
+ elements.style.color = "white"
345
+ })
346
+ document.querySelectorAll(".ai").forEach(elements => {
347
+ elements.style.color = "white"
348
+ })
349
+ document.getElementById("btn").style.color = "white"
350
+ document.querySelectorAll(".dropdown-content a").forEach(element => {
351
+ element.style.color = "white"
352
+ })
353
+ document.getElementById("i_class").style.color = "white";
354
+ document.querySelectorAll(".dropdown-content p").forEach(element => {
355
+ element.style.color = "white"
356
+ })
357
+ document.getElementById("i_class_2").style.color = "white";
358
+ document.getElementsByTagName("h2")[0].style.color = "white";
359
+ }
360
+ })
361
+ document.getElementById("userInput").addEventListener("keypress", () => {
362
+ if (event.key === "Enter") {
363
+ sendButton.click()
364
+ }
365
+ })
366
+ </script>
367
+
368
+ </body>
369
+
370
+ </html>
templates/translate.html ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Translate | TaskBot v1+ AI</title>
8
+ <link rel="Icon" href="TaskBot logo.png">
9
+ </head>
10
+ <style>
11
+ body {
12
+ background-color: #2f2f2f;
13
+ font-family: Arial, sans-serif;
14
+ color: white;
15
+ margin: 0;
16
+ padding: 20px;
17
+ }
18
+
19
+ h1 {
20
+ text-align: center;
21
+ }
22
+
23
+ input {
24
+ width: 100%;
25
+ border-radius: 50px;
26
+ background-color: white;
27
+ color: black;
28
+ height: 40px;
29
+ font-size: large;
30
+ }
31
+
32
+ label {
33
+ color: white;
34
+ }
35
+
36
+ textarea {
37
+ width: 100%;
38
+ font-size: x-large;
39
+ height: 100px;
40
+ user-select: none;
41
+ }
42
+
43
+ button {
44
+ width: 100px;
45
+ height: 50px;
46
+ text-align: center;
47
+ float: right;
48
+ }
49
+
50
+ small {
51
+ display: block;
52
+ text-align: center;
53
+ color: gray;
54
+ }
55
+ </style>
56
+
57
+ <body>
58
+
59
+ <h1>Translator</h1>
60
+ <small>Powered by gemini-2.0-flash</small><br><br>
61
+
62
+ <label for="question">Text:</label>
63
+ <input type=" text" id="question" placeholder="Type your text here..."><br><br>
64
+
65
+ <label for="from">Translate From: </label>
66
+ <input type="text" id="from" style="width: 200px; height: auto;"><br><br><br>
67
+ <label for="to">Translate To: </label>
68
+ <input type="text" id="to" style="width: 200px; height: auto;"><br><br><br>
69
+
70
+ <button onclick=answer() id="answer_button">Start Translating</button><br><br><br>
71
+
72
+ <textarea name="answer" id="answer" placeholder="Your answer will be displayed here..."></textarea>
73
+
74
+
75
+ <script>
76
+ document.getElementById("from").value = "Auto Detect"
77
+ async function answer() {
78
+ document.getElementById("answer_button").disabled = true
79
+ const userInput = document.getElementById('question').value;
80
+ if (userInput.trim() === '') return;
81
+ const question = userInput;
82
+ const translate_from = document.getElementById("from").value;
83
+ const translate_to = document.getElementById("to").value;
84
+ const response = await fetch("/translate", {
85
+ method: "POST",
86
+ headers: {
87
+ "Content-Type": "application/x-www-form-urlencoded"
88
+ },
89
+ body: new URLSearchParams({ question: question, translate_from: translate_from, translate_to: translate_to })
90
+ });
91
+ const data = await response.json();
92
+ const answer_area = document.getElementById("answer");
93
+ if (data.answer) {
94
+ aiResponse = data.answer;
95
+ answer_area.value = aiResponse
96
+ } else if (data.error) {
97
+ aiResponse = "Error: " + data.error;
98
+ answer_area.value = aiResponse
99
+ }
100
+ document.getElementById("answer_button").disabled = false
101
+ }
102
+ </script>
103
+ </body>
104
+
105
+ </html>
templates/write.html ADDED
@@ -0,0 +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>