XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Add publish-to-pypi workflow Improve gui frontend Fix web search in bing

a7c85659
Heiner Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

7 个文件 +102 -66
Deleted .github/workflows/auto-comments.yml +0 -51
@@ -1,51 +0,0 @@
1 name: Auto Comment
2 on:
3 issues:
4 types:
5 - opened
6 - closed
7 - assigned
8 pull_request:
9 types:
10 - opened
11 - closed
12
13 jobs:
14 run:
15 runs-on: ubuntu-latest
16 steps:
17 - name: Auto Comment on Issues Opened
18 uses: wow-actions/auto-comment@v1
19 with:
20 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 issuesOpened: |
22 👋 @{{ author }}
23 Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
24 Please make sure you have given us as much context as possible.
25 - name: Auto Comment on Issues Closed
26 uses: wow-actions/auto-comment@v1
27 with:
28 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 issuesClosed: |
30 👋 @{{ author }} This issue is closed.
31 - name: Auto Comment on Pull Request Merged
32 uses: wow-actions/auto-comment@v1
33 with:
34 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 pullRequestMerged: |
36 👋 @{{ author }} 🎉 Congrats on your merged pull request! Thanks for the valuable contribution! 👏🎉 Congrats on your merged pull request! Thanks for the valuable contribution! 👏
37 - name: Auto Comment on Pull Request Opened
38 uses: wow-actions/auto-comment@v1
39 with:
40 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 pullRequestOpened: |
42 Hello👋 @{{ author }}, I hope you are doing well!
43 <br>
44 Thank you for raising your pull request and contributing to our Community 🎉
45 Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
46 - name: Auto Comment on Issues Assigned
47 uses: wow-actions/auto-comment@v1
48 with:
49 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 issuesAssigned: |
51 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. 👍
Added .github/workflows/publish-to-pypi.yml +54 -0
@@ -0,0 +1,54 @@
1 name: Publish Python 🐍 distribution 📦 to PyPI
2
3 on: push
4
5 env:
6 G4F_VERSION: ${{ github.ref_name }}
7
8 jobs:
9 build:
10 name: Build distribution 📦
11 if: startsWith(github.ref, 'refs/tags/')
12 runs-on: ubuntu-latest
13 steps:
14 - uses: actions/checkout@v4
15 - name: Set up Python
16 uses: actions/setup-python@v4
17 with:
18 python-version: "3.x"
19 - name: Install pypa/build
20 run: >-
21 python3 -m
22 pip install
23 build
24 --user
25 - name: Build a binary wheel and a source tarball
26 run: python3 -m build
27 - name: Store the distribution packages
28 uses: actions/upload-artifact@v3
29 with:
30 name: python-package-distributions
31 path: dist/
32
33 publish-to-pypi:
34 name: >-
35 Publish distribution on PyPI 🐍
36 if: startsWith(github.ref, 'refs/tags/')
37 needs:
38 - build
39 runs-on: ubuntu-latest
40 environment:
41 name: testpypi
42 url: https://test.pypi.org/p/g4f
43 permissions:
44 id-token: write
45 steps:
46 - name: Download all the dists
47 uses: actions/download-artifact@v3
48 with:
49 name: python-package-distributions
50 path: dist/
51 - name: Publish distribution 📦 to PyPI
52 uses: pypa/gh-action-pypi-publish@release/v1
53 with:
54 repository-url: https://test.pypi.org/legacy/
Modified g4f/Provider/Bing.py +5 -1
@@ -33,7 +33,7 @@ class Bing(AsyncGeneratorProvider):
33 33 proxy: str = None,
34 34 timeout: int = 900,
35 35 cookies: dict = None,
36 tone: str = Tones.creative,
36 tone: str = Tones.balanced,
37 37 image: str = None,
38 38 web_search: bool = False,
39 39 **kwargs
@@ -212,7 +212,11 @@ def create_message(
212 212 'requestId': request_id,
213 213 'messageId': request_id,
214 214 }},
215 "verbosity": "verbose",
215 216 "scenario": "SERP",
217 "plugins":[
218 {"id":"c310c353-b9f0-4d76-ab0d-1dd5e979cf68", "category": 1}
219 ] if web_search else [],
216 220 'tone': tone,
217 221 'spokenTextMode': 'None',
218 222 'conversationId': conversation.conversationId,
Modified g4f/gui/client/css/style.css +1 -0
@@ -485,6 +485,7 @@ select {
485 485 padding: 8px 16px;
486 486
487 487 appearance: none;
488 width: 250px;
488 489 }
489 490
490 491 .input-box {
Modified g4f/gui/client/html/index.html +1 -1
@@ -168,7 +168,7 @@
168 168 </select>
169 169 </div>
170 170 <div class="field">
171 <select name="jailbreak" id="jailbreak">
171 <select name="jailbreak" id="jailbreak" style="display: none;">
172 172 <option value="default" selected>Set Jailbreak</option>
173 173 <option value="gpt-math-1.0">math 1.0</option>
174 174 <option value="gpt-dude-1.0">dude 1.0</option>
Modified g4f/gui/client/js/chat.v1.js +7 -8
@@ -73,8 +73,8 @@ const ask_gpt = async () => {
73 73
74 74 // Remove generated images from history
75 75 for (i in messages) {
76 messages[i]["content"] = messages[i]["content"].replace(
77 /<!-- generated images start -->[\s\S]+<!-- generated images end -->/m,
76 messages[i]["content"] = messages[i]["content"].replaceAll(
77 /<!-- generated images start -->[\s\S]+<!-- generated images end -->/gm,
78 78 ""
79 79 )
80 80 delete messages[i]["provider"];
@@ -318,7 +318,7 @@ const get_conversation = async (conversation_id) => {
318 318
319 319 const get_messages = async (conversation_id) => {
320 320 let conversation = await get_conversation(conversation_id);
321 return conversation.items;
321 return conversation?.items || [];
322 322 };
323 323
324 324 const add_conversation = async (conversation_id, content) => {
@@ -463,9 +463,8 @@ const register_settings_localstorage = async () => {
463 463 };
464 464
465 465 const load_settings_localstorage = async () => {
466 settings_ids = ["switch", "model", "jailbreak", "patch", "provider"];
467 settings_elements = settings_ids.map((id) => document.getElementById(id));
468 settings_elements.map((element) => {
466 for (id of ["switch", "model", "jailbreak", "patch", "provider"]) {
467 element = document.getElementById(id);
469 468 if (localStorage.getItem(element.id)) {
470 469 switch (element.type) {
471 470 case "checkbox":
@@ -478,8 +477,8 @@ const load_settings_localstorage = async () => {
478 477 console.warn("Unresolved element type");
479 478 }
480 479 }
481 });
482 };
480 }
481 }
483 482
484 483 const say_hello = async () => {
485 484 tokens = [`Hello`, `!`, ` How`,` can`, ` I`,` assist`,` you`,` today`,`?`]
Modified setup.py +34 -5
@@ -8,10 +8,39 @@ here = os.path.abspath(os.path.dirname(__file__))
8 8 with codecs.open(os.path.join(here, 'README.md'), encoding='utf-8') as fh:
9 9 long_description = '\n' + fh.read()
10 10
11 with open('requirements.txt') as f:
12 required = f.read().splitlines()
11 install_requires = [
12 "requests",
13 "pycryptodome",
14 "curl_cffi>=0.5.10",
15 "aiohttp",
16 "certifi",
17 "browser_cookie3",
18 "websockets",
19 "js2py",
20 "typing-extensions",
21 "PyExecJS",
22 "duckduckgo-search",
23 "nest_asyncio",
24 "waitress",
25 "werkzeug",
26 "loguru",
27 "pillow",
28 "platformdirs",
29 "numpy",
30 "asgiref",
31 "fastapi",
32 "uvicorn",
33 "flask",
34 "py-arkose-generator",
35 "asyncstdlib",
36 "async-property",
37 "undetected-chromedriver",
38 "asyncstdlib",
39 "async_property",
40 "brotli",
41 "beautifulsoup4",
42 ]
13 43
14 VERSION = '0.1.9.9'
15 44 DESCRIPTION = (
16 45 'The official gpt4free repository | various collection of powerful language models'
17 46 )
@@ -19,7 +48,7 @@ DESCRIPTION = (
19 48 # Setting up
20 49 setup(
21 50 name='g4f',
22 version=VERSION,
51 version=os.environ.get("G4F_VERSION"),
23 52 author='Tekky',
24 53 author_email='<support@g4f.ai>',
25 54 description=DESCRIPTION,
@@ -30,7 +59,7 @@ setup(
30 59 'g4f': ['g4f/interference/*', 'g4f/gui/client/*', 'g4f/gui/server/*', 'g4f/Provider/npm/*']
31 60 },
32 61 include_package_data=True,
33 install_requires=required,
62 install_requires=install_requires,
34 63 entry_points={
35 64 'console_scripts': ['g4f=g4f.cli:main'],
36 65 },