Fernando22 monra commited on
Commit
29a2592
·
0 Parent(s):

Duplicate from monra/freegpt-webui

Browse files

Co-authored-by: Ramon Cardoso <[email protected]>

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. .github/workflows/check-file-size.yml +16 -0
  3. .github/workflows/docker-build-push.yml +33 -0
  4. .github/workflows/sync-to-huggingface.yml +20 -0
  5. .gitignore +157 -0
  6. Dockerfile +18 -0
  7. LICENSE +674 -0
  8. README.md +195 -0
  9. babel.cfg +2 -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 +70 -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 +18 -0
  28. client/css/theme-toggler.css +33 -0
  29. client/css/typing.css +15 -0
  30. client/html/index.html +135 -0
  31. client/img/android-chrome-192x192.png +0 -0
  32. client/img/android-chrome-512x512.png +0 -0
  33. client/img/apple-touch-icon.png +0 -0
  34. client/img/favicon-16x16.png +0 -0
  35. client/img/favicon-32x32.png +0 -0
  36. client/img/favicon.ico +0 -0
  37. client/img/gpt.png +0 -0
  38. client/img/site.webmanifest +19 -0
  39. client/img/user.png +0 -0
  40. client/js/change-language.js +47 -0
  41. client/js/chat.js +508 -0
  42. client/js/highlight.min.js +0 -0
  43. client/js/highlightjs-copy.min.js +1 -0
  44. client/js/icons.js +1 -0
  45. client/js/sidebar-toggler.js +34 -0
  46. client/js/theme-toggler.js +22 -0
  47. config.json +8 -0
  48. docker-compose.yml +11 -0
  49. g4f/Provider/Provider.py +16 -0
  50. g4f/Provider/Providers/AiService.py +40 -0
