ruslanmv commited on
Commit
d7738e9
1 Parent(s): 73ed651

First commit

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +35 -0
  2. .github/workflows/check.yml +16 -0
  3. .github/workflows/main.yml +19 -0
  4. Dockerfile +19 -0
  5. LICENSE +674 -0
  6. README.md +143 -0
  7. assets/2024-05-20-08-25-27.png +0 -0
  8. babel.cfg +2 -0
  9. client/css/api-key.css +26 -0
  10. client/css/button.css +26 -0
  11. client/css/buttons.css +4 -0
  12. client/css/checkbox.css +55 -0
  13. client/css/conversation.css +158 -0
  14. client/css/dropdown.css +10 -0
  15. client/css/field.css +11 -0
  16. client/css/global.css +85 -0
  17. client/css/hljs.css +68 -0
  18. client/css/label.css +16 -0
  19. client/css/main.css +14 -0
  20. client/css/message-input.css +27 -0
  21. client/css/message.css +65 -0
  22. client/css/options.css +10 -0
  23. client/css/select.css +35 -0
  24. client/css/settings.css +44 -0
  25. client/css/sidebar.css +197 -0
  26. client/css/stop-generating.css +38 -0
  27. client/css/style.css +19 -0
  28. client/css/theme-toggler.css +33 -0
  29. client/css/typing.css +15 -0
  30. client/html/index.html +224 -0
  31. client/img/android-chrome-192x192.png +0 -0
  32. client/img/android-chrome-384x384.png +0 -0
  33. client/img/apple-touch-icon.png +0 -0
  34. client/img/browserconfig.xml +9 -0
  35. client/img/favicon-16x16.png +0 -0
  36. client/img/favicon-32x32.png +0 -0
  37. client/img/favicon.ico +0 -0
  38. client/img/gpt.png +0 -0
  39. client/img/mstile-150x150.png +0 -0
  40. client/img/safari-pinned-tab.svg +21 -0
  41. client/img/site.webmanifest +19 -0
  42. client/img/user.png +0 -0
  43. client/js/api-key.js +33 -0
  44. client/js/change-language.js +47 -0
  45. client/js/chat.js +509 -0
  46. client/js/highlight.min.js +0 -0
  47. client/js/highlightjs-copy.min.js +1 -0
  48. client/js/icons.js +1 -0
  49. client/js/sidebar-toggler.js +34 -0
  50. client/js/theme-toggler.js +22 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
