summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-12 02:14:35 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-12 02:14:35 +0100
commita7c856592213c8a8c7a6ef3b30cccf2ede6a9636 (patch)
tree6f2107ce9057c2da9a30e3fd33ff247d30a3e199
parentFix create_async in CreateImagesProvider (diff)
downloadgpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.gz
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.bz2
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.lz
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.xz
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.zst
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.zip
-rw-r--r--.github/workflows/auto-comments.yml51
-rw-r--r--.github/workflows/publish-to-pypi.yml54
-rw-r--r--g4f/Provider/Bing.py6
-rw-r--r--g4f/gui/client/css/style.css1
-rw-r--r--g4f/gui/client/html/index.html2
-rw-r--r--g4f/gui/client/js/chat.v1.js15
-rw-r--r--setup.py39
7 files changed, 102 insertions, 66 deletions
diff --git a/.github/workflows/auto-comments.yml b/.github/workflows/auto-comments.yml
deleted file mode 100644
index 98335275..00000000
--- a/.github/workflows/auto-comments.yml
+++ /dev/null
@@ -1,51 +0,0 @@
-name: Auto Comment
-on:
- issues:
- types:
- - opened
- - closed
- - assigned
- pull_request:
- types:
- - opened
- - closed
-
-jobs:
- run:
- runs-on: ubuntu-latest
- steps:
- - name: Auto Comment on Issues Opened
- uses: wow-actions/auto-comment@v1
- with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- issuesOpened: |
- πŸ‘‹ @{{ author }}
- Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
- Please make sure you have given us as much context as possible.
- - name: Auto Comment on Issues Closed
- uses: wow-actions/auto-comment@v1
- with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- issuesClosed: |
- πŸ‘‹ @{{ author }} This issue is closed.
- - name: Auto Comment on Pull Request Merged
- uses: wow-actions/auto-comment@v1
- with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- pullRequestMerged: |
- πŸ‘‹ @{{ author }} πŸŽ‰ Congrats on your merged pull request! Thanks for the valuable contribution! πŸ‘πŸŽ‰ Congrats on your merged pull request! Thanks for the valuable contribution! πŸ‘
- - name: Auto Comment on Pull Request Opened
- uses: wow-actions/auto-comment@v1
- with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- pullRequestOpened: |
- HelloπŸ‘‹ @{{ author }}, I hope you are doing well!
- <br>
- Thank you for raising your pull request and contributing to our Community πŸŽ‰
- Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
- - name: Auto Comment on Issues Assigned
- uses: wow-actions/auto-comment@v1
- with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- issuesAssigned: |
- Hello @{{ author }}, thank you for raising an issue. πŸ™Œ I have assigned the issue to you. You can now start working on it. If you encounter any problems, please feel free to connect with us. πŸ‘
diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml
new file mode 100644
index 00000000..d0bc4d99
--- /dev/null
+++ b/.github/workflows/publish-to-pypi.yml
@@ -0,0 +1,54 @@
+name: Publish Python 🐍 distribution πŸ“¦ to PyPI
+
+on: push
+
+env:
+ G4F_VERSION: ${{ github.ref_name }}
+
+jobs:
+ build:
+ name: Build distribution πŸ“¦
+ if: startsWith(github.ref, 'refs/tags/')
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.x"
+ - name: Install pypa/build
+ run: >-
+ python3 -m
+ pip install
+ build
+ --user
+ - name: Build a binary wheel and a source tarball
+ run: python3 -m build
+ - name: Store the distribution packages
+ uses: actions/upload-artifact@v3
+ with:
+ name: python-package-distributions
+ path: dist/
+
+ publish-to-pypi:
+ name: >-
+ Publish distribution on PyPI 🐍
+ if: startsWith(github.ref, 'refs/tags/')
+ needs:
+ - build
+ runs-on: ubuntu-latest
+ environment:
+ name: testpypi
+ url: https://test.pypi.org/p/g4f
+ permissions:
+ id-token: write
+ steps:
+ - name: Download all the dists
+ uses: actions/download-artifact@v3
+ with:
+ name: python-package-distributions
+ path: dist/
+ - name: Publish distribution πŸ“¦ to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ repository-url: https://test.pypi.org/legacy/ \ No newline at end of file
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index 18a6040b..b0949397 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -33,7 +33,7 @@ class Bing(AsyncGeneratorProvider):
proxy: str = None,
timeout: int = 900,
cookies: dict = None,
- tone: str = Tones.creative,
+ tone: str = Tones.balanced,
image: str = None,
web_search: bool = False,
**kwargs
@@ -212,7 +212,11 @@ def create_message(
'requestId': request_id,
'messageId': request_id,
}},
+ "verbosity": "verbose",
"scenario": "SERP",
+ "plugins":[
+ {"id":"c310c353-b9f0-4d76-ab0d-1dd5e979cf68", "category": 1}
+ ] if web_search else [],
'tone': tone,
'spokenTextMode': 'None',
'conversationId': conversation.conversationId,
diff --git a/g4f/gui/client/css/style.css b/g4f/gui/client/css/style.css
index e619b409..3e2d6d6f 100644
--- a/g4f/gui/client/css/style.css
+++ b/g4f/gui/client/css/style.css
@@ -485,6 +485,7 @@ select {
padding: 8px 16px;
appearance: none;
+ width: 250px;
}
.input-box {
diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html
index b47f2a37..bc41bd45 100644
--- a/g4f/gui/client/html/index.html
+++ b/g4f/gui/client/html/index.html
@@ -168,7 +168,7 @@
</select>
</div>
<div class="field">
- <select name="jailbreak" id="jailbreak">
+ <select name="jailbreak" id="jailbreak" style="display: none;">
<option value="default" selected>Set Jailbreak</option>
<option value="gpt-math-1.0">math 1.0</option>
<option value="gpt-dude-1.0">dude 1.0</option>
diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js
index 9d49d24e..fffe9fe9 100644
--- a/g4f/gui/client/js/chat.v1.js
+++ b/g4f/gui/client/js/chat.v1.js
@@ -73,8 +73,8 @@ const ask_gpt = async () => {
// Remove generated images from history
for (i in messages) {
- messages[i]["content"] = messages[i]["content"].replace(
- /<!-- generated images start -->[\s\S]+<!-- generated images end -->/m,
+ messages[i]["content"] = messages[i]["content"].replaceAll(
+ /<!-- generated images start -->[\s\S]+<!-- generated images end -->/gm,
""
)
delete messages[i]["provider"];
@@ -318,7 +318,7 @@ const get_conversation = async (conversation_id) => {
const get_messages = async (conversation_id) => {
let conversation = await get_conversation(conversation_id);
- return conversation.items;
+ return conversation?.items || [];
};
const add_conversation = async (conversation_id, content) => {
@@ -463,9 +463,8 @@ const register_settings_localstorage = async () => {
};
const load_settings_localstorage = async () => {
- settings_ids = ["switch", "model", "jailbreak", "patch", "provider"];
- settings_elements = settings_ids.map((id) => document.getElementById(id));
- settings_elements.map((element) => {
+ for (id of ["switch", "model", "jailbreak", "patch", "provider"]) {
+ element = document.getElementById(id);
if (localStorage.getItem(element.id)) {
switch (element.type) {
case "checkbox":
@@ -478,8 +477,8 @@ const load_settings_localstorage = async () => {
console.warn("Unresolved element type");
}
}
- });
-};
+ }
+}
const say_hello = async () => {
tokens = [`Hello`, `!`, ` How`,` can`, ` I`,` assist`,` you`,` today`,`?`]
diff --git a/setup.py b/setup.py
index 0bb683e4..dc59597b 100644
--- a/setup.py
+++ b/setup.py
@@ -8,10 +8,39 @@ here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, 'README.md'), encoding='utf-8') as fh:
long_description = '\n' + fh.read()
-with open('requirements.txt') as f:
- required = f.read().splitlines()
+install_requires = [
+ "requests",
+ "pycryptodome",
+ "curl_cffi>=0.5.10",
+ "aiohttp",
+ "certifi",
+ "browser_cookie3",
+ "websockets",
+ "js2py",
+ "typing-extensions",
+ "PyExecJS",
+ "duckduckgo-search",
+ "nest_asyncio",
+ "waitress",
+ "werkzeug",
+ "loguru",
+ "pillow",
+ "platformdirs",
+ "numpy",
+ "asgiref",
+ "fastapi",
+ "uvicorn",
+ "flask",
+ "py-arkose-generator",
+ "asyncstdlib",
+ "async-property",
+ "undetected-chromedriver",
+ "asyncstdlib",
+ "async_property",
+ "brotli",
+ "beautifulsoup4",
+]
-VERSION = '0.1.9.9'
DESCRIPTION = (
'The official gpt4free repository | various collection of powerful language models'
)
@@ -19,7 +48,7 @@ DESCRIPTION = (
# Setting up
setup(
name='g4f',
- version=VERSION,
+ version=os.environ.get("G4F_VERSION"),
author='Tekky',
author_email='<support@g4f.ai>',
description=DESCRIPTION,
@@ -30,7 +59,7 @@ setup(
'g4f': ['g4f/interference/*', 'g4f/gui/client/*', 'g4f/gui/server/*', 'g4f/Provider/npm/*']
},
include_package_data=True,
- install_requires=required,
+ install_requires=install_requires,
entry_points={
'console_scripts': ['g4f=g4f.cli:main'],
},