.gitattributes ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
.github/workflows/check-file-size.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/[email protected]
15
+ with:
16
+ filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
.github/workflows/docker-build-push.yml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Docker Build and Push
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ jobs:
7
+ build-and-push:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+
11
+ - name: Checkout code
12
+ uses: actions/checkout@v2
13
+
14
+ - name: Set up QEMU - Support for more platforms
15
+ uses: docker/setup-qemu-action@v2
16
+
17
+ - name: Set up Docker Buildx
18
+ uses: docker/setup-buildx-action@v2
19
+
20
+ - name: Login to Docker Hub
21
+ uses: docker/login-action@v1
22
+ with:
23
+ username: ${{ secrets.DOCKER_USERNAME }}
24
+ password: ${{ secrets.DOCKER_PASSWORD }}
25
+
26
+ - name: Build and push Docker image
27
+ uses: docker/build-push-action@v2
28
+ with:
29
+ context: .
30
+ file: Dockerfile
31
+ platforms: linux/amd64,linux/arm64
32
+ push: true
33
+ tags: ${{ secrets.DOCKER_USERNAME }}/freegpt-webui:latest
.github/workflows/sync-to-huggingface.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face hub
2
+ on:
3
+ push:
4
+ branches: [huggingface-space]
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
+ - uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
16
+ lfs: true
17
+ - name: Push to hub
18
+ env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ run: git push https://monra:[email protected]/spaces/monra/freegpt-webui huggingface-space:main
.gitignore ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105
+ __pypackages__/
106
+
107
+ # Celery stuff
108
+ celerybeat-schedule
109
+ celerybeat.pid
110
+
111
+ # SageMath parsed files
112
+ *.sage.py
113
+
114
+ # Environments
115
+ .env
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # others
148
+ .config/
149
+ .upm/
150
+ .vscode/
151
+
152
+ # PyCharm
153
+ # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
154
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
155
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
156
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
157
+ #.idea/
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
14
+ COPY . .
15
+
16
+ RUN chmod -R 777 translations
17
+
18
+ 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,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: FreeGPT WebUI
3
+ emoji: 🚀
4
+ colorFrom: blue
5
+ colorTo: yellow
6
+ sdk: docker
7
+ sdk_version: 1.24.0
8
+ app_file: run.py
9
+ pinned: true
10
+ app_port: 1338
11
+ duplicated_from: monra/freegpt-webui
12
+ ---
13
+
14
+ # FreeGPT WebUI
15
+ ## GPT 3.5/4
16
+
17
+ <strong>NOT REQUIRE ANY API KEY</strong> ❌🔑
18
+
19
+ This project features a WebUI utilizing the [G4F API](https://github.com/xtekky/gpt4free). <br>
20
+ Experience the power of ChatGPT with a user-friendly interface, enhanced jailbreaks, and completely free.
21
+
22
+ ## Known bugs 🚧
23
+ - Stream mode not working properly.
24
+
25
+ ## News 📢
26
+ I have created a new version of FreeGPT WebUI using the [ChimeraGPT API](https://chimeragpt.adventblocks.cc/).
27
+ <br>
28
+ <br>
29
+ This free API allows you to use various AI chat models, including <strong>GPT-4, GPT-4-32k, Claude-2, Claude-2-100k, and more.</strong> <br>
30
+ Check out the project here: [FreeGPT WebUI - Chimera Version](https://github.com/ramonvc/freegpt-webui/tree/chimeragpt-version).
31
+
32
+ ## Project Hosting and Demonstration 🌐🚀
33
+ The project is hosted on multiple platforms to be tested and modified.
34
+ |Plataform|Status|API Key|Free|Repo|Demo|
35
+ |--|--|--|--|--|--|
36
+ |[replit](https://replit.com/)|![Active](https://img.shields.io/badge/Active-brightgreen)|◼️|☑️|[FreeGPT WebUI](https://replit.com/@ramonvc/freegpt-webui)|[Chat](https://freegpt-webui.ramonvc.repl.co/chat/)
37
+ |[hugging face](https://huggingface.co)|![Active](https://img.shields.io/badge/Active-brightgreen)|◼️|☑️|[FreeGPT WebUI](https://huggingface.co/spaces/monra/freegpt-webui/tree/main)|[Chat](https://huggingface.co/spaces/monra/freegpt-webui)
38
+ |[replit](https://replit.com/)|![Active](https://img.shields.io/badge/Active-brightgreen)|☑️|☑️|[FreeGPT WebUI - Chimera Version](https://replit.com/@ramonvc/freegpt-webui-chimera)|[Chat](https://freegpt-webui-chimera.ramonvc.repl.co/chat/)
39
+
40
+ ## Note ℹ️
41
+ <p>
42
+ FreeGPT is a project that utilizes various free AI conversation API Providers. Each Provider is an API that provides responses generated by different AI models. The source code related to these services is available in <a href="https://github.com/ramonvc/freegpt-webui/tree/main/g4f">G4F folder</a>.
43
+
44
+ It is important to note that, due to the extensive reach of this project, the free services registered here may receive a significant number of requests, which can result in temporary unavailability or access limitations. Therefore, it is common to encounter these services being offline or unstable.
45
+
46
+ We recommend that you search for your own Providers and add them to your personal projects to avoid service instability and unavailability. Within the project, in the <a href="https://github.com/ramonvc/freegpt-webui/tree/main/g4f/Provider/Providers">Providers folder</a>, you will find several examples of Providers that have worked in the past or are still functioning. It is easy to follow the logic of these examples to find free GPT services and incorporate the requests into your specific FreeGPT project.
47
+
48
+ Please note that the choice and integration of additional Providers are the user's responsibility and are not directly related to the FreeGPT project, as the project serves as an example of how to combine the <a href="https://github.com/xtekky/gpt4free">G4F API</a> with a web interface.
49
+ </p>
50
+
51
+ ## Table of Contents
52
+ - [To-Do List](#to-do-list-%EF%B8%8F)
53
+ - [Getting Started](#getting-started-white_check_mark)
54
+ - [Cloning the Repository](#cloning-the-repository-inbox_tray)
55
+ - [Install Dependencies](#install-dependencies-wrench)
56
+ - [Running the Application](#running-the-application-rocket)
57
+ - [Docker](#docker-)
58
+ - [Prerequisites](#prerequisites)
59
+ - [Running the Docker](#running-the-docker)
60
+ - [Incorporated Projects](#incorporated-projects-busts_in_silhouette)
61
+ - [WebUI](#webui)
62
+ - [API FreeGPT](#api-g4f)
63
+ - [Star History](#star-history)
64
+ - [Legal Notice](#legal-notice)
65
+
66
+ ##
67
+
68
+ ## To-Do List ✔️
69
+
70
+ - [x] Integrate the free GPT API into the WebUI
71
+ - [x] Create Docker support
72
+ - [x] Improve the Jailbreak functionality
73
+ - [x] Add the GPT-4 model
74
+ - [x] Enhance the user interface
75
+ - [ ] Check status of API Providers (online/offline)
76
+ - [ ] Enable editing and creating Jailbreaks/Roles in the WebUI
77
+ - [ ] Refactor web client
78
+
79
+ ## Getting Started :white_check_mark:
80
+ To get started with this project, you'll need to clone the repository and have [Python](https://www.python.org/downloads/) installed on your system.
81
+
82
+ ### Cloning the Repository :inbox_tray:
83
+ Run the following command to clone the repository:
84
+
85
+ ```
86
+ git clone https://github.com/ramonvc/freegpt-webui.git
87
+ ```
88
+
89
+ ### Install Dependencies :wrench:
90
+ Navigate to the project directory:
91
+ ```
92
+ cd freegpt-webui
93
+ ```
94
+
95
+ Install the dependencies:
96
+ ```
97
+ pip install -r requirements.txt
98
+ ```
99
+ ## Running the Application :rocket:
100
+ To run the application, run the following command:
101
+ ```
102
+ python run.py
103
+ ```
104
+
105
+ Access the application in your browser using the URL:
106
+ ```
107
+ http://127.0.0.1:1338
108
+ ```
109
+ or
110
+ ```
111
+ http://localhost:1338
112
+ ```
113
+
114
+
115
+ ## Docker 🐳
116
+ ### Prerequisites
117
+ Before you start, make sure you have installed [Docker](https://www.docker.com/get-started) on your machine.
118
+
119
+ ### Running the Docker
120
+ Pull the Docker image from Docker Hub:
121
+ ```
122
+ docker pull ramonvc/freegpt-webui
123
+ ```
124
+
125
+ Run the application using Docker:
126
+ ```
127
+ docker run -p 1338:1338 ramonvc/freegpt-webui
128
+ ```
129
+
130
+ Access the application in your browser using the URL:
131
+ ```
132
+ http://127.0.0.1:1338
133
+ ```
134
+ or
135
+ ```
136
+ http://localhost:1338
137
+ ```
138
+
139
+ When you're done using the application, stop the Docker containers using the following command:
140
+ ```
141
+ docker stop <container-id>
142
+ ```
143
+
144
+ ## Incorporated Projects :busts_in_silhouette:
145
+ I highly recommend visiting and supporting both projects.
146
+
147
+ ### WebUI
148
+ The application interface was incorporated from the [chatgpt-clone](https://github.com/xtekky/chatgpt-clone) repository.
149
+
150
+ ### API G4F
151
+ The free GPT-4 API was incorporated from the [GPT4Free](https://github.com/xtekky/gpt4free) repository.
152
+
153
+ <br>
154
+
155
+ ## Star History
156
+ [![Star History Chart](https://api.star-history.com/svg?repos=ramonvc/freegpt-webui&type=Timeline)](https://star-history.com/#ramonvc/freegpt-webui&Timeline)
157
+
158
+ <br>
159
+
160
+ ## Legal Notice
161
+ This repository is _not_ associated with or endorsed by providers of the APIs contained in this GitHub repository. This
162
+ project is intended **for educational purposes only**. This is just a little personal project. Sites may contact me to
163
+ improve their security or request the removal of their site from this repository.
164
+
165
+ Please note the following:
166
+
167
+ 1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners.
168
+ This project is _not_ claiming any right over them nor is it affiliated with or endorsed by any of the providers
169
+ mentioned.
170
+
171
+ 2. **Responsibility**: The author of this repository is _not_ responsible for any consequences, damages, or losses
172
+ arising from the use or misuse of this repository or the content provided by the third-party APIs. Users are solely
173
+ responsible for their actions and any repercussions that may follow. We strongly recommend the users to follow the
174
+ TOS of the each Website.
175
+
176
+ 3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By
177
+ using the information and code provided, users acknowledge that they are using the APIs and models at their own risk
178
+ and agree to comply with any applicable laws and regulations.
179
+
180
+ 4. **Copyright**: All content in this repository, including but not limited to code, images, and documentation, is the
181
+ intellectual property of the repository author, unless otherwise stated. Unauthorized copying, distribution, or use
182
+ of any content in this repository is strictly prohibited without the express written consent of the repository
183
+ author.
184
+
185
+ 5. **Indemnification**: Users agree to indemnify, defend, and hold harmless the author of this repository from and
186
+ against any and all claims, liabilities, damages, losses, or expenses, including legal fees and costs, arising out of
187
+ or in any way connected with their use or misuse of this repository, its content, or related third-party APIs.
188
+
189
+ 6. **Updates and Changes**: The author reserves the right to modify, update, or remove any content, information, or
190
+ features in this repository at any time without prior notice. Users are responsible for regularly reviewing the
191
+ content and any changes made to this repository.
192
+
193
+ By using this repository or any code related to it, you agree to these terms. The author is not responsible for any
194
+ copies, forks, or reuploads made by other users. This is the author's only account and repository. To prevent
195
+ impersonation or irresponsible actions, you may comply with the GNU GPL license this Repository uses.
babel.cfg ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [python: **/server/.py]
2
+ [jinja2: **/client/html/**.html]
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,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ pre {
63
+ white-space: pre-wrap;
64
+ }
65
+
66
+ @media screen and (max-height: 720px) {
67
+ :root {
68
+ --section-gap: 16px;
69
+ }
70
+ }
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
+ margin: 24px 0px 8px 0px;
3
+ justify-content: center;
4
+ }
5
+
6
+ .settings-container span {
7
+ font-size: 0.875rem;
8
+ margin: 0;
9
+ }
10
+
11
+ .settings-container label {
12
+ width: 24px;
13
+ height: 16px;
14
+ }
15
+
16
+ .settings-container .field {
17
+ justify-content: space-between;
18
+ }
19
+
20
+ .settings-container .checkbox input + label,
21
+ .settings-container .checkbox input:checked + label:after {
22
+ background: var(--colour-1);
23
+ }
24
+
25
+ .settings-container .checkbox input + label:after,
26
+ .settings-container .checkbox input:checked + label {
27
+ background: var(--colour-3);
28
+ }
29
+
30
+ .settings-container .checkbox label:after {
31
+ left: 2px;
32
+ width: 10px;
33
+ height: 10px;
34
+ }
35
+
36
+ .settings-container .checkbox input:checked + label:after {
37
+ left: calc(100% - 2px - 10px);
38
+ }
39
+
40
+ .settings-container .dropdown {
41
+ padding: 4px 8px;
42
+ font-size: 0.75rem;
43
+ }
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,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 "./settings.css";
18
+ @import "./message-input.css";
client/css/theme-toggler.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .theme-toggler-container {
2
+ margin: 24px 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,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>FreeGPT</title>
34
+ </head>
35
+
36
+ <body data-urlprefix="{{ url_prefix}}">
37
+ <div class="main-container">
38
+ <div class="box sidebar">
39
+ <div class="top">
40
+ <button class="button" onclick="new_conversation()">
41
+ <i class="fa-regular fa-plus"></i>
42
+ <span>{{_('New Conversation')}}</span>
43
+ </button>
44
+ <div class="spinner"></div>
45
+ </div>
46
+ <div class="sidebar-footer">
47
+ <button class="button" onclick="delete_conversations()">
48
+ <i class="fa-regular fa-trash"></i>
49
+ <span>{{_('Clear Conversations')}}</span>
50
+ </button>
51
+ <div class="settings-container">
52
+ <div class="checkbox field">
53
+ <span>{{_('Dark Mode')}}</span>
54
+ <input type="checkbox" id="theme-toggler" />
55
+ <label for="theme-toggler"></label>
56
+ </div>
57
+ <div class="field">
58
+ <span>{{_('Language')}}</span>
59
+ <select
60
+ class="dropdown"
61
+ id="language"
62
+ onchange="changeLanguage(this.value)"></select>
63
+ </div>
64
+ </div>
65
+ <a class="info" href="https://github.com/ramonvc/gptfree-jailbreak-webui" target="_blank">
66
+ <i class="fa-brands fa-github"></i>
67
+ <span class="conversation-title"> {{_('Version')}}: 0.1.0 </span>
68
+ </a>
69
+ </div>
70
+ </div>
71
+ <div class="conversation">
72
+ <div class="stop-generating stop-generating-hidden">
73
+ <button class="button" id="cancelButton">
74
+ <span>{{_('Stop Generating')}}</span>
75
+ </button>
76
+ </div>
77
+ <div class="box" id="messages"></div>
78
+ <div class="user-input">
79
+ <div class="box input-box">
80
+ <textarea
81
+ id="message-input"
82
+ placeholder="{{_('Ask a question')}}"
83
+ cols="30"
84
+ rows="10"
85
+ style="white-space: pre-wrap"></textarea>
86
+ <div id="send-button">
87
+ <i class="fa-regular fa-paper-plane-top"></i>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ <div>
92
+ <div class="options-container">
93
+ <div class="buttons">
94
+ <div class="field">
95
+ <select class="dropdown" name="model" id="model">
96
+ <option value="gpt-3.5-turbo">GPT-3.5</option>
97
+ <option value="gpt-3.5-turbo-16k">GPT-3.5-turbo-16k</option>
98
+ <option value="gpt-4" selected>GPT-4</option>
99
+ </select>
100
+ </div>
101
+ <div class="field">
102
+ <select class="dropdown" name="jailbreak" id="jailbreak">
103
+ <option value="default" selected>{{_('Default')}}</option>
104
+ <option value="gpt-dan-11.0">{{_('DAN')}}</option>
105
+ <option value="gpt-evil">{{_('Evil')}}</option>
106
+ </select>
107
+ </div>
108
+ </div>
109
+ <div class="field checkbox">
110
+ <input type="checkbox" id="switch" />
111
+ <label for="switch"></label>
112
+ <span>{{_('Web Access')}}</span>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ <div class="menu-button">
119
+ <i class="fa-solid fa-bars"></i>
120
+ </div>
121
+
122
+ <!-- scripts -->
123
+ <script>
124
+ window.conversation_id = "{{ chat_id }}";
125
+ </script>
126
+ <script src="{{ url_for('bp.static', filename='js/icons.js') }}"></script>
127
+ <script src="{{ url_for('bp.static', filename='js/chat.js') }}" defer></script>
128
+ <script src="https://cdn.jsdelivr.net/npm/markdown-it@latest/dist/markdown-it.min.js"></script>
129
+ <script src="{{ url_for('bp.static', filename='js/highlight.min.js') }}"></script>
130
+ <script src="{{ url_for('bp.static', filename='js/highlightjs-copy.min.js') }}"></script>
131
+ <script src="{{ url_for('bp.static', filename='js/theme-toggler.js') }}"></script>
132
+ <script src="{{ url_for('bp.static', filename='js/sidebar-toggler.js') }}"></script>
133
+ <script src="{{ url_for('bp.static', filename='js/change-language.js') }}"></script>
134
+ </body>
135
+ </html>
client/img/android-chrome-192x192.png ADDED
client/img/android-chrome-512x512.png ADDED
client/img/apple-touch-icon.png ADDED
client/img/favicon-16x16.png ADDED
client/img/favicon-32x32.png ADDED
client/img/favicon.ico ADDED
client/img/gpt.png ADDED
client/img/site.webmanifest ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "",
3
+ "short_name": "",
4
+ "icons": [
5
+ {
6
+ "src": "/assets/img/android-chrome-192x192.png",
7
+ "sizes": "192x192",
8
+ "type": "image/png"
9
+ },
10
+ {
11
+ "src": "/assets/img/android-chrome-512x512.png",
12
+ "sizes": "512x512",
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/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,508 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ conversation_id: window.conversation_id,
103
+ action: `_ask`,
104
+ model: model.options[model.selectedIndex].value,
105
+ jailbreak: jailbreak.options[jailbreak.selectedIndex].value,
106
+ meta: {
107
+ id: window.token,
108
+ content: {
109
+ conversation: await get_conversation(window.conversation_id),
110
+ internet_access: document.getElementById("switch").checked,
111
+ content_type: "text",
112
+ parts: [
113
+ {
114
+ content: message,
115
+ role: "user",
116
+ },
117
+ ],
118
+ },
119
+ },
120
+ }),
121
+ });
122
+
123
+ const reader = response.body.getReader();
124
+
125
+ while (true) {
126
+ const { value, done } = await reader.read();
127
+ if (done) break;
128
+
129
+ chunk = decodeUnicode(new TextDecoder().decode(value));
130
+
131
+ if (
132
+ chunk.includes(`<form id="challenge-form" action="${url_prefix}/backend-api/v2/conversation?`)
133
+ ) {
134
+ chunk = `cloudflare token expired, please refresh the page.`;
135
+ }
136
+
137
+ text += chunk;
138
+
139
+ document.getElementById(`gpt_${window.token}`).innerHTML = markdown.render(text);
140
+ document.querySelectorAll(`code`).forEach((el) => {
141
+ hljs.highlightElement(el);
142
+ });
143
+
144
+ window.scrollTo(0, 0);
145
+ message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" });
146
+ }
147
+
148
+ // if text contains :
149
+ if (text.includes(`instead. Maintaining this website and API costs a lot of money`)) {
150
+ document.getElementById(`gpt_${window.token}`).innerHTML =
151
+ "An error occurred, please reload / refresh cache and try again.";
152
+ }
153
+
154
+ add_message(window.conversation_id, "user", message);
155
+ add_message(window.conversation_id, "assistant", text);
156
+
157
+ message_box.scrollTop = message_box.scrollHeight;
158
+ await remove_cancel_button();
159
+ prompt_lock = false;
160
+
161
+ await load_conversations(20, 0);
162
+ window.scrollTo(0, 0);
163
+ } catch (e) {
164
+ add_message(window.conversation_id, "user", message);
165
+
166
+ message_box.scrollTop = message_box.scrollHeight;
167
+ await remove_cancel_button();
168
+ prompt_lock = false;
169
+
170
+ await load_conversations(20, 0);
171
+
172
+ console.log(e);
173
+
174
+ let cursorDiv = document.getElementById(`cursor`);
175
+ if (cursorDiv) cursorDiv.parentNode.removeChild(cursorDiv);
176
+
177
+ if (e.name != `AbortError`) {
178
+ let error_message = `oops ! something went wrong, please try again / reload. [stacktrace in console]`;
179
+
180
+ document.getElementById(`gpt_${window.token}`).innerHTML = error_message;
181
+ add_message(window.conversation_id, "assistant", error_message);
182
+ } else {
183
+ document.getElementById(`gpt_${window.token}`).innerHTML += ` [aborted]`;
184
+ add_message(window.conversation_id, "assistant", text + ` [aborted]`);
185
+ }
186
+
187
+ window.scrollTo(0, 0);
188
+ }
189
+ };
190
+
191
+ const add_user_message_box = (message) => {
192
+ const messageDiv = createElement("div", { classNames: ["message"] });
193
+ const avatarContainer = createElement("div", { classNames: ["avatar-container"], innerHTML: user_image });
194
+ const contentDiv = createElement("div", {
195
+ classNames: ["content"],
196
+ id: `user_${token}`,
197
+ textContent: message,
198
+ });
199
+
200
+ messageDiv.append(avatarContainer, contentDiv);
201
+ message_box.appendChild(messageDiv);
202
+ };
203
+
204
+ const decodeUnicode = (str) => {
205
+ return str.replace(/\\u([a-fA-F0-9]{4})/g, function (match, grp) {
206
+ return String.fromCharCode(parseInt(grp, 16));
207
+ });
208
+ };
209
+
210
+ const clear_conversations = async () => {
211
+ const elements = box_conversations.childNodes;
212
+ let index = elements.length;
213
+
214
+ if (index > 0) {
215
+ while (index--) {
216
+ const element = elements[index];
217
+ if (element.nodeType === Node.ELEMENT_NODE && element.tagName.toLowerCase() !== `button`) {
218
+ box_conversations.removeChild(element);
219
+ }
220
+ }
221
+ }
222
+ };
223
+
224
+ const clear_conversation = async () => {
225
+ let messages = message_box.getElementsByTagName(`div`);
226
+
227
+ while (messages.length > 0) {
228
+ message_box.removeChild(messages[0]);
229
+ }
230
+ };
231
+
232
+ const delete_conversation = async (conversation_id) => {
233
+ localStorage.removeItem(`conversation:${conversation_id}`);
234
+
235
+ if (window.conversation_id == conversation_id) {
236
+ await new_conversation();
237
+ }
238
+
239
+ await load_conversations(20, 0, true);
240
+ };
241
+
242
+ const set_conversation = async (conversation_id) => {
243
+ history.pushState({}, null, `${url_prefix}/chat/${conversation_id}`);
244
+ window.conversation_id = conversation_id;
245
+
246
+ await clear_conversation();
247
+ await load_conversation(conversation_id);
248
+ await load_conversations(20, 0, true);
249
+ };
250
+
251
+ const new_conversation = async () => {
252
+ history.pushState({}, null, `${url_prefix}/chat/`);
253
+ window.conversation_id = uuid();
254
+
255
+ await clear_conversation();
256
+ await load_conversations(20, 0, true);
257
+ };
258
+
259
+ const load_conversation = async (conversation_id) => {
260
+ let conversation = await JSON.parse(localStorage.getItem(`conversation:${conversation_id}`));
261
+ console.log(conversation, conversation_id);
262
+
263
+ for (item of conversation.items) {
264
+ if (is_assistant(item.role)) {
265
+ message_box.innerHTML += load_gpt_message_box(item.content);
266
+ } else {
267
+ message_box.innerHTML += load_user_message_box(item.content);
268
+ }
269
+ }
270
+
271
+ document.querySelectorAll(`code`).forEach((el) => {
272
+ hljs.highlightElement(el);
273
+ });
274
+
275
+ message_box.scrollTo({ top: message_box.scrollHeight, behavior: "smooth" });
276
+
277
+ setTimeout(() => {
278
+ message_box.scrollTop = message_box.scrollHeight;
279
+ }, 500);
280
+ };
281
+
282
+ const load_user_message_box = (content) => {
283
+ const messageDiv = createElement("div", { classNames: ["message"] });
284
+ const avatarContainer = createElement("div", { classNames: ["avatar-container"], innerHTML: user_image });
285
+ const contentDiv = createElement("div", { classNames: ["content"] });
286
+ const preElement = document.createElement("pre");
287
+ preElement.textContent = content;
288
+ contentDiv.appendChild(preElement);
289
+
290
+ messageDiv.append(avatarContainer, contentDiv);
291
+
292
+ return messageDiv.outerHTML;
293
+ };
294
+
295
+ const load_gpt_message_box = (content) => {
296
+ return `
297
+ <div class="message">
298
+ <div class="avatar-container">
299
+ ${gpt_image}
300
+ </div>
301
+ <div class="content">
302
+ ${markdown.render(content)}
303
+ </div>
304
+ </div>
305
+ `;
306
+ };
307
+
308
+ const is_assistant = (role) => {
309
+ return role == "assistant";
310
+ };
311
+
312
+ const get_conversation = async (conversation_id) => {
313
+ let conversation = await JSON.parse(localStorage.getItem(`conversation:${conversation_id}`));
314
+ return conversation.items;
315
+ };
316
+
317
+ const add_conversation = async (conversation_id, title) => {
318
+ if (localStorage.getItem(`conversation:${conversation_id}`) == null) {
319
+ localStorage.setItem(
320
+ `conversation:${conversation_id}`,
321
+ JSON.stringify({
322
+ id: conversation_id,
323
+ title: title,
324
+ items: [],
325
+ })
326
+ );
327
+ }
328
+ };
329
+
330
+ const add_message = async (conversation_id, role, content) => {
331
+ before_adding = JSON.parse(localStorage.getItem(`conversation:${conversation_id}`));
332
+
333
+ before_adding.items.push({
334
+ role: role,
335
+ content: content,
336
+ });
337
+
338
+ localStorage.setItem(`conversation:${conversation_id}`, JSON.stringify(before_adding)); // update conversation
339
+ };
340
+
341
+ const load_conversations = async (limit, offset, loader) => {
342
+ //console.log(loader);
343
+ //if (loader === undefined) box_conversations.appendChild(spinner);
344
+
345
+ let conversations = [];
346
+ for (let i = 0; i < localStorage.length; i++) {
347
+ if (localStorage.key(i).startsWith("conversation:")) {
348
+ let conversation = localStorage.getItem(localStorage.key(i));
349
+ conversations.push(JSON.parse(conversation));
350
+ }
351
+ }
352
+
353
+ //if (loader === undefined) spinner.parentNode.removeChild(spinner)
354
+ await clear_conversations();
355
+
356
+ for (conversation of conversations) {
357
+ box_conversations.innerHTML += `
358
+ <div class="conversation-sidebar">
359
+ <div class="left" onclick="set_conversation('${conversation.id}')">
360
+ <i class="fa-regular fa-comments"></i>
361
+ <span class="conversation-title">${conversation.title}</span>
362
+ </div>
363
+ <i onclick="delete_conversation('${conversation.id}')" class="fa-regular fa-trash"></i>
364
+ </div>
365
+ `;
366
+ }
367
+
368
+ document.querySelectorAll(`code`).forEach((el) => {
369
+ hljs.highlightElement(el);
370
+ });
371
+ };
372
+
373
+ document.getElementById(`cancelButton`).addEventListener(`click`, async () => {
374
+ window.controller.abort();
375
+ console.log(`aborted ${window.conversation_id}`);
376
+ });
377
+
378
+ function h2a(str1) {
379
+ var hex = str1.toString();
380
+ var str = "";
381
+
382
+ for (var n = 0; n < hex.length; n += 2) {
383
+ str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
384
+ }
385
+
386
+ return str;
387
+ }
388
+
389
+ const uuid = () => {
390
+ return `xxxxxxxx-xxxx-4xxx-yxxx-${Date.now().toString(16)}`.replace(/[xy]/g, function (c) {
391
+ var r = (Math.random() * 16) | 0,
392
+ v = c == "x" ? r : (r & 0x3) | 0x8;
393
+ return v.toString(16);
394
+ });
395
+ };
396
+
397
+ const message_id = () => {
398
+ random_bytes = (Math.floor(Math.random() * 1338377565) + 2956589730).toString(2);
399
+ unix = Math.floor(Date.now() / 1000).toString(2);
400
+
401
+ return BigInt(`0b${unix}${random_bytes}`).toString();
402
+ };
403
+
404
+ window.onload = async () => {
405
+ load_settings_localstorage();
406
+
407
+ conversations = 0;
408
+ for (let i = 0; i < localStorage.length; i++) {
409
+ if (localStorage.key(i).startsWith("conversation:")) {
410
+ conversations += 1;
411
+ }
412
+ }
413
+
414
+ if (conversations == 0) localStorage.clear();
415
+
416
+ await setTimeout(() => {
417
+ load_conversations(20, 0);
418
+ }, 1);
419
+
420
+ if (!window.location.href.endsWith(`#`)) {
421
+ if (/\/chat\/.+/.test(window.location.href.slice(url_prefix.length))) {
422
+ await load_conversation(window.conversation_id);
423
+ }
424
+ }
425
+
426
+ message_input.addEventListener("keydown", async (evt) => {
427
+ if (prompt_lock) return;
428
+
429
+ if (evt.key === "Enter" && !evt.shiftKey) {
430
+ evt.preventDefault();
431
+ await handle_ask();
432
+ }
433
+ });
434
+
435
+ send_button.addEventListener("click", async (event) => {
436
+ event.preventDefault();
437
+ if (prompt_lock) return;
438
+ message_input.blur();
439
+ await handle_ask();
440
+ });
441
+
442
+ register_settings_localstorage();
443
+ };
444
+
445
+ const register_settings_localstorage = async () => {
446
+ settings_ids = ["switch", "model", "jailbreak"];
447
+ settings_elements = settings_ids.map((id) => document.getElementById(id));
448
+ settings_elements.map((element) =>
449
+ element.addEventListener(`change`, async (event) => {
450
+ switch (event.target.type) {
451
+ case "checkbox":
452
+ localStorage.setItem(event.target.id, event.target.checked);
453
+ break;
454
+ case "select-one":
455
+ localStorage.setItem(event.target.id, event.target.selectedIndex);
456
+ break;
457
+ default:
458
+ console.warn("Unresolved element type");
459
+ }
460
+ })
461
+ );
462
+ };
463
+
464
+ const load_settings_localstorage = async () => {
465
+ settings_ids = ["switch", "model", "jailbreak"];
466
+ settings_elements = settings_ids.map((id) => document.getElementById(id));
467
+ settings_elements.map((element) => {
468
+ if (localStorage.getItem(element.id)) {
469
+ switch (element.type) {
470
+ case "checkbox":
471
+ element.checked = localStorage.getItem(element.id) === "true";
472
+ break;
473
+ case "select-one":
474
+ element.selectedIndex = parseInt(localStorage.getItem(element.id));
475
+ break;
476
+ default:
477
+ console.warn("Unresolved element type");
478
+ }
479
+ }
480
+ });
481
+ };
482
+
483
+ function clearTextarea(textarea) {
484
+ textarea.style.removeProperty("height");
485
+ textarea.style.height = `${textarea.scrollHeight + 4}px`;
486
+ if (textarea.value.trim() === "" && textarea.value.includes("\n")) {
487
+ textarea.value = "";
488
+ }
489
+ }
490
+
491
+ function createElement(tag, { classNames, id, innerHTML, textContent } = {}) {
492
+ const el = document.createElement(tag);
493
+ if (classNames) {
494
+ el.classList.add(...classNames);
495
+ }
496
+ if (id) {
497
+ el.id = id;
498
+ }
499
+ if (innerHTML) {
500
+ el.innerHTML = innerHTML;
501
+ }
502
+ if (textContent) {
503
+ const preElement = document.createElement("pre");
504
+ preElement.textContent = textContent;
505
+ el.appendChild(preElement);
506
+ }
507
+ return el;
508
+ }
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
+ })();
config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "site_config": {
3
+ "host": "0.0.0.0",
4
+ "port": 1338,
5
+ "debug": false
6
+ },
7
+ "url_prefix": ""
8
+ }
docker-compose.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.5'
2
+
3
+ services:
4
+ freegpt-webui:
5
+ image: freegpt-webui
6
+ container_name: freegpt-webui
7
+ build:
8
+ context: .
9
+ dockerfile: Dockerfile
10
+ ports:
11
+ - "1338:1338"
g4f/Provider/Provider.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from ..typing import sha256, Dict, get_type_hints
3
+
4
+ url = None
5
+ model = None
6
+ supports_stream = False
7
+ needs_auth = False
8
+
9
+
10
+ def _create_completion(model: str, messages: list, stream: bool, **kwargs):
11
+ return
12
+
13
+
14
+ params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
15
+ '(%s)' % ', '.join(
16
+ [f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
g4f/Provider/Providers/AiService.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import requests
3
+ from ...typing import get_type_hints
4
+
5
+ url = "https://aiservice.vercel.app/api/chat/answer"
6
+ model = ['gpt-3.5-turbo']
7
+ supports_stream = False
8
+ needs_auth = False
9
+
10
+
11
+ def _create_completion(model: str, messages: list, stream: bool, **kwargs):
12
+ base = ''
13
+ for message in messages:
14
+ base += '%s: %s\n' % (message['role'], message['content'])
15
+ base += 'assistant:'
16
+
17
+ headers = {
18
+ "accept": "*/*",
19
+ "content-type": "text/plain;charset=UTF-8",
20
+ "sec-fetch-dest": "empty",
21
+ "sec-fetch-mode": "cors",
22
+ "sec-fetch-site": "same-origin",
23
+ "Referer": "https://aiservice.vercel.app/chat",
24
+ }
25
+ data = {
26
+ "input": base
27
+ }
28
+ response = requests.post(url, headers=headers, json=data)
29
+ if response.status_code == 200:
30
+ _json = response.json()
31
+ yield _json['data']
32
+ else:
33
+ print(f"Error Occurred::{response.status_code}")
34
+ return None
35
+
36
+
37
+
38
+ params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
39
+ '(%s)' % ', '.join(
40
+ [f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])