mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Add publish-to-pypi workflow
Improve gui frontend Fix web search in bing
This commit is contained in:
parent
4343082d37
commit
a7c8565922
7 changed files with 102 additions and 66 deletions
51
.github/workflows/auto-comments.yml
vendored
51
.github/workflows/auto-comments.yml
vendored
|
|
@ -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. 👍
|
||||
54
.github/workflows/publish-to-pypi.yml
vendored
Normal file
54
.github/workflows/publish-to-pypi.yml
vendored
Normal file
|
|
@ -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/
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -485,6 +485,7 @@ select {
|
|||
padding: 8px 16px;
|
||||
|
||||
appearance: none;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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`,`?`]
|
||||
|
|
|
|||
39
setup.py
39
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'],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue