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

XFEstudio/gpt4free

Add armv7 docker image, Remove Bing provider, add update banner

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

代码差异

10 个文件 +125 -21
Modified .github/workflows/publish-workflow.yaml +15 -1
@@ -57,12 +57,26 @@ jobs:
57 57 username: ${{ github.repository_owner }}
58 58 password: ${{ secrets.GHCR_PAT }}
59 59
60 - name: Build and push armv7 image
61 uses: docker/build-push-action@v5
62 with:
63 context: .
64 file: docker/Dockerfile-armv7
65 platforms: linux/arm/v7
66 push: true
67 tags: |
68 hlohaus789/g4f:latest-armv7
69 hlohaus789/g4f:${{ github.ref_name }}-armv7
70 labels: ${{ steps.metadata.outputs.labels }}
71 build-args: |
72 G4F_VERSION=${{ github.ref_name }}
73
60 74 - name: Build and push small images
61 75 uses: docker/build-push-action@v5
62 76 with:
63 77 context: .
64 78 file: docker/Dockerfile-slim
65 platforms: linux/amd64,linux/arm64,linux/arm/v7
79 platforms: linux/amd64,linux/arm64
66 80 push: true
67 81 tags: |
68 82 hlohaus789/g4f:latest-slim
Added docker/Dockerfile-armv7 +67 -0
@@ -0,0 +1,67 @@
1 FROM python:slim-bookworm
2
3 ARG G4F_VERSION
4 ARG G4F_USER=g4f
5 ARG G4F_USER_ID=1000
6 ARG PYDANTIC_VERSION=1.8.1
7
8 ENV G4F_VERSION $G4F_VERSION
9 ENV G4F_USER $G4F_USER
10 ENV G4F_USER_ID $G4F_USER_ID
11 ENV G4F_DIR /app
12
13 RUN apt-get update && apt-get upgrade -y \
14 && apt-get install -y git \
15 && apt-get install --quiet --yes --no-install-recommends \
16 build-essential \
17 # Add user and user group
18 && groupadd -g $G4F_USER_ID $G4F_USER \
19 && useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
20 && mkdir -p /var/log/supervisor \
21 && chown "${G4F_USER_ID}:${G4F_USER_ID}" /var/log/supervisor \
22 && echo "${G4F_USER}:${G4F_USER}" | chpasswd \
23 && python -m pip install --upgrade pip
24
25 USER $G4F_USER_ID
26 WORKDIR $G4F_DIR
27
28 ENV HOME /home/$G4F_USER
29 ENV PATH "${HOME}/.local/bin:${PATH}"
30
31 # Create app dir and copy the project's requirements file into it
32 RUN mkdir -p $G4F_DIR
33 COPY requirements-min.txt $G4F_DIR
34 COPY requirements-slim.txt $G4F_DIR
35
36 # Upgrade pip for the latest features and install the project's Python dependencies.
37 RUN pip install --no-cache-dir -r requirements-min.txt \
38 && pip install --no-cache-dir --no-binary setuptools \
39 Cython==0.29.22 \
40 setuptools \
41 # Install PyDantic
42 && pip install \
43 -vvv \
44 --no-cache-dir \
45 --no-binary :all: \
46 --global-option=build_ext \
47 --global-option=-j8 \
48 pydantic==${PYDANTIC_VERSION}
49 RUN cat requirements-slim.txt | xargs -n 1 pip install --no-cache-dir || true
50
51 # Remove build packages
52 RUN pip uninstall --yes \
53 Cython \
54 setuptools
55
56 USER root
57
58 # Clean up build deps
59 RUN apt-get purge --auto-remove --yes \
60 build-essential \
61 && apt-get clean \
62 && rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/*
63
64 USER $G4F_USER_ID
65
66 # Copy the entire package into the container.
67 ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
Modified docker/Dockerfile-slim +2 -2
@@ -29,11 +29,11 @@ ENV PATH "${HOME}/.local/bin:${PATH}"
29 29
30 30 # Create app dir and copy the project's requirements file into it
31 31 RUN mkdir -p $G4F_DIR
32 COPY requirements-min.txt $G4F_DIR
33 32 COPY requirements-slim.txt $G4F_DIR
34 33
35 34 # Upgrade pip for the latest features and install the project's Python dependencies.
36 RUN cat requirements-slim.txt | xargs -n 1 pip install --no-cache-dir || true
35 RUN pip install --no-cache-dir -r requirements-slim.txt \
36 && pip install --no-cache-dir duckduckgo-search>=5.0
37 37
38 38 # Copy the entire package into the container.
39 39 ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
Modified docs/async_client.md +1 -2
@@ -280,10 +280,9 @@ The G4F AsyncClient supports a wide range of AI models and providers, allowing y
280 280 - OpenAI
281 281 - Google (for Gemini)
282 282 - Anthropic
283 - Bing
283 - Microsoft Copilot
284 284 - Custom providers
285 285
286
287 286
288 287 **To use a specific model or provider, specify it when creating the client or in the API call:**
289 288 ```python
Modified g4f/Provider/__init__.py +0 -1
@@ -14,7 +14,6 @@ from .local import *
14 14 from .AIUncensored import AIUncensored
15 15 from .Airforce import Airforce
16 16 from .AmigoChat import AmigoChat
17 from .Bing import Bing
18 17 from .Blackbox import Blackbox
19 18 from .ChatGpt import ChatGpt
20 19 from .ChatGptEs import ChatGptEs
Renamed g4f/Provider/deprecated/Bing.py +12 -12
@@ -8,17 +8,17 @@ import asyncio
8 8 from urllib import parse
9 9 from datetime import datetime, date
10 10
11 from ..typing import AsyncResult, Messages, ImageType, Cookies
12 from ..image import ImageRequest
13 from ..errors import ResponseError, ResponseStatusError, RateLimitError
14 from ..requests import DEFAULT_HEADERS
15 from ..requests.aiohttp import StreamSession
16 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
17 from .helper import get_random_hex
18 from .bing.upload_image import upload_image
19 from .bing.conversation import Conversation, create_conversation, delete_conversation
20 from .needs_auth.BingCreateImages import BingCreateImages
21 from .. import debug
11 from ...typing import AsyncResult, Messages, ImageType, Cookies
12 from ...image import ImageRequest
13 from ...errors import ResponseError, ResponseStatusError, RateLimitError
14 from ...requests import DEFAULT_HEADERS
15 from ...requests.aiohttp import StreamSession
16 from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
17 from ..helper import get_random_hex
18 from ..bing.upload_image import upload_image
19 from ..bing.conversation import Conversation, create_conversation, delete_conversation
20 from ..needs_auth.BingCreateImages import BingCreateImages
21 from ... import debug
22 22
23 23 class Tones:
24 24 """
@@ -35,7 +35,7 @@ class Bing(AsyncGeneratorProvider, ProviderModelMixin):
35 35 """
36 36 label = "Microsoft Copilot in Bing"
37 37 url = "https://bing.com/chat"
38 working = True
38 working = False
39 39 supports_message_history = True
40 40 default_model = "Balanced"
41 41 default_vision_model = "gpt-4-vision"
Modified g4f/Provider/deprecated/__init__.py +1 -0
@@ -32,3 +32,4 @@ from .GPTalk import GPTalk
32 32 from .Hashnode import Hashnode
33 33 from .Ylokh import Ylokh
34 34 from .OpenAssistant import OpenAssistant
35 from .Bing import Bing
Modified g4f/gui/client/static/css/style.css +19 -0
@@ -108,6 +108,25 @@ body {
108 108 border: 1px solid var(--blur-border);
109 109 }
110 110
111 .new_version {
112 position: absolute;
113 right: 0;
114 top: 0;
115 padding: 10px;
116 font-weight: 500;
117 background-color: rgba(0, 0, 0, 0.5);
118 color: var(--colour-3);
119 }
120
121 .white .new_version {
122 color: var(--colour-1);
123 }
124
125 .new_version a {
126 color: var(--colour-4);
127 text-decoration: underline dotted;
128 }
129
111 130 .conversations {
112 131 max-width: 300px;
113 132 padding: var(--section-gap);
Modified g4f/gui/client/static/js/chat.v1.js +8 -2
@@ -1331,15 +1331,21 @@ async function load_version() {
1331 1331 document.title = 'g4f - ' + versions["version"];
1332 1332 let text = "version ~ "
1333 1333 if (versions["version"] != versions["latest_version"]) {
1334 let release_url = 'https://github.com/xtekky/gpt4free/releases/tag/' + versions["latest_version"];
1334 let release_url = 'https://github.com/xtekky/gpt4free/releases/latest';
1335 1335 let title = `New version: ${versions["latest_version"]}`;
1336 1336 text += `<a href="${release_url}" target="_blank" title="${title}">${versions["version"]}</a> 🆕`;
1337 const new_version = document.createElement("div");
1338 new_version.classList.add("new_version");
1339 const link = `<a href="${release_url}" target="_blank" title="${title}">v${versions["latest_version"]}</a>`;
1340 new_version.innerHTML = `g4f ${link}&nbsp;&nbsp;🆕`;
1341 new_version.addEventListener("click", ()=>new_version.parentElement.removeChild(new_version));
1342 document.body.appendChild(new_version);
1337 1343 } else {
1338 1344 text += versions["version"];
1339 1345 }
1340 1346 document.getElementById("version_text").innerHTML = text
1341 1347 }
1342 setTimeout(load_version, 2000);
1348 setTimeout(load_version, 100);
1343 1349
1344 1350 [imageInput, cameraInput].forEach((el) => {
1345 1351 el.addEventListener('click', async () => {
Modified requirements-slim.txt +0 -1
@@ -3,7 +3,6 @@ pycryptodome
3 3 curl_cffi>=0.6.2
4 4 aiohttp
5 5 certifi
6 duckduckgo-search>=5.0
7 6 nest_asyncio
8 7 werkzeug
9 8 pillow