.github/workflows/check.yml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Check file size
2
+ on:
3
+ pull_request:
4
+ branches: [main]
5
+
6
+ # to run this workflow manually from the Actions tab
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ sync-to-hub:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check large files
14
+ uses: ActionsDesk/lfs-warning@v2.0
15
+ with:
16
+ filesizelimit: 10485760 # this is 10MB
.github/workflows/main.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face hub
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ # to run this workflow manually from the Actions tab
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ sync-to-hub:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ with:
14
+ fetch-depth: 0
15
+ lfs: true
16
+ - name: Push to hub
17
+ env:
18
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
19
+ run: git push https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/ruslanmv/ollama-webui main
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim-buster
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt requirements.txt
6
+
7
+ RUN python -m venv venv
8
+ ENV PATH="/app/venv/bin:$PATH"
9
+
10
+ RUN apt-get update && \
11
+ apt-get install -y --no-install-recommends build-essential libffi-dev cmake libcurl4-openssl-dev && \
12
+ pip3 install --no-cache-dir -r requirements.txt && \
13
+ curl -fsSL https://ollama.com/install.sh | sh
14
+
15
+ COPY . .
16
+
17
+ RUN chmod -R 777 translations
18
+
19
+ CMD ["python3", "./run.py"]
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Ollama WebUI
3
+ emoji: ⚡
4
+ colorFrom: indigo
5
+ colorTo: gray
6
+ sdk: docker
7
+ pinned: false
8
+ app_port: 1338
9
+ ---
10
+
11
+ # Ollama WebUI
12
+
13
+ The purpose of this LLM repository is have an LLM locally. If you dont have
14
+ internet and you need al llm this is a solution.
15
+ ![](assets/2024-05-20-08-25-27.png)
16
+
17
+ ## Table of Contents
18
+ - [To-Do List](#to-do-list-%EF%B8%8F)
19
+ - [Getting Started](#getting-started-white_check_mark)
20
+ - [Cloning the Repository](#cloning-the-repository-inbox_tray)
21
+ - [Install Dependencies](#install-dependencies-wrench)
22
+ - [Running the Application](#running-the-application-rocket)
23
+ - [Docker](#docker-)
24
+ - [Prerequisites](#prerequisites)
25
+ - [Running the Docker](#running-the-docker)
26
+ - [Incorporated Projects](#incorporated-projects-busts_in_silhouette)
27
+ - [WebUI](#webui)
28
+ - [API FreeGPT](#api-g4f)
29
+ - [Star History](#star-history)
30
+ - [Legal Notice](#legal-notice)
31
+
32
+ ## Getting Started :white_check_mark:
33
+ To get started with this project, you'll need download [ollama](https://ollama.com/download) and then clone the repository and have [Python](https://www.python.org/downloads/) installed on your system.
34
+
35
+ ### Cloning the Repository :inbox_tray:
36
+ Run the following command to clone the repository:
37
+
38
+ ```
39
+ git clone https://github.com/ruslanmv/ollama-webui.git
40
+ ```
41
+
42
+ ### Install Dependencies :wrench:
43
+ Navigate to the project directory:
44
+ ```
45
+ cd ollama-webui
46
+ ```
47
+
48
+ Install the dependencies:
49
+ ```
50
+ pip install -r requirements.txt
51
+ ```
52
+ ## Running the Application :rocket:
53
+ To run the application, run the following command:
54
+ ```
55
+ python run.py
56
+ ```
57
+
58
+ Access the application in your browser using the URL:
59
+ ```
60
+ http://127.0.0.1:1338
61
+ ```
62
+ or
63
+ ```
64
+ http://localhost:1338
65
+ ```
66
+
67
+
68
+ ## Docker 🐳
69
+ ### Prerequisites
70
+ Before you start, make sure you have installed [Docker](https://www.docker.com/get-started) on your machine.
71
+
72
+ ### Running the Docker
73
+ Pull the Docker image from Docker Hub:
74
+ ```
75
+ docker pull ruslanmv/ollama-webui
76
+ ```
77
+
78
+ Run the application using Docker:
79
+ ```
80
+ docker run -p 1338:1338 ruslanmv/ollama-webui
81
+ ```
82
+
83
+ Access the application in your browser using the URL:
84
+ ```
85
+ http://127.0.0.1:1338
86
+ ```
87
+ or
88
+ ```
89
+ http://localhost:1338
90
+ ```
91
+
92
+ When you're done using the application, stop the Docker containers using the following command:
93
+ ```
94
+ docker stop <container-id>
95
+ ```
96
+
97
+ ## Incorporated Projects :busts_in_silhouette:
98
+ I highly recommend visiting and supporting both projects.
99
+
100
+
101
+ <br>
102
+
103
+ ## Star History
104
+ [![Star History Chart](https://api.star-history.com/svg?repos=ruslanmv/ollama-webui&type=Timeline)](https://star-history.com/#ruslanmv/ollama-webui&Timeline)
105
+
106
+ <br>
107
+
108
+ ## Legal Notice
109
+ This repository is _not_ associated with or endorsed by providers of the APIs contained in this GitHub repository. This
110
+ project is intended **for educational purposes only**. This is just a little personal project. Sites may contact me to
111
+ improve their security or request the removal of their site from this repository.
112
+
113
+ Please note the following:
114
+
115
+ 1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners.
116
+ This project is _not_ claiming any right over them nor is it affiliated with or endorsed by any of the providers
117
+ mentioned.
118
+
119
+ 2. **Responsibility**: The author of this repository is _not_ responsible for any consequences, damages, or losses
120
+ arising from the use or misuse of this repository or the content provided by the third-party APIs. Users are solely
121
+ responsible for their actions and any repercussions that may follow. We strongly recommend the users to follow the
122
+ TOS of the each Website.
123
+
124
+ 3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By
125
+ using the information and code provided, users acknowledge that they are using the APIs and models at their own risk
126
+ and agree to comply with any applicable laws and regulations.
127
+
128
+ 4. **Copyright**: All content in this repository, including but not limited to code, images, and documentation, is the
129
+ intellectual property of the repository author, unless otherwise stated. Unauthorized copying, distribution, or use
130
+ of any content in this repository is strictly prohibited without the express written consent of the repository
131
+ author.
132
+
133
+ 5. **Indemnification**: Users agree to indemnify, defend, and hold harmless the author of this repository from and
134
+ against any and all claims, liabilities, damages, losses, or expenses, including legal fees and costs, arising out of
135
+ or in any way connected with their use or misuse of this repository, its content, or related third-party APIs.
136
+
137
+ 6. **Updates and Changes**: The author reserves the right to modify, update, or remove any content, information, or
138
+ features in this repository at any time without prior notice. Users are responsible for regularly reviewing the
139
+ content and any changes made to this repository.
140
+
141
+ By using this repository or any code related to it, you agree to these terms. The author is not responsible for any
142
+ copies, forks, or reuploads made by other users. This is the author's only account and repository. To prevent
143
+ impersonation or irresponsible actions, you may comply with the GNU GPL license this Repository uses.
assets/2024-05-20-08-25-27.png ADDED
babel.cfg ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [python: **/server/.py]
2
+ [jinja2: **/client/html/**.html]
client/css/api-key.css ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .api-key-container {
2
+ margin: 24px 12px 0;
3
+ display: flex;
4
+ justify-content: center;
5
+ }
6
+
7
+ .api-key-container .button {
8
+ color: var(--colour-3);
9
+ }
10
+
11
+ .api-key-container #show-api-key-button {
12
+ width: 90%;
13
+ }
14
+
15
+ .api-key-container #api-key-ok-button {
16
+ width: 30%;
17
+ }
18
+
19
+ .api-key-container input {
20
+ color: var(--colour-3);
21
+ margin: 0px 4px;
22
+ border: 1px solid var(--conversations);
23
+ border-radius: var(--border-radius-1);
24
+ background: transparent;
25
+ width: 70%;
26
+ }
client/css/button.css ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .button {
2
+ display: flex;
3
+ padding: 8px 12px;
4
+ align-items: center;
5
+ justify-content: center;
6
+ border: 1px solid var(--conversations);
7
+ border-radius: var(--border-radius-1);
8
+ width: 100%;
9
+ background: transparent;
10
+ cursor: pointer;
11
+ }
12
+
13
+ .button span {
14
+ color: var(--colour-3);
15
+ font-size: 0.875rem;
16
+ }
17
+
18
+ .button i::before {
19
+ margin-right: 8px;
20
+ }
21
+
22
+ @media screen and (max-width: 990px) {
23
+ .button span {
24
+ font-size: 0.75rem;
25
+ }
26
+ }
client/css/buttons.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ .buttons {
2
+ display: flex;
3
+ justify-content: left;
4
+ }
client/css/checkbox.css ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .checkbox input {
2
+ height: 0;
3
+ width: 0;
4
+ display: none;
5
+ }
6
+
7
+ .checkbox span {
8
+ font-size: 0.875rem;
9
+ color: var(--colour-2);
10
+ margin-left: 4px;
11
+ }
12
+
13
+ .checkbox label:after {
14
+ content: "";
15
+ position: absolute;
16
+ top: 50%;
17
+ transform: translateY(-50%);
18
+ left: 5px;
19
+ width: 20px;
20
+ height: 20px;
21
+ background: var(--blur-border);
22
+ border-radius: 90px;
23
+ transition: 0.33s;
24
+ }
25
+
26
+ .checkbox input + label:after,
27
+ .checkbox input:checked + label {
28
+ background: var(--colour-3);
29
+ }
30
+
31
+ .checkbox input + label,
32
+ .checkbox input:checked + label:after {
33
+ background: var(--blur-border);
34
+ }
35
+
36
+ .checkbox input:checked + label:after {
37
+ left: calc(100% - 5px - 20px);
38
+ }
39
+
40
+ @media screen and (max-width: 990px) {
41
+ .checkbox label {
42
+ width: 25px;
43
+ height: 15px;
44
+ }
45
+
46
+ .checkbox label:after {
47
+ left: 2px;
48
+ width: 10px;
49
+ height: 10px;
50
+ }
51
+
52
+ .checkbox input:checked + label:after {
53
+ left: calc(100% - 2px - 10px);
54
+ }
55
+ }
client/css/conversation.css ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .conversation {
2
+ width: 60%;
3
+ margin: 0px 16px;
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+
8
+ .conversation #messages {
9
+ width: 100%;
10
+ display: flex;
11
+ flex-direction: column;
12
+ overflow: auto;
13
+ overflow-wrap: break-word;
14
+ padding-bottom: 8px;
15
+ }
16
+
17
+ .conversation .user-input {
18
+ max-height: 180px;
19
+ margin: 16px 0px;
20
+ }
21
+
22
+ .conversation .user-input input {
23
+ font-size: 1rem;
24
+ background: none;
25
+ border: none;
26
+ outline: none;
27
+ color: var(--colour-3);
28
+ }
29
+
30
+ .conversation .user-input input::placeholder {
31
+ color: var(--user-input);
32
+ }
33
+
34
+ .conversation-title {
35
+ color: var(--colour-3);
36
+ font-size: 14px;
37
+ }
38
+
39
+ .conversation .user-input textarea {
40
+ font-size: 1rem;
41
+ width: 100%;
42
+ height: 100%;
43
+ padding: 12px;
44
+ background: none;
45
+ border: none;
46
+ outline: none;
47
+ color: var(--colour-3);
48
+ resize: vertical;
49
+ max-height: 150px;
50
+ min-height: 80px;
51
+ }
52
+
53
+ .box {
54
+ backdrop-filter: blur(20px);
55
+ -webkit-backdrop-filter: blur(20px);
56
+ background-color: var(--blur-bg);
57
+ height: 100%;
58
+ width: 100%;
59
+ border-radius: var(--border-radius-1);
60
+ border: 1px solid var(--blur-border);
61
+ }
62
+
63
+ .box.input-box {
64
+ position: relative;
65
+ align-items: center;
66
+ padding: 8px;
67
+ cursor: pointer;
68
+ }
69
+
70
+ #send-button {
71
+ position: absolute;
72
+ bottom: 25%;
73
+ right: 10px;
74
+ z-index: 1;
75
+ padding: 16px;
76
+ }
77
+
78
+ #cursor {
79
+ line-height: 17px;
80
+ margin-left: 3px;
81
+ -webkit-animation: blink 0.8s infinite;
82
+ animation: blink 0.8s infinite;
83
+ width: 7px;
84
+ height: 15px;
85
+ }
86
+
87
+ @keyframes blink {
88
+ 0% {
89
+ background: #ffffff00;
90
+ }
91
+
92
+ 50% {
93
+ background: white;
94
+ }
95
+
96
+ 100% {
97
+ background: #ffffff00;
98
+ }
99
+ }
100
+
101
+ @-webkit-keyframes blink {
102
+ 0% {
103
+ background: #ffffff00;
104
+ }
105
+
106
+ 50% {
107
+ background: white;
108
+ }
109
+
110
+ 100% {
111
+ background: #ffffff00;
112
+ }
113
+ }
114
+
115
+ /* scrollbar */
116
+ .conversation #messages::-webkit-scrollbar {
117
+ width: 4px;
118
+ padding: 8px 0px;
119
+ }
120
+
121
+ .conversation #messages::-webkit-scrollbar-track {
122
+ background-color: #ffffff00;
123
+ }
124
+
125
+ .conversation #messages::-webkit-scrollbar-thumb {
126
+ background-color: #555555;
127
+ border-radius: 10px;
128
+ }
129
+
130
+ @media screen and (max-width: 990px) {
131
+ .conversation {
132
+ width: 100%;
133
+ height: 90%;
134
+ }
135
+ }
136
+
137
+ @media screen and (max-height: 720px) {
138
+ .conversation.box {
139
+ height: 70%;
140
+ }
141
+
142
+ .conversation .user-input textarea {
143
+ font-size: 0.875rem;
144
+ }
145
+ }
146
+
147
+ @media screen and (max-width: 360px) {
148
+ .box {
149
+ border-radius: 0;
150
+ }
151
+ .conversation {
152
+ margin: 0;
153
+ margin-top: 48px;
154
+ }
155
+ .conversation .user-input {
156
+ margin: 2px 0 8px 0;
157
+ }
158
+ }
client/css/dropdown.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .dropdown {
2
+ border: 1px solid var(--conversations);
3
+ }
4
+
5
+ @media screen and (max-width: 990px) {
6
+ .dropdown {
7
+ padding: 4px 8px;
8
+ font-size: 0.75rem;
9
+ }
10
+ }
client/css/field.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .field {
2
+ display: flex;
3
+ align-items: center;
4
+ padding: 4px;
5
+ }
6
+
7
+ @media screen and (max-width: 990px) {
8
+ .field {
9
+ flex-wrap: nowrap;
10
+ }
11
+ }
client/css/global.css ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
2
+ * {
3
+ --font-1: "Inter", sans-serif;
4
+ --section-gap: 24px;
5
+ --border-radius-1: 8px;
6
+ margin: 0;
7
+ padding: 0;
8
+ box-sizing: border-box;
9
+ position: relative;
10
+ font-family: var(--font-1);
11
+ }
12
+
13
+ .theme-light {
14
+ --colour-1: #f5f5f5;
15
+ --colour-2: #000000;
16
+ --colour-3: #474747;
17
+ --colour-4: #949494;
18
+ --colour-5: #ebebeb;
19
+ --colour-6: #dadada;
20
+
21
+ --accent: #3a3a3a;
22
+ --blur-bg: #ffffff;
23
+ --blur-border: #dbdbdb;
24
+ --user-input: #282828;
25
+ --conversations: #666666;
26
+ }
27
+
28
+ .theme-dark {
29
+ --colour-1: #181818;
30
+ --colour-2: #ccc;
31
+ --colour-3: #dadada;
32
+ --colour-4: #f0f0f0;
33
+ --colour-5: #181818;
34
+ --colour-6: #242424;
35
+
36
+ --accent: #151718;
37
+ --blur-bg: #242627;
38
+ --blur-border: #242627;
39
+ --user-input: #f5f5f5;
40
+ --conversations: #555555;
41
+ }
42
+
43
+ html,
44
+ body {
45
+ background: var(--colour-1);
46
+ color: var(--colour-3);
47
+ }
48
+
49
+ ol,
50
+ ul {
51
+ padding-left: 20px;
52
+ }
53
+
54
+ .shown {
55
+ display: flex !important;
56
+ }
57
+
58
+ a:-webkit-any-link {
59
+ color: var(--accent);
60
+ }
61
+
62
+ .hidden {
63
+ display: none !important;
64
+ }
65
+
66
+ .fade-in {
67
+ opacity: 0;
68
+ animation: fadeIn 1s forwards;
69
+ }
70
+
71
+ pre {
72
+ white-space: pre-wrap;
73
+ }
74
+
75
+ @keyframes fadeIn {
76
+ to {
77
+ opacity: 1;
78
+ }
79
+ }
80
+
81
+ @media screen and (max-height: 720px) {
82
+ :root {
83
+ --section-gap: 16px;
84
+ }
85
+ }
client/css/hljs.css ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .hljs {
2
+ color: #e9e9f4;
3
+ background: #28293629;
4
+ border-radius: var(--border-radius-1);
5
+ border: 1px solid var(--blur-border);
6
+ font-size: 15px;
7
+ word-wrap: break-word;
8
+ white-space: pre-wrap;
9
+ }
10
+
11
+ /* style for hljs copy */
12
+ .hljs-copy-wrapper {
13
+ position: relative;
14
+ overflow: hidden;
15
+ }
16
+
17
+ .hljs-copy-wrapper:hover .hljs-copy-button,
18
+ .hljs-copy-button:focus {
19
+ transform: translateX(0);
20
+ }
21
+
22
+ .hljs-copy-button {
23
+ position: absolute;
24
+ transform: translateX(calc(100% + 1.125em));
25
+ top: 1em;
26
+ right: 1em;
27
+ width: 2rem;
28
+ height: 2rem;
29
+ text-indent: -9999px;
30
+ color: #fff;
31
+ border-radius: 0.25rem;
32
+ border: 1px solid #ffffff22;
33
+ background-color: #2d2b57;
34
+ background-image: url('data:image/svg+xml;utf-8,<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6 5C5.73478 5 5.48043 5.10536 5.29289 5.29289C5.10536 5.48043 5 5.73478 5 6V20C5 20.2652 5.10536 20.5196 5.29289 20.7071C5.48043 20.8946 5.73478 21 6 21H18C18.2652 21 18.5196 20.8946 18.7071 20.7071C18.8946 20.5196 19 20.2652 19 20V6C19 5.73478 18.8946 5.48043 18.7071 5.29289C18.5196 5.10536 18.2652 5 18 5H16C15.4477 5 15 4.55228 15 4C15 3.44772 15.4477 3 16 3H18C18.7956 3 19.5587 3.31607 20.1213 3.87868C20.6839 4.44129 21 5.20435 21 6V20C21 20.7957 20.6839 21.5587 20.1213 22.1213C19.5587 22.6839 18.7957 23 18 23H6C5.20435 23 4.44129 22.6839 3.87868 22.1213C3.31607 21.5587 3 20.7957 3 20V6C3 5.20435 3.31607 4.44129 3.87868 3.87868C4.44129 3.31607 5.20435 3 6 3H8C8.55228 3 9 3.44772 9 4C9 4.55228 8.55228 5 8 5H6Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3C7 1.89543 7.89543 1 9 1H15C16.1046 1 17 1.89543 17 3V5C17 6.10457 16.1046 7 15 7H9C7.89543 7 7 6.10457 7 5V3ZM15 3H9V5H15V3Z" fill="white"/></svg>');
35
+ background-repeat: no-repeat;
36
+ background-position: center;
37
+ transition: background-color 200ms ease, transform 200ms ease-out;
38
+ }
39
+
40
+ .hljs-copy-button:hover {
41
+ border-color: #ffffff44;
42
+ }
43
+
44
+ .hljs-copy-button:active {
45
+ border-color: #ffffff66;
46
+ }
47
+
48
+ .hljs-copy-button[data-copied="true"] {
49
+ text-indent: 0;
50
+ width: auto;
51
+ background-image: none;
52
+ }
53
+
54
+ .hljs-copy-alert {
55
+ clip: rect(0 0 0 0);
56
+ clip-path: inset(50%);
57
+ height: 1px;
58
+ overflow: hidden;
59
+ position: absolute;
60
+ white-space: nowrap;
61
+ width: 1px;
62
+ }
63
+
64
+ @media (prefers-reduced-motion) {
65
+ .hljs-copy-button {
66
+ transition: none;
67
+ }
68
+ }
client/css/label.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ label {
2
+ cursor: pointer;
3
+ text-indent: -9999px;
4
+ width: 50px;
5
+ height: 30px;
6
+ backdrop-filter: blur(20px);
7
+ -webkit-backdrop-filter: blur(20px);
8
+ background-color: var(--blur-bg);
9
+ border-radius: var(--border-radius-1);
10
+ border: 1px solid var(--blur-border);
11
+ display: block;
12
+ border-radius: 100px;
13
+ position: relative;
14
+ overflow: hidden;
15
+ transition: 0.33s;
16
+ }
client/css/main.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .main-container {
2
+ display: flex;
3
+ padding: var(--section-gap);
4
+ height: 100vh;
5
+ justify-content: center;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ @media screen and (max-width: 360px) {
10
+ .main-container {
11
+ padding: 0px;
12
+ height: 90vh;
13
+ }
14
+ }
client/css/message-input.css ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #message-input {
2
+ margin-right: 30px;
3
+ height: 64px;
4
+ }
5
+
6
+ #message-input::-webkit-scrollbar {
7
+ width: 5px;
8
+ }
9
+
10
+ #message-input::-webkit-scrollbar-track {
11
+ background: #f1f1f1;
12
+ }
13
+
14
+ #message-input::-webkit-scrollbar-thumb {
15
+ background: #c7a2ff;
16
+ }
17
+
18
+ #message-input::-webkit-scrollbar-thumb:hover {
19
+ background: #8b3dff;
20
+ }
21
+
22
+ @media screen and (max-width: 360px) {
23
+ #message-input {
24
+ margin: 0;
25
+ }
26
+ }
27
+
client/css/message.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .message {
2
+ width: 100%;
3
+ overflow-wrap: break-word;
4
+ display: flex;
5
+ gap: var(--section-gap);
6
+ padding: var(--section-gap);
7
+ padding-bottom: 0;
8
+ }
9
+
10
+ .message:last-child {
11
+ animation: 0.6s show_message;
12
+ }
13
+
14
+ @keyframes show_message {
15
+ from {
16
+ transform: translateY(10px);
17
+ opacity: 0;
18
+ }
19
+ }
20
+
21
+ .message .avatar-container img {
22
+ max-width: 48px;
23
+ max-height: 48px;
24
+ box-shadow: 0.4px 0.5px 0.7px -2px rgba(0, 0, 0, 0.08), 1.1px 1.3px 2px -2px rgba(0, 0, 0, 0.041),
25
+ 2.7px 3px 4.8px -2px rgba(0, 0, 0, 0.029), 9px 10px 16px -2px rgba(0, 0, 0, 0.022);
26
+ }
27
+
28
+ .message .content {
29
+ display: flex;
30
+ flex-direction: column;
31
+ width: 90%;
32
+ gap: 18px;
33
+ }
34
+
35
+ .message .content p,
36
+ .message .content li,
37
+ .message .content code {
38
+ font-size: 1rem;
39
+ line-height: 1.3;
40
+ }
41
+
42
+ @media screen and (max-height: 720px) {
43
+ .message {
44
+ padding: 12px;
45
+ gap: 0;
46
+ }
47
+
48
+ .message .content {
49
+ margin-left: 8px;
50
+ width: 80%;
51
+ }
52
+
53
+ .message .avatar-container img {
54
+ max-width: 32px;
55
+ max-height: 32px;
56
+ }
57
+
58
+ .message .content,
59
+ .message .content p,
60
+ .message .content li,
61
+ .message .content code {
62
+ font-size: 0.875rem;
63
+ line-height: 1.3;
64
+ }
65
+ }
client/css/options.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .options-container {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ }
5
+
6
+ @media screen and (max-width: 990px) {
7
+ .options-container {
8
+ justify-content: space-between;
9
+ }
10
+ }
client/css/select.css ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ select {
2
+ -webkit-border-radius: 8px;
3
+ -moz-border-radius: 8px;
4
+ border-radius: 8px;
5
+
6
+ -webkit-backdrop-filter: blur(20px);
7
+ backdrop-filter: blur(20px);
8
+
9
+ cursor: pointer;
10
+ background-color: var(--blur-bg);
11
+ border: 1px solid var(--blur-border);
12
+ color: var(--colour-3);
13
+ display: block;
14
+ position: relative;
15
+ overflow: hidden;
16
+ outline: none;
17
+ padding: 8px 16px;
18
+
19
+ appearance: none;
20
+ }
21
+
22
+ /* scrollbar */
23
+ select.dropdown::-webkit-scrollbar {
24
+ width: 4px;
25
+ padding: 8px 0px;
26
+ }
27
+
28
+ select.dropdown::-webkit-scrollbar-track {
29
+ background-color: #ffffff00;
30
+ }
31
+
32
+ select.dropdown::-webkit-scrollbar-thumb {
33
+ background-color: #555555;
34
+ border-radius: 10px;
35
+ }
client/css/settings.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .settings-container {
2
+ color: var(--colour-2);
3
+ margin: 24px 0px 8px 0px;
4
+ justify-content: center;
5
+ }
6
+
7
+ .settings-container span {
8
+ font-size: 0.875rem;
9
+ margin: 0;
10
+ }
11
+
12
+ .settings-container label {
13
+ width: 24px;
14
+ height: 16px;
15
+ }
16
+
17
+ .settings-container .field {
18
+ justify-content: space-between;
19
+ }
20
+
21
+ .settings-container .checkbox input + label,
22
+ .settings-container .checkbox input:checked + label:after {
23
+ background: var(--colour-1);
24
+ }
25
+
26
+ .settings-container .checkbox input + label:after,
27
+ .settings-container .checkbox input:checked + label {
28
+ background: var(--colour-3);
29
+ }
30
+
31
+ .settings-container .checkbox label:after {
32
+ left: 2px;
33
+ width: 10px;
34
+ height: 10px;
35
+ }
36
+
37
+ .settings-container .checkbox input:checked + label:after {
38
+ left: calc(100% - 2px - 10px);
39
+ }
40
+
41
+ .settings-container .dropdown {
42
+ padding: 4px 8px;
43
+ font-size: 0.75rem;
44
+ }
client/css/sidebar.css ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .sidebar {
2
+ max-width: 260px;
3
+ padding: var(--section-gap);
4
+ flex-shrink: 0;
5
+ display: flex;
6
+ flex-direction: column;
7
+ justify-content: space-between;
8
+ }
9
+
10
+ .sidebar .title {
11
+ font-size: 14px;
12
+ font-weight: 500;
13
+ }
14
+
15
+ .sidebar .conversation-sidebar {
16
+ padding: 8px 12px;
17
+ display: flex;
18
+ gap: 18px;
19
+ align-items: center;
20
+ user-select: none;
21
+ justify-content: space-between;
22
+ }
23
+
24
+ .sidebar .conversation-sidebar .left {
25
+ cursor: pointer;
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 10px;
29
+ }
30
+
31
+ .sidebar i {
32
+ color: var(--conversations);
33
+ cursor: pointer;
34
+ }
35
+
36
+ .sidebar .top {
37
+ display: flex;
38
+ flex-direction: column;
39
+ overflow: hidden;
40
+ gap: 16px;
41
+ padding-right: 8px;
42
+ }
43
+
44
+ .sidebar .top:hover {
45
+ overflow: auto;
46
+ }
47
+
48
+ .sidebar .info {
49
+ padding: 8px 12px 0px 12px;
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ user-select: none;
54
+ background: transparent;
55
+ width: 100%;
56
+ border: none;
57
+ text-decoration: none;
58
+ }
59
+
60
+ .sidebar .info span {
61
+ color: var(--conversations);
62
+ line-height: 1.5;
63
+ font-size: 0.75rem;
64
+ }
65
+
66
+ .sidebar .info i::before {
67
+ margin-right: 8px;
68
+ }
69
+
70
+ .sidebar-footer {
71
+ width: 100%;
72
+ margin-top: 16px;
73
+ display: flex;
74
+ flex-direction: column;
75
+ }
76
+
77
+ .sidebar-footer button {
78
+ cursor: pointer;
79
+ user-select: none;
80
+ background: transparent;
81
+ }
82
+
83
+ .sidebar.shown {
84
+ position: fixed;
85
+ top: 0;
86
+ left: 0;
87
+ width: 100%;
88
+ height: 100%;
89
+ z-index: 1000;
90
+ }
91
+
92
+ .sidebar.shown .box {
93
+ background-color: #16171a;
94
+ width: 80%;
95
+ height: 100%;
96
+ overflow-y: auto;
97
+ }
98
+
99
+ @keyframes spinner {
100
+ to {
101
+ transform: rotate(360deg);
102
+ }
103
+ }
104
+
105
+ /* scrollbar */
106
+ .sidebar .top::-webkit-scrollbar {
107
+ width: 4px;
108
+ padding: 8px 0px;
109
+ }
110
+
111
+ .sidebar .top::-webkit-scrollbar-track {
112
+ background-color: #ffffff00;
113
+ }
114
+
115
+ .sidebar .top::-webkit-scrollbar-thumb {
116
+ background-color: #555555;
117
+ border-radius: 10px;
118
+ }
119
+
120
+ .spinner:before {
121
+ content: "";
122
+ box-sizing: border-box;
123
+ position: absolute;
124
+ top: 50%;
125
+ left: 45%;
126
+ width: 20px;
127
+ height: 20px;
128
+ border-radius: 50%;
129
+ border: 1px solid var(--conversations);
130
+ border-top-color: white;
131
+ animation: spinner 0.6s linear infinite;
132
+ }
133
+
134
+ .menu-button {
135
+ display: none !important;
136
+ position: absolute;
137
+ z-index: 100000;
138
+ top: 0;
139
+ left: 0;
140
+ margin: 10px;
141
+ font-size: 1rem;
142
+ cursor: pointer;
143
+ width: 30px;
144
+ height: 30px;
145
+ justify-content: center;
146
+ align-items: center;
147
+ transition: 0.33s;
148
+ }
149
+
150
+ .menu-button i {
151
+ transition: 0.33s;
152
+ }
153
+
154
+ .rotated {
155
+ transform: rotate(360deg);
156
+ }
157
+
158
+ .menu-button.rotated {
159
+ position: fixed;
160
+ top: 10px;
161
+ left: 10px;
162
+ z-index: 1001;
163
+ }
164
+
165
+ @media screen and (max-width: 990px) {
166
+ .sidebar {
167
+ display: none;
168
+ width: 100%;
169
+ max-width: none;
170
+ }
171
+
172
+ .menu-button {
173
+ display: flex !important;
174
+ }
175
+ }
176
+
177
+ @media (max-width: 990px) {
178
+ .sidebar .top {
179
+ padding-top: 48px;
180
+ }
181
+ }
182
+
183
+ @media (min-width: 768px) {
184
+ .sidebar.shown {
185
+ position: static;
186
+ width: auto;
187
+ height: auto;
188
+ background-color: transparent;
189
+ }
190
+
191
+ .sidebar.shown .box {
192
+ background-color: #16171a;
193
+ width: auto;
194
+ height: auto;
195
+ overflow-y: auto;
196
+ }
197
+ }
client/css/stop-generating.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .stop-generating {
2
+ position: absolute;
3
+ bottom: 128px;
4
+ left: 50%;
5
+ transform: translateX(-50%);
6
+ z-index: 1000000;
7
+ }
8
+
9
+ .stop-generating button {
10
+ backdrop-filter: blur(20px);
11
+ -webkit-backdrop-filter: blur(20px);
12
+ background-color: var(--blur-bg);
13
+ color: var(--colour-3);
14
+ cursor: pointer;
15
+ animation: show_popup 0.4s;
16
+ }
17
+
18
+ @keyframes show_popup {
19
+ from {
20
+ opacity: 0;
21
+ transform: translateY(10px);
22
+ }
23
+ }
24
+
25
+ @keyframes hide_popup {
26
+ to {
27
+ opacity: 0;
28
+ transform: translateY(10px);
29
+ }
30
+ }
31
+
32
+ .stop-generating-hiding button {
33
+ animation: hide_popup 0.4s;
34
+ }
35
+
36
+ .stop-generating-hidden button {
37
+ display: none;
38
+ }
client/css/style.css ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "./global.css";
2
+ @import "./hljs.css";
3
+ @import "./main.css";
4
+ @import "./sidebar.css";
5
+ @import "./conversation.css";
6
+ @import "./message.css";
7
+ @import "./stop-generating.css";
8
+ @import "./typing.css";
9
+ @import "./checkbox.css";
10
+ @import "./label.css";
11
+ @import "./button.css";
12
+ @import "./buttons.css";
13
+ @import "./dropdown.css";
14
+ @import "./field.css";
15
+ @import "./select.css";
16
+ @import "./options.css";
17
+ /*@import "./api-key.css";*/
18
+ @import "./settings.css";
19
+ @import "./message-input.css";
client/css/theme-toggler.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .theme-toggler-container {
2
+ margin: 12px 0px 8px 0px;
3
+ justify-content: center;
4
+ }
5
+
6
+ .theme-toggler-container.checkbox input + label,
7
+ .theme-toggler-container.checkbox input:checked + label:after {
8
+ background: var(--colour-1);
9
+ }
10
+
11
+ .theme-toggler-container.checkbox input + label:after,
12
+ .theme-toggler-container.checkbox input:checked + label {
13
+ background: var(--colour-3);
14
+ }
15
+
16
+ .theme-toggler-container.checkbox span {
17
+ font-size: 0.75rem;
18
+ }
19
+
20
+ .theme-toggler-container.checkbox label {
21
+ width: 24px;
22
+ height: 16px;
23
+ }
24
+
25
+ .theme-toggler-container.checkbox label:after {
26
+ left: 2px;
27
+ width: 10px;
28
+ height: 10px;
29
+ }
30
+
31
+ .theme-toggler-container.checkbox input:checked + label:after {
32
+ left: calc(100% - 2px - 10px);
33
+ }
client/css/typing.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .typing {
2
+ position: absolute;
3
+ top: -25px;
4
+ left: 0;
5
+ font-size: 14px;
6
+ animation: show_popup 0.4s;
7
+ }
8
+
9
+ .typing-hiding {
10
+ animation: hide_popup 0.4s;
11
+ }
12
+
13
+ .typing-hidden {
14
+ display: none;
15
+ }
client/html/index.html ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0" />
7
+ <meta name="description" content="A conversational AI system that listens, learns, and challenges" />
8
+ <meta property="og:title" content="ChatGPT" />
9
+ <meta property="og:image" content="https://openai.com/content/images/2022/11/ChatGPT.jpg" />
10
+ <meta
11
+ property="og:description"
12
+ content="A conversational AI system that listens, learns, and challenges" />
13
+ <meta property="og:url" content="https://chat.acy.dev" />
14
+ <link rel="stylesheet" href="{{ url_for('bp.static', filename='css/style.css') }}" />
15
+ <link
16
+ rel="apple-touch-icon"
17
+ sizes="180x180"
18
+ href="{{ url_for('bp.static', filename='img/apple-touch-icon.png') }}" />
19
+ <link
20
+ rel="icon"
21
+ type="image/png"
22
+ sizes="32x32"
23
+ href="{{ url_for('bp.static', filename='img/favicon-32x32.png') }}" />
24
+ <link
25
+ rel="icon"
26
+ type="image/png"
27
+ sizes="16x16"
28
+ href="{{ url_for('bp.static', filename='img/favicon-16x16.png') }}" />
29
+ <link rel="manifest" href="{{ url_for('bp.static', filename='img/site.webmanifest') }}" />
30
+ <link
31
+ rel="stylesheet"
32
+ href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/base16/dracula.min.css" />
33
+ <title>Ollama WebUI</title>
34
+
35
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
36
+ <title>Toggle API Key</title>
37
+ <style>
38
+ .hidden {
39
+ display: none;
40
+ }
41
+ .fade-in {
42
+ animation: fadeIn 0.5s;
43
+ }
44
+ @keyframes fadeIn {
45
+ from { opacity: 0; }
46
+ to { opacity: 1; }
47
+ }
48
+ </style>
49
+
50
+
51
+ </head>
52
+
53
+ <body data-urlprefix="{{ url_prefix}}">
54
+ <div class="main-container">
55
+ <div class="box sidebar">
56
+ <div class="top">
57
+ <button class="button" onclick="new_conversation()">
58
+ <i class="fa-regular fa-plus"></i>
59
+ <span>{{_('New Conversation')}}</span>
60
+ </button>
61
+ <div class="spinner"></div>
62
+ </div>
63
+ <div class="sidebar-footer">
64
+ <button class="button" onclick="delete_conversations()">
65
+ <i class="fa-regular fa-trash"></i>
66
+ <span>{{_('Clear Conversations')}}</span>
67
+ </button>
68
+ <div class="api-key-container hidden" id="api-key-container">
69
+ <button id="show-api-key-button" class="button">
70
+ <i class="fa-regular fa-key"></i>
71
+ <span>{{_('API Key')}}</span>
72
+ </button>
73
+ <input type="password" id="API-key" class="hidden fade-in" />
74
+ <button id="api-key-ok-button" class="button hidden fade-in">{{_('Ok')}}</button>
75
+ </div>
76
+
77
+
78
+ <div class="settings-container">
79
+ <div class="checkbox field">
80
+ <span>{{_('Dark Mode')}}</span>
81
+ <input type="checkbox" id="theme-toggler" />
82
+ <label for="theme-toggler"></label>
83
+ </div>
84
+ <div class="field">
85
+ <span>{{_('Language')}}</span>
86
+ <select
87
+ class="dropdown"
88
+ id="language"
89
+ onchange="changeLanguage(this.value)"></select>
90
+ </div>
91
+ </div>
92
+ <a
93
+ class="info"
94
+ href="https://github.com/ruslanmv/ollama-webui/"
95
+
96
+
97
+ target="_blank">
98
+ <i class="fa-brands fa-github"></i>
99
+ <span class="conversation-title">ollama-webui</span>
100
+ </a>
101
+ <a class="info" href="https://discord.gg/kaNQeswa" target="_blank">
102
+
103
+ <i class="fa-brands fa-discord"></i>
104
+ <span class="conversation-title">ruslanmv</span>
105
+ </a>
106
+ </div>
107
+ </div>
108
+ <div class="conversation">
109
+ <div class="stop-generating stop-generating-hidden">
110
+ <button class="button" id="cancelButton">
111
+ <span>{{_('Stop Generating')}}</span>
112
+ </button>
113
+ </div>
114
+ <div class="box" id="messages"></div>
115
+ <div class="user-input">
116
+ <div class="box input-box">
117
+ <textarea
118
+ id="message-input"
119
+ placeholder="{{_('Ask a question')}}"
120
+ cols="30"
121
+ rows="10"
122
+ style="white-space: pre-wrap"></textarea>
123
+ <div id="send-button">
124
+ <i class="fa-regular fa-paper-plane-top"></i>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ <div>
129
+ <div class="options-container">
130
+ <div class="buttons">
131
+ <div class="field">
132
+ <select class="dropdown" name="model" id="model">
133
+ <optgroup label="Ollama">
134
+ <option value="llama3">llama3</option>
135
+ <option value='llama3:70b'>llama3:70b </option>
136
+ <option value='phi3'>phi3 </option>
137
+ <option value='mistral'>mistral </option>
138
+ <option value='neural-chat'>neural-chat </option>
139
+ <option value='starling-lm'>starling-lm </option>
140
+ <option value='codellama'>codellama </option>
141
+ <option value='llama2-uncensored'>llama2-uncensored </option>
142
+ <option value='llava'>llava </option>
143
+ <option value='gemma:2b'> gemma:2b</option>
144
+ <option value='gemma:7b'>gemma:7b </option>
145
+ <option value='solar'>solar </option>
146
+ </optgroup>
147
+ <!--
148
+ <optgroup label="GPT">
149
+ <option value="gpt-3.5-turbo">GPT-3.5-turbo</option>
150
+ <option value="gpt-3.5-turbo-0301">GPT-3.5-turbo-0301</option>
151
+ <option value="gpt-3.5-turbo-16k">GPT-3.5-turbo-16k</option>
152
+ <option value="gpt-4">GPT-4</option>
153
+ <option value="gpt-4-0314">GPT-4-0314</option>
154
+ <option value="gpt-4-32k">GPT-4-32k</option>
155
+ </optgroup>
156
+ <optgroup label="OPEN LLM">
157
+ <option value="oasst-sft-6-llama-30b">LLaMa-30B-sft-6</option>
158
+ <option value="llama-2-70b-chat">LLaMa-2-70B-chat</option>
159
+ <option value="falcon-180b-chat">Falcon-180b-chat</option>
160
+ </optgroup>
161
+ <optgroup label="CLAUDE">
162
+ <option value="claude-instant">Claude-instant</option>
163
+ <option value="claude-2">Claude-2</option>
164
+ </optgroup>
165
+ <optgroup label="{{_('IMAGE')}}">
166
+ <option value="" disabled>Kandinsky (soon)</option>
167
+ </optgroup>
168
+ -->
169
+ </select>
170
+ </div>
171
+ <div class="field">
172
+ <select class="dropdown" name="jailbreak" id="jailbreak">
173
+ <option value="default" selected>{{_('Default')}}</option>
174
+ <option value="gpt-dan-11.0">{{_('DAN')}}</option>
175
+ <option value="gpt-evil">{{_('Evil')}}</option>
176
+ </select>
177
+ </div>
178
+ </div>
179
+ <div class="field checkbox">
180
+ <input type="checkbox" id="switch" />
181
+ <label for="switch"></label>
182
+ <span>{{_('online')}}</span>
183
+ </div>
184
+
185
+ </div>
186
+ </div>
187
+ </div>
188
+ </div>
189
+ <div class="menu-button">
190
+ <i class="fa-solid fa-bars"></i>
191
+ </div>
192
+
193
+ <!-- scripts -->
194
+ <script>
195
+ window.conversation_id = "{{ chat_id }}";
196
+ </script>
197
+ <script src="{{ url_for('bp.static', filename='js/api-key.js') }}"></script>
198
+ <script src="{{ url_for('bp.static', filename='js/icons.js') }}"></script>
199
+ <script src="{{ url_for('bp.static', filename='js/chat.js') }}" defer></script>
200
+ <script src="https://cdn.jsdelivr.net/npm/markdown-it@latest/dist/markdown-it.min.js"></script>
201
+ <script src="{{ url_for('bp.static', filename='js/highlight.min.js') }}"></script>
202
+ <script src="{{ url_for('bp.static', filename='js/highlightjs-copy.min.js') }}"></script>
203
+ <script src="{{ url_for('bp.static', filename='js/theme-toggler.js') }}"></script>
204
+ <script src="{{ url_for('bp.static', filename='js/sidebar-toggler.js') }}"></script>
205
+ <script src="{{ url_for('bp.static', filename='js/change-language.js') }}"></script>
206
+ <script>
207
+ document.getElementById('switch').addEventListener('change', function() {
208
+ var apiKeyContainer = document.getElementById('api-key-container');
209
+ if (this.checked) {
210
+ apiKeyContainer.classList.remove('hidden');
211
+ } else {
212
+ apiKeyContainer.classList.add('hidden');
213
+ }
214
+ });
215
+ document.getElementById('show-api-key-button').addEventListener('click', function() {
216
+ var apiKeyInput = document.getElementById('API-key');
217
+ var okButton = document.getElementById('api-key-ok-button');
218
+ apiKeyInput.classList.remove('hidden');
219
+ okButton.classList.remove('hidden');
220
+ });
221
+ </script>
222
+
223
+ </body>
224
+ </html>
client/img/android-chrome-192x192.png ADDED
client/img/android-chrome-384x384.png ADDED
client/img/apple-touch-icon.png ADDED
client/img/browserconfig.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <browserconfig>
3
+ <msapplication>
4
+ <tile>
5
+ <square150x150logo src="/mstile-150x150.png"/>
6
+ <TileColor>#da532c</TileColor>
7
+ </tile>
8
+ </msapplication>
9
+ </browserconfig>
client/img/favicon-16x16.png ADDED
client/img/favicon-32x32.png ADDED
client/img/favicon.ico ADDED
client/img/gpt.png ADDED
client/img/mstile-150x150.png ADDED
client/img/safari-pinned-tab.svg ADDED
client/img/site.webmanifest ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "",
3
+ "short_name": "",
4
+ "icons": [
5
+ {
6
+ "src": "/android-chrome-192x192.png",
7
+ "sizes": "192x192",
8
+ "type": "image/png"
9
+ },
10
+ {
11
+ "src": "/android-chrome-384x384.png",
12
+ "sizes": "384x384",
13
+ "type": "image/png"
14
+ }
15
+ ],
16
+ "theme_color": "#ffffff",
17
+ "background_color": "#ffffff",
18
+ "display": "standalone"
19
+ }
client/img/user.png ADDED
client/js/api-key.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const showApiKeyButton = document.getElementById("show-api-key-button");
2
+ const apiKeyInput = document.getElementById("API-key");
3
+ const apiKeyOkButton = document.getElementById("api-key-ok-button");
4
+
5
+ showApiKeyButton.addEventListener("click", () => {
6
+ showApiKeyButton.classList.add("hidden");
7
+
8
+ apiKeyInput.classList.remove("hidden");
9
+ apiKeyOkButton.classList.remove("hidden");
10
+ });
11
+
12
+ apiKeyOkButton.addEventListener("click", () => {
13
+ localStorage.setItem("API-key", apiKeyInput.value);
14
+
15
+ apiKeyInput.classList.add("hidden");
16
+ apiKeyOkButton.classList.add("hidden");
17
+
18
+ showApiKeyButton.classList.remove("hidden");
19
+ });
20
+
21
+ window.addEventListener("DOMContentLoaded", () => {
22
+ const apiKey = localStorage.getItem("API-key");
23
+ if (apiKey) {
24
+ apiKeyInput.value = apiKey;
25
+ }
26
+ });
27
+
28
+ (function () {
29
+ function get_api_key_from_input() {
30
+ return apiKeyInput.value;
31
+ }
32
+ window.get_api_key_from_input = get_api_key_from_input;
33
+ })();
client/js/change-language.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', fetchLanguages);
2
+
3
+ async function fetchLanguages() {
4
+ try {
5
+ const [languagesResponse, currentLanguageResponse] = await Promise.all([
6
+ fetch(`${url_prefix}/get-languages`),
7
+ fetch(`${url_prefix}/get-locale`)
8
+ ]);
9
+
10
+ const languages = await languagesResponse.json();
11
+ const currentLanguage = await currentLanguageResponse.text();
12
+
13
+ const languageSelect = document.getElementById('language');
14
+ languages.forEach(lang => {
15
+ const option = document.createElement('option');
16
+ option.value = lang;
17
+ option.textContent = lang;
18
+ languageSelect.appendChild(option);
19
+ });
20
+
21
+ const savedLanguage = localStorage.getItem("language") || currentLanguage;
22
+ setLanguageOnPageLoad(savedLanguage);
23
+ } catch (error) {
24
+ console.error("Failed to fetch languages or current language");
25
+ }
26
+ }
27
+
28
+ function setLanguageOnPageLoad(language) {
29
+ document.getElementById("language").value = language;
30
+ }
31
+
32
+ function changeLanguage(lang) {
33
+ fetch(`${url_prefix}/change-language`, {
34
+ method: "POST",
35
+ headers: {
36
+ "Content-Type": "application/json",
37
+ },
38
+ body: JSON.stringify({ language: lang }),
39
+ }).then((response) => {
40
+ if (response.ok) {
41
+ localStorage.setItem("language", lang);
42
+ location.reload();
43
+ } else {
44
+ console.error("Failed to change language");
45
+ }
46
+ });
47
+ }
client/js/chat.js ADDED
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const query = (obj) =>
2
+ Object.keys(obj)
3
+ .map((k) => encodeURIComponent(k) + "=" + encodeURIComponent(obj[k]))
4
+ .join("&");
5
+ const url_prefix = document.querySelector("body").getAttribute("data-urlprefix");
6
+ const markdown = window.markdownit();
7
+ const message_box = document.getElementById(`messages`);
8
+ const message_input = document.getElementById(`message-input`);
9
+ const box_conversations = document.querySelector(`.top`);
10
+ const spinner = box_conversations.querySelector(".spinner");
11
+ const stop_generating = document.querySelector(`.stop-generating`);
12
+ const send_button = document.querySelector(`#send-button`);
13
+ const user_image = `<img src="${url_prefix}/assets/img/user.png" alt="User Avatar">`;
14
+ const gpt_image = `<img src="${url_prefix}/assets/img/gpt.png" alt="GPT Avatar">`;
15
+ let prompt_lock = false;
16
+
17
+ hljs.addPlugin(new CopyButtonPlugin());
18
+
19
+ message_input.addEventListener("blur", () => {
20
+ window.scrollTo(0, 0);
21
+ });
22
+
23
+ message_input.addEventListener("focus", () => {
24
+ document.documentElement.scrollTop = document.documentElement.scrollHeight;
25
+ });
26
+
27
+ const delete_conversations = async () => {
28
+ localStorage.clear();
29
+ await new_conversation();
30
+ };
31
+
32
+ const handle_ask = async () => {
33
+ message_input.style.height = `80px`;
34
+ window.scrollTo(0, 0);
35
+ let message = message_input.value;
36
+
37
+ if (message.length > 0) {
38
+ message_input.value = ``;
39
+ message_input.dispatchEvent(new Event("input"));
40
+ await ask_gpt(message);
41
+ }
42
+ };
43
+
44
+ const remove_cancel_button = async () => {
45
+ stop_generating.classList.add(`stop-generating-hiding`);
46
+
47
+ setTimeout(() => {
48
+ stop_generating.classList.remove(`stop-generating-hiding`);
49
+ stop_generating.classList.add(`stop-generating-hidden`);
50
+ }, 300);
51
+ };
52
+
53
+ const ask_gpt = async (message) => {
54
+ try {
55
+ message_input.value = ``;
56
+ message_input.innerHTML = ``;
57
+ message_input.innerText = ``;
58
+
59
+ add_conversation(window.conversation_id, message.substr(0, 16));
60
+ window.scrollTo(0, 0);
61
+ window.controller = new AbortController();
62
+
63
+ jailbreak = document.getElementById("jailbreak");
64
+ model = document.getElementById("model");
65
+ prompt_lock = true;
66
+ window.text = ``;
67
+ window.token = message_id();
68
+
69
+ stop_generating.classList.remove(`stop-generating-hidden`);
70
+
71
+ add_user_message_box(message);
72
+
73
+ message_box.scrollTop = message_box.scrollHeight;
74
+ window.scrollTo(0, 0);
75
+ await new Promise((r) => setTimeout(r, 500));
76
+ window.scrollTo(0, 0);
77
+
78
+ message_box.innerHTML += `
79
+ <div class="message">
80
+ <div class="avatar-container">
81
+ ${gpt_image}
82
+ </div>
83
+ <div class="content" id="gpt_${window.token}">
84
+ <div id="cursor"></div>
85
+ </div>
86
+ </div>
87
+ `;
88
+
89
+ message_box.scrollTop = message_box.scrollHeight;
90
+ window.scrollTo(0, 0);
91
+ await new Promise((r) => setTimeout(r, 1000));
92
+ window.scrollTo(0, 0);
93
+
94
+ const response = await fetch(`${url_prefix}/backend-api/v2/conversation`, {
95
+ method: `POST`,
96
+ signal: window.controller.signal,
97
+ headers: {
98
+ "content-type": `application/json`,
99
+ accept: `text/event-stream`,
100
+ },
101
+ body: JSON.stringify({
102
+ api_key: get_api_key_from_input(),
103
+ conversation_id: window.conversation_id,
104
+ action: `_ask`,
105
+ model: model.options[model.selectedIndex].value,
106
+ jailbreak: jailbreak.options[jailbreak.selectedIndex].value,
107
+ meta: {
108
+ id: window.token,
109
+ content: {
110
+ conversation: await get_conversation(window.conversation_id),
111
+ internet_access: document.getElementById("switch").checked,
112
+ content_type: "text",
113
+ parts: [
114
+ {
115
+ content: message,
116
+ role: "user",
117
+ },
118
+ ],
119
+ },
120
+ },
121
+ }),
122
+ });
123
+
124
+ const reader = response.body.getReader();
125
+
126
+ while (true) {
127
+ const { value, done } = await reader.read();
128
+ if (done) break;
129
+
130
+ chunk = decodeUnicode(new TextDecoder().decode(value));
131
+
132
+ if (
133
+ chunk.includes(`<form id="challenge-form" action="${url_prefix}/backend-api/v2/conversation?`)
134
+ ) {
135
+ chunk = `cloudflare token expired, please refresh the page.`;
136
+ }
137
+
138
+ text += chunk;
139
+
140
+ document.getElementById(`gpt_${window.token}`).innerHTML = markdown.render(text);
141
+ document.querySelectorAll(`code`).forEach((el) => {
142
+ hljs.highlightElement(el);
143
+ });
144
+
145
+ window.scrollTo(0, 0);
146
+ message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" });
147
+ }
148
+
149
+ // if text contains :
150
+ if (text.includes(`instead. Maintaining this website and API costs a lot of money`)) {
151
+ document.getElementById(`gpt_${window.token}`).innerHTML =
152
+ "An error occurred, please reload / refresh cache and try again.";
153
+ }
154
+
155
+ add_message(window.conversation_id, "user", message);
156
+ add_message(window.conversation_id, "assistant", text);
157
+
158
+ message_box.scrollTop = message_box.scrollHeight;
159
+ await remove_cancel_button();
160
+ prompt_lock = false;
161
+
162
+ await load_conversations(20, 0);
163
+ window.scrollTo(0, 0);
164
+ } catch (e) {
165
+ add_message(window.conversation_id, "user", message);
166
+
167
+ message_box.scrollTop = message_box.scrollHeight;
168
+ await remove_cancel_button();
169
+ prompt_lock = false;
170
+
171
+ await load_conversations(20, 0);
172
+
173
+ console.log(e);
174
+
175
+ let cursorDiv = document.getElementById(`cursor`);
176
+ if (cursorDiv) cursorDiv.parentNode.removeChild(cursorDiv);
177
+
178
+ if (e.name != `AbortError`) {
179
+ let error_message = `oops ! something went wrong, please try again / reload. [stacktrace in console]`;
180
+
181
+ document.getElementById(`gpt_${window.token}`).innerHTML = error_message;
182
+ add_message(window.conversation_id, "assistant", error_message);
183
+ } else {
184
+ document.getElementById(`gpt_${window.token}`).innerHTML += ` [aborted]`;
185
+ add_message(window.conversation_id, "assistant", text + ` [aborted]`);
186
+ }
187
+
188
+ window.scrollTo(0, 0);
189
+ }
190
+ };
191
+
192
+ const add_user_message_box = (message) => {
193
+ const messageDiv = createElement("div", { classNames: ["message"] });
194
+ const avatarContainer = createElement("div", { classNames: ["avatar-container"], innerHTML: user_image });
195
+ const contentDiv = createElement("div", {
196
+ classNames: ["content"],
197
+ id: `user_${token}`,
198
+ textContent: message,
199
+ });
200
+
201
+ messageDiv.append(avatarContainer, contentDiv);
202
+ message_box.appendChild(messageDiv);
203
+ };
204
+
205
+ const decodeUnicode = (str) => {
206
+ return str.replace(/\\u([a-fA-F0-9]{4})/g, function (match, grp) {
207
+ return String.fromCharCode(parseInt(grp, 16));
208
+ });
209
+ };
210
+
211
+ const clear_conversations = async () => {
212
+ const elements = box_conversations.childNodes;
213
+ let index = elements.length;
214
+
215
+ if (index > 0) {
216
+ while (index--) {
217
+ const element = elements[index];
218
+ if (element.nodeType === Node.ELEMENT_NODE && element.tagName.toLowerCase() !== `button`) {
219
+ box_conversations.removeChild(element);
220
+ }
221
+ }
222
+ }
223
+ };
224
+
225
+ const clear_conversation = async () => {
226
+ let messages = message_box.getElementsByTagName(`div`);
227
+
228
+ while (messages.length > 0) {
229
+ message_box.removeChild(messages[0]);
230
+ }
231
+ };
232
+
233
+ const delete_conversation = async (conversation_id) => {
234
+ localStorage.removeItem(`conversation:${conversation_id}`);
235
+
236
+ if (window.conversation_id == conversation_id) {
237
+ await new_conversation();
238
+ }
239
+
240
+ await load_conversations(20, 0, true);
241
+ };
242
+
243
+ const set_conversation = async (conversation_id) => {
244
+ history.pushState({}, null, `${url_prefix}/chat/${conversation_id}`);
245
+ window.conversation_id = conversation_id;
246
+
247
+ await clear_conversation();
248
+ await load_conversation(conversation_id);
249
+ await load_conversations(20, 0, true);
250
+ };
251
+
252
+ const new_conversation = async () => {
253
+ history.pushState({}, null, `${url_prefix}/chat/`);
254
+ window.conversation_id = uuid();
255
+
256
+ await clear_conversation();
257
+ await load_conversations(20, 0, true);
258
+ };
259
+
260
+ const load_conversation = async (conversation_id) => {
261
+ let conversation = await JSON.parse(localStorage.getItem(`conversation:${conversation_id}`));
262
+ console.log(conversation, conversation_id);
263
+
264
+ for (item of conversation.items) {
265
+ if (is_assistant(item.role)) {
266
+ message_box.innerHTML += load_gpt_message_box(item.content);
267
+ } else {
268
+ message_box.innerHTML += load_user_message_box(item.content);
269
+ }
270
+ }
271
+
272
+ document.querySelectorAll(`code`).forEach((el) => {
273
+ hljs.highlightElement(el);
274
+ });
275
+
276
+ message_box.scrollTo({ top: message_box.scrollHeight, behavior: "smooth" });
277
+
278
+ setTimeout(() => {
279
+ message_box.scrollTop = message_box.scrollHeight;
280
+ }, 500);
281
+ };
282
+
283
+ const load_user_message_box = (content) => {
284
+ const messageDiv = createElement("div", { classNames: ["message"] });
285
+ const avatarContainer = createElement("div", { classNames: ["avatar-container"], innerHTML: user_image });
286
+ const contentDiv = createElement("div", { classNames: ["content"] });
287
+ const preElement = document.createElement("pre");
288
+ preElement.textContent = content;
289
+ contentDiv.appendChild(preElement);
290
+
291
+ messageDiv.append(avatarContainer, contentDiv);
292
+
293
+ return messageDiv.outerHTML;
294
+ };
295
+
296
+ const load_gpt_message_box = (content) => {
297
+ return `
298
+ <div class="message">
299
+ <div class="avatar-container">
300
+ ${gpt_image}
301
+ </div>
302
+ <div class="content">
303
+ ${markdown.render(content)}
304
+ </div>
305
+ </div>
306
+ `;
307
+ };
308
+
309
+ const is_assistant = (role) => {
310
+ return role == "assistant";
311
+ };
312
+
313
+ const get_conversation = async (conversation_id) => {
314
+ let conversation = await JSON.parse(localStorage.getItem(`conversation:${conversation_id}`));
315
+ return conversation.items;
316
+ };
317
+
318
+ const add_conversation = async (conversation_id, title) => {
319
+ if (localStorage.getItem(`conversation:${conversation_id}`) == null) {
320
+ localStorage.setItem(
321
+ `conversation:${conversation_id}`,
322
+ JSON.stringify({
323
+ id: conversation_id,
324
+ title: title,
325
+ items: [],
326
+ })
327
+ );
328
+ }
329
+ };
330
+
331
+ const add_message = async (conversation_id, role, content) => {
332
+ before_adding = JSON.parse(localStorage.getItem(`conversation:${conversation_id}`));
333
+
334
+ before_adding.items.push({
335
+ role: role,
336
+ content: content,
337
+ });
338
+
339
+ localStorage.setItem(`conversation:${conversation_id}`, JSON.stringify(before_adding)); // update conversation
340
+ };
341
+
342
+ const load_conversations = async (limit, offset, loader) => {
343
+ //console.log(loader);
344
+ //if (loader === undefined) box_conversations.appendChild(spinner);
345
+
346
+ let conversations = [];
347
+ for (let i = 0; i < localStorage.length; i++) {
348
+ if (localStorage.key(i).startsWith("conversation:")) {
349
+ let conversation = localStorage.getItem(localStorage.key(i));
350
+ conversations.push(JSON.parse(conversation));
351
+ }
352
+ }
353
+
354
+ //if (loader === undefined) spinner.parentNode.removeChild(spinner)
355
+ await clear_conversations();
356
+
357
+ for (conversation of conversations) {
358
+ box_conversations.innerHTML += `
359
+ <div class="conversation-sidebar">
360
+ <div class="left" onclick="set_conversation('${conversation.id}')">
361
+ <i class="fa-regular fa-comments"></i>
362
+ <span class="conversation-title">${conversation.title}</span>
363
+ </div>
364
+ <i onclick="delete_conversation('${conversation.id}')" class="fa-regular fa-trash"></i>
365
+ </div>
366
+ `;
367
+ }
368
+
369
+ document.querySelectorAll(`code`).forEach((el) => {
370
+ hljs.highlightElement(el);
371
+ });
372
+ };
373
+
374
+ document.getElementById(`cancelButton`).addEventListener(`click`, async () => {
375
+ window.controller.abort();
376
+ console.log(`aborted ${window.conversation_id}`);
377
+ });
378
+
379
+ function h2a(str1) {
380
+ var hex = str1.toString();
381
+ var str = "";
382
+
383
+ for (var n = 0; n < hex.length; n += 2) {
384
+ str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
385
+ }
386
+
387
+ return str;
388
+ }
389
+
390
+ const uuid = () => {
391
+ return `xxxxxxxx-xxxx-4xxx-yxxx-${Date.now().toString(16)}`.replace(/[xy]/g, function (c) {
392
+ var r = (Math.random() * 16) | 0,
393
+ v = c == "x" ? r : (r & 0x3) | 0x8;
394
+ return v.toString(16);
395
+ });
396
+ };
397
+
398
+ const message_id = () => {
399
+ random_bytes = (Math.floor(Math.random() * 1338377565) + 2956589730).toString(2);
400
+ unix = Math.floor(Date.now() / 1000).toString(2);
401
+
402
+ return BigInt(`0b${unix}${random_bytes}`).toString();
403
+ };
404
+
405
+ window.onload = async () => {
406
+ load_settings_localstorage();
407
+
408
+ conversations = 0;
409
+ for (let i = 0; i < localStorage.length; i++) {
410
+ if (localStorage.key(i).startsWith("conversation:")) {
411
+ conversations += 1;
412
+ }
413
+ }
414
+
415
+ if (conversations == 0) localStorage.clear();
416
+
417
+ await setTimeout(() => {
418
+ load_conversations(20, 0);
419
+ }, 1);
420
+
421
+ if (!window.location.href.endsWith(`#`)) {
422
+ if (/\/chat\/.+/.test(window.location.href.slice(url_prefix.length))) {
423
+ await load_conversation(window.conversation_id);
424
+ }
425
+ }
426
+
427
+ message_input.addEventListener("keydown", async (evt) => {
428
+ if (prompt_lock) return;
429
+
430
+ if (evt.key === "Enter" && !evt.shiftKey) {
431
+ evt.preventDefault();
432
+ await handle_ask();
433
+ }
434
+ });
435
+
436
+ send_button.addEventListener("click", async (event) => {
437
+ event.preventDefault();
438
+ if (prompt_lock) return;
439
+ message_input.blur();
440
+ await handle_ask();
441
+ });
442
+
443
+ register_settings_localstorage();
444
+ };
445
+
446
+ const register_settings_localstorage = async () => {
447
+ settings_ids = ["switch", "model", "jailbreak"];
448
+ settings_elements = settings_ids.map((id) => document.getElementById(id));
449
+ settings_elements.map((element) =>
450
+ element.addEventListener(`change`, async (event) => {
451
+ switch (event.target.type) {
452
+ case "checkbox":
453
+ localStorage.setItem(event.target.id, event.target.checked);
454
+ break;
455
+ case "select-one":
456
+ localStorage.setItem(event.target.id, event.target.selectedIndex);
457
+ break;
458
+ default:
459
+ console.warn("Unresolved element type");
460
+ }
461
+ })
462
+ );
463
+ };
464
+
465
+ const load_settings_localstorage = async () => {
466
+ settings_ids = ["switch", "model", "jailbreak"];
467
+ settings_elements = settings_ids.map((id) => document.getElementById(id));
468
+ settings_elements.map((element) => {
469
+ if (localStorage.getItem(element.id)) {
470
+ switch (element.type) {
471
+ case "checkbox":
472
+ element.checked = localStorage.getItem(element.id) === "true";
473
+ break;
474
+ case "select-one":
475
+ element.selectedIndex = parseInt(localStorage.getItem(element.id));
476
+ break;
477
+ default:
478
+ console.warn("Unresolved element type");
479
+ }
480
+ }
481
+ });
482
+ };
483
+
484
+ function clearTextarea(textarea) {
485
+ textarea.style.removeProperty("height");
486
+ textarea.style.height = `${textarea.scrollHeight + 4}px`;
487
+ if (textarea.value.trim() === "" && textarea.value.includes("\n")) {
488
+ textarea.value = "";
489
+ }
490
+ }
491
+
492
+ function createElement(tag, { classNames, id, innerHTML, textContent } = {}) {
493
+ const el = document.createElement(tag);
494
+ if (classNames) {
495
+ el.classList.add(...classNames);
496
+ }
497
+ if (id) {
498
+ el.id = id;
499
+ }
500
+ if (innerHTML) {
501
+ el.innerHTML = innerHTML;
502
+ }
503
+ if (textContent) {
504
+ const preElement = document.createElement("pre");
505
+ preElement.textContent = textContent;
506
+ el.appendChild(preElement);
507
+ }
508
+ return el;
509
+ }
client/js/highlight.min.js ADDED
The diff for this file is too large to render. See raw diff
 
client/js/highlightjs-copy.min.js ADDED
@@ -0,0 +1 @@
 
 
1
+ class CopyButtonPlugin{constructor(options={}){self.hook=options.hook;self.callback=options.callback}"after:highlightElement"({el,text}){let button=Object.assign(document.createElement("button"),{innerHTML:"Copy",className:"hljs-copy-button"});button.dataset.copied=false;el.parentElement.classList.add("hljs-copy-wrapper");el.parentElement.appendChild(button);el.parentElement.style.setProperty("--hljs-theme-background",window.getComputedStyle(el).backgroundColor);button.onclick=function(){if(!navigator.clipboard)return;let newText=text;if(hook&&typeof hook==="function"){newText=hook(text,el)||text}navigator.clipboard.writeText(newText).then(function(){button.innerHTML="Copied!";button.dataset.copied=true;let alert=Object.assign(document.createElement("div"),{role:"status",className:"hljs-copy-alert",innerHTML:"Copied to clipboard"});el.parentElement.appendChild(alert);setTimeout(()=>{button.innerHTML="Copy";button.dataset.copied=false;el.parentElement.removeChild(alert);alert=null},2e3)}).then(function(){if(typeof callback==="function")return callback(newText,el)})}}}
client/js/icons.js ADDED
@@ -0,0 +1 @@
 
 
1
+ window.FontAwesomeKitConfig={asyncLoading:{enabled:!1},autoA11y:{enabled:!0},baseUrl:"https://ka-f.fontawesome.com",baseUrlKit:"https://kit-pro.fontawesome.com",detectConflictsUntil:null,iconUploads:{},id:96462084,license:"pro",method:"css",minify:{enabled:!0},token:"d0514f1901",v4FontFaceShim:{enabled:!0},v4shim:{enabled:!0},v5FontFaceShim:{enabled:!0},version:"6.1.1"},function(t){"function"==typeof define&&define.amd?define("kit-loader",t):t()}(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function o(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach(function(n){e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],o=!0,r=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(o=(c=a.next()).done)&&(n.push(c.value),!e||n.length!==e);o=!0);}catch(t){r=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(r)throw i}}return n}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function c(t,e){var n=e&&e.addOn||"",o=e&&e.baseFilename||t.license+n,r=e&&e.minify?".min":"",i=e&&e.fileSuffix||t.method,c=e&&e.subdir||t.method;return t.baseUrl+"/releases/"+("latest"===t.version?"latest":"v".concat(t.version))+"/"+c+"/"+o+r+"."+i}function a(t,e){var n=e||["fa"],o="."+Array.prototype.join.call(n,",."),r=t.querySelectorAll(o);Array.prototype.forEach.call(r,function(e){var n=e.getAttribute("title");e.setAttribute("aria-hidden","true");var o=!e.nextElementSibling||!e.nextElementSibling.classList.contains("sr-only");if(n&&o){var r=t.createElement("span");r.innerHTML=n,r.classList.add("sr-only"),e.parentNode.insertBefore(r,e.nextSibling)}})}var u,f=function(){},s="undefined"!=typeof global&&void 0!==global.process&&"function"==typeof global.process.emit,d="undefined"==typeof setImmediate?setTimeout:setImmediate,l=[];function h(){for(var t=0;t<l.length;t++)l[t][0](l[t][1]);l=[],u=!1}function m(t,e){l.push([t,e]),u||(u=!0,d(h,0))}function p(t){var e=t.owner,n=e._state,o=e._data,r=t[n],i=t.then;if("function"==typeof r){n="fulfilled";try{o=r(o)}catch(t){g(i,t)}}v(i,o)||("fulfilled"===n&&b(i,o),"rejected"===n&&g(i,o))}function v(e,n){var o;try{if(e===n)throw new TypeError("A promises callback cannot return that same promise.");if(n&&("function"==typeof n||"object"===t(n))){var r=n.then;if("function"==typeof r)return r.call(n,function(t){o||(o=!0,n===t?y(e,t):b(e,t))},function(t){o||(o=!0,g(e,t))}),!0}}catch(t){return o||g(e,t),!0}return!1}function b(t,e){t!==e&&v(t,e)||y(t,e)}function y(t,e){"pending"===t._state&&(t._state="settled",t._data=e,m(A,t))}function g(t,e){"pending"===t._state&&(t._state="settled",t._data=e,m(S,t))}function w(t){t._then=t._then.forEach(p)}function A(t){t._state="fulfilled",w(t)}function S(t){t._state="rejected",w(t),!t._handled&&s&&global.process.emit("unhandledRejection",t._data,t)}function O(t){global.process.emit("rejectionHandled",t)}function j(t){if("function"!=typeof t)throw new TypeError("Promise resolver "+t+" is not a function");if(this instanceof j==0)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._then=[],function(t,e){function n(t){g(e,t)}try{t(function(t){b(e,t)},n)}catch(t){n(t)}}(t,this)}j.prototype={constructor:j,_state:"pending",_then:null,_data:void 0,_handled:!1,then:function(t,e){var n={owner:this,then:new this.constructor(f),fulfilled:t,rejected:e};return!e&&!t||this._handled||(this._handled=!0,"rejected"===this._state&&s&&m(O,this)),"fulfilled"===this._state||"rejected"===this._state?m(p,n):this._then.push(n),n.then},catch:function(t){return this.then(null,t)}},j.all=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.all().");return new j(function(e,n){var o=[],r=0;function i(t){return r++,function(n){o[t]=n,--r||e(o)}}for(var c,a=0;a<t.length;a++)(c=t[a])&&"function"==typeof c.then?c.then(i(a),n):o[a]=c;r||e(o)})},j.race=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.race().");return new j(function(e,n){for(var o,r=0;r<t.length;r++)(o=t[r])&&"function"==typeof o.then?o.then(e,n):e(o)})},j.resolve=function(e){return e&&"object"===t(e)&&e.constructor===j?e:new j(function(t){t(e)})},j.reject=function(t){return new j(function(e,n){n(t)})};var F="function"==typeof Promise?Promise:j;function E(t,e){var n=e.fetch,o=e.XMLHttpRequest,r=e.token,i=t;return"URLSearchParams"in window?(i=new URL(t)).searchParams.set("token",r):i=i+"?token="+encodeURIComponent(r),i=i.toString(),new F(function(t,e){if("function"==typeof n)n(i,{mode:"cors",cache:"default"}).then(function(t){if(t.ok)return t.text();throw new Error("")}).then(function(e){t(e)}).catch(e);else if("function"==typeof o){var r=new o;r.addEventListener("loadend",function(){this.responseText?t(this.responseText):e(new Error(""))}),["abort","error","timeout"].map(function(t){r.addEventListener(t,function(){e(new Error(""))})}),r.open("GET",i),r.send()}else e(new Error(""))})}function _(t,e,n){var o=t;return[[/(url\("?)\.\.\/\.\.\/\.\./g,function(t,n){return"".concat(n).concat(e)}],[/(url\("?)\.\.\/webfonts/g,function(t,o){return"".concat(o).concat(e,"/releases/v").concat(n,"/webfonts")}],[/(url\("?)https:\/\/kit-free([^.])*\.fontawesome\.com/g,function(t,n){return"".concat(n).concat(e)}]].forEach(function(t){var e=r(t,2),n=e[0],i=e[1];o=o.replace(n,i)}),o}function C(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=e.document||r,i=a.bind(a,r,["fa","fab","fas","far","fal","fad","fak"]),u=Object.keys(t.iconUploads||{}).length>0;t.autoA11y.enabled&&n(i);var f=[{id:"fa-main",addOn:void 0}];t.v4shim&&t.v4shim.enabled&&f.push({id:"fa-v4-shims",addOn:"-v4-shims"}),t.v5FontFaceShim&&t.v5FontFaceShim.enabled&&f.push({id:"fa-v5-font-face",addOn:"-v5-font-face"}),t.v4FontFaceShim&&t.v4FontFaceShim.enabled&&f.push({id:"fa-v4-font-face",addOn:"-v4-font-face"}),u&&f.push({id:"fa-kit-upload",customCss:!0});var s=f.map(function(n){return new F(function(r,i){E(n.customCss?function(t){return t.baseUrlKit+"/"+t.token+"/"+t.id+"/kit-upload.css"}(t):c(t,{addOn:n.addOn,minify:t.minify.enabled}),e).then(function(i){r(function(t,e){var n=e.contentFilter||function(t,e){return t},o=document.createElement("style"),r=document.createTextNode(n(t,e));return o.appendChild(r),o.media="all",e.id&&o.setAttribute("id",e.id),e&&e.detectingConflicts&&e.detectionIgnoreAttr&&o.setAttributeNode(document.createAttribute(e.detectionIgnoreAttr)),o}(i,o(o({},e),{},{baseUrl:t.baseUrl,version:t.version,id:n.id,contentFilter:function(t,e){return _(t,e.baseUrl,e.version)}})))}).catch(i)})});return F.all(s)}function P(t,e){var n=document.createElement("SCRIPT"),o=document.createTextNode(t);return n.appendChild(o),n.referrerPolicy="strict-origin",e.id&&n.setAttribute("id",e.id),e&&e.detectingConflicts&&e.detectionIgnoreAttr&&n.setAttributeNode(document.createAttribute(e.detectionIgnoreAttr)),n}function U(t){var e,n=[],o=document,r=(o.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(o.readyState);r||o.addEventListener("DOMContentLoaded",e=function(){for(o.removeEventListener("DOMContentLoaded",e),r=1;e=n.shift();)e()}),r?setTimeout(t,0):n.push(t)}try{if(window.FontAwesomeKitConfig){var k=window.FontAwesomeKitConfig,L={detectingConflicts:k.detectConflictsUntil&&new Date<=new Date(k.detectConflictsUntil),detectionIgnoreAttr:"data-fa-detection-ignore",fetch:window.fetch,token:k.token,XMLHttpRequest:window.XMLHttpRequest,document:document},I=document.currentScript,T=I?I.parentElement:document.head;(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"js"===t.method?function(t,e){e.autoA11y=t.autoA11y.enabled,"pro"===t.license&&(e.autoFetchSvg=!0,e.fetchSvgFrom=t.baseUrl+"/releases/"+("latest"===t.version?"latest":"v".concat(t.version))+"/svgs",e.fetchUploadedSvgFrom=t.uploadsUrl);var n=[];return t.v4shim.enabled&&n.push(new F(function(n,r){E(c(t,{addOn:"-v4-shims",minify:t.minify.enabled}),e).then(function(t){n(P(t,o(o({},e),{},{id:"fa-v4-shims"})))}).catch(r)})),n.push(new F(function(n,r){E(c(t,{minify:t.minify.enabled}),e).then(function(t){var r=P(t,o(o({},e),{},{id:"fa-main"}));n(function(t,e){var n=e&&void 0!==e.autoFetchSvg?e.autoFetchSvg:void 0,o=e&&void 0!==e.autoA11y?e.autoA11y:void 0;return void 0!==o&&t.setAttribute("data-auto-a11y",o?"true":"false"),n&&(t.setAttributeNode(document.createAttribute("data-auto-fetch-svg")),t.setAttribute("data-fetch-svg-from",e.fetchSvgFrom),t.setAttribute("data-fetch-uploaded-svg-from",e.fetchUploadedSvgFrom)),t}(r,e))}).catch(r)})),F.all(n)}(t,e):"css"===t.method?C(t,e,function(t){U(t),function(t){"undefined"!=typeof MutationObserver&&new MutationObserver(t).observe(document,{childList:!0,subtree:!0})}(t)}):void 0})(k,L).then(function(t){t.map(function(t){try{T.insertBefore(t,I?I.nextSibling:null)}catch(e){T.appendChild(t)}}),L.detectingConflicts&&I&&U(function(){I.setAttributeNode(document.createAttribute(L.detectionIgnoreAttr));var t=function(t,e){var n=document.createElement("script");return e&&e.detectionIgnoreAttr&&n.setAttributeNode(document.createAttribute(e.detectionIgnoreAttr)),n.src=c(t,{baseFilename:"conflict-detection",fileSuffix:"js",subdir:"js",minify:t.minify.enabled}),n}(k,L);document.body.appendChild(t)})}).catch(function(t){console.error("".concat("Font Awesome Kit:"," ").concat(t))})}}catch(t){console.error("".concat("Font Awesome Kit:"," ").concat(t))}});
client/js/sidebar-toggler.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const sidebar = document.querySelector(".sidebar");
2
+ const menuButton = document.querySelector(".menu-button");
3
+
4
+ function toggleSidebar(event) {
5
+ if (sidebar.classList.contains("shown")) {
6
+ hideSidebar(event.target);
7
+ } else {
8
+ showSidebar(event.target);
9
+ }
10
+ window.scrollTo(0, 0);
11
+ }
12
+
13
+ function showSidebar(target) {
14
+ sidebar.classList.add("shown");
15
+ target.classList.add("rotated");
16
+ document.body.style.overflow = "hidden";
17
+ }
18
+
19
+ function hideSidebar(target) {
20
+ sidebar.classList.remove("shown");
21
+ target.classList.remove("rotated");
22
+ document.body.style.overflow = "auto";
23
+ }
24
+
25
+ menuButton.addEventListener("click", toggleSidebar);
26
+
27
+ document.body.addEventListener('click', function(event) {
28
+ if (event.target.matches('.conversation-title')) {
29
+ const menuButtonStyle = window.getComputedStyle(menuButton);
30
+ if (menuButtonStyle.display !== 'none') {
31
+ hideSidebar(menuButton);
32
+ }
33
+ }
34
+ });
client/js/theme-toggler.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var switch_theme_toggler = document.getElementById("theme-toggler");
2
+
3
+ switch_theme_toggler.addEventListener("change", toggleTheme);
4
+
5
+ function setTheme(themeName) {
6
+ localStorage.setItem("theme", themeName);
7
+ document.documentElement.className = themeName;
8
+ }
9
+
10
+ function toggleTheme() {
11
+ var currentTheme = localStorage.getItem("theme");
12
+ var newTheme = currentTheme === "theme-dark" ? "theme-light" : "theme-dark";
13
+
14
+ setTheme(newTheme);
15
+ switch_theme_toggler.checked = newTheme === "theme-dark";
16
+ }
17
+
18
+ (function () {
19
+ var currentTheme = localStorage.getItem("theme") || "theme-dark";
20
+ setTheme(currentTheme);
21
+ switch_theme_toggler.checked = currentTheme === "theme-dark";
22
+ })();