mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-23 02:52:29 +03:00
Add armv7 docker image, Remove Bing provider, add update banner
This commit is contained in:
parent
0eb1d3ed50
commit
6b48af1757
16
.github/workflows/publish-workflow.yaml
vendored
16
.github/workflows/publish-workflow.yaml
vendored
@ -57,12 +57,26 @@ jobs:
|
|||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GHCR_PAT }}
|
password: ${{ secrets.GHCR_PAT }}
|
||||||
|
|
||||||
|
- name: Build and push armv7 image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: docker/Dockerfile-armv7
|
||||||
|
platforms: linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
hlohaus789/g4f:latest-armv7
|
||||||
|
hlohaus789/g4f:${{ github.ref_name }}-armv7
|
||||||
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
G4F_VERSION=${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Build and push small images
|
- name: Build and push small images
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile-slim
|
file: docker/Dockerfile-slim
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
hlohaus789/g4f:latest-slim
|
hlohaus789/g4f:latest-slim
|
||||||
|
67
docker/Dockerfile-armv7
Normal file
67
docker/Dockerfile-armv7
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
FROM python:slim-bookworm
|
||||||
|
|
||||||
|
ARG G4F_VERSION
|
||||||
|
ARG G4F_USER=g4f
|
||||||
|
ARG G4F_USER_ID=1000
|
||||||
|
ARG PYDANTIC_VERSION=1.8.1
|
||||||
|
|
||||||
|
ENV G4F_VERSION $G4F_VERSION
|
||||||
|
ENV G4F_USER $G4F_USER
|
||||||
|
ENV G4F_USER_ID $G4F_USER_ID
|
||||||
|
ENV G4F_DIR /app
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get upgrade -y \
|
||||||
|
&& apt-get install -y git \
|
||||||
|
&& apt-get install --quiet --yes --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
# Add user and user group
|
||||||
|
&& groupadd -g $G4F_USER_ID $G4F_USER \
|
||||||
|
&& useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
|
||||||
|
&& mkdir -p /var/log/supervisor \
|
||||||
|
&& chown "${G4F_USER_ID}:${G4F_USER_ID}" /var/log/supervisor \
|
||||||
|
&& echo "${G4F_USER}:${G4F_USER}" | chpasswd \
|
||||||
|
&& python -m pip install --upgrade pip
|
||||||
|
|
||||||
|
USER $G4F_USER_ID
|
||||||
|
WORKDIR $G4F_DIR
|
||||||
|
|
||||||
|
ENV HOME /home/$G4F_USER
|
||||||
|
ENV PATH "${HOME}/.local/bin:${PATH}"
|
||||||
|
|
||||||
|
# Create app dir and copy the project's requirements file into it
|
||||||
|
RUN mkdir -p $G4F_DIR
|
||||||
|
COPY requirements-min.txt $G4F_DIR
|
||||||
|
COPY requirements-slim.txt $G4F_DIR
|
||||||
|
|
||||||
|
# Upgrade pip for the latest features and install the project's Python dependencies.
|
||||||
|
RUN pip install --no-cache-dir -r requirements-min.txt \
|
||||||
|
&& pip install --no-cache-dir --no-binary setuptools \
|
||||||
|
Cython==0.29.22 \
|
||||||
|
setuptools \
|
||||||
|
# Install PyDantic
|
||||||
|
&& pip install \
|
||||||
|
-vvv \
|
||||||
|
--no-cache-dir \
|
||||||
|
--no-binary :all: \
|
||||||
|
--global-option=build_ext \
|
||||||
|
--global-option=-j8 \
|
||||||
|
pydantic==${PYDANTIC_VERSION}
|
||||||
|
RUN cat requirements-slim.txt | xargs -n 1 pip install --no-cache-dir || true
|
||||||
|
|
||||||
|
# Remove build packages
|
||||||
|
RUN pip uninstall --yes \
|
||||||
|
Cython \
|
||||||
|
setuptools
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Clean up build deps
|
||||||
|
RUN apt-get purge --auto-remove --yes \
|
||||||
|
build-essential \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
USER $G4F_USER_ID
|
||||||
|
|
||||||
|
# Copy the entire package into the container.
|
||||||
|
ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
|
@ -29,11 +29,11 @@ ENV PATH "${HOME}/.local/bin:${PATH}"
|
|||||||
|
|
||||||
# Create app dir and copy the project's requirements file into it
|
# Create app dir and copy the project's requirements file into it
|
||||||
RUN mkdir -p $G4F_DIR
|
RUN mkdir -p $G4F_DIR
|
||||||
COPY requirements-min.txt $G4F_DIR
|
|
||||||
COPY requirements-slim.txt $G4F_DIR
|
COPY requirements-slim.txt $G4F_DIR
|
||||||
|
|
||||||
# Upgrade pip for the latest features and install the project's Python dependencies.
|
# Upgrade pip for the latest features and install the project's Python dependencies.
|
||||||
RUN cat requirements-slim.txt | xargs -n 1 pip install --no-cache-dir || true
|
RUN pip install --no-cache-dir -r requirements-slim.txt \
|
||||||
|
&& pip install --no-cache-dir duckduckgo-search>=5.0
|
||||||
|
|
||||||
# Copy the entire package into the container.
|
# Copy the entire package into the container.
|
||||||
ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
|
ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
|
@ -280,10 +280,9 @@ The G4F AsyncClient supports a wide range of AI models and providers, allowing y
|
|||||||
- OpenAI
|
- OpenAI
|
||||||
- Google (for Gemini)
|
- Google (for Gemini)
|
||||||
- Anthropic
|
- Anthropic
|
||||||
- Bing
|
- Microsoft Copilot
|
||||||
- Custom providers
|
- Custom providers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**To use a specific model or provider, specify it when creating the client or in the API call:**
|
**To use a specific model or provider, specify it when creating the client or in the API call:**
|
||||||
```python
|
```python
|
||||||
|
@ -14,7 +14,6 @@ from .local import *
|
|||||||
from .AIUncensored import AIUncensored
|
from .AIUncensored import AIUncensored
|
||||||
from .Airforce import Airforce
|
from .Airforce import Airforce
|
||||||
from .AmigoChat import AmigoChat
|
from .AmigoChat import AmigoChat
|
||||||
from .Bing import Bing
|
|
||||||
from .Blackbox import Blackbox
|
from .Blackbox import Blackbox
|
||||||
from .ChatGpt import ChatGpt
|
from .ChatGpt import ChatGpt
|
||||||
from .ChatGptEs import ChatGptEs
|
from .ChatGptEs import ChatGptEs
|
||||||
|
@ -8,17 +8,17 @@ import asyncio
|
|||||||
from urllib import parse
|
from urllib import parse
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
|
|
||||||
from ..typing import AsyncResult, Messages, ImageType, Cookies
|
from ...typing import AsyncResult, Messages, ImageType, Cookies
|
||||||
from ..image import ImageRequest
|
from ...image import ImageRequest
|
||||||
from ..errors import ResponseError, ResponseStatusError, RateLimitError
|
from ...errors import ResponseError, ResponseStatusError, RateLimitError
|
||||||
from ..requests import DEFAULT_HEADERS
|
from ...requests import DEFAULT_HEADERS
|
||||||
from ..requests.aiohttp import StreamSession
|
from ...requests.aiohttp import StreamSession
|
||||||
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
|
from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
|
||||||
from .helper import get_random_hex
|
from ..helper import get_random_hex
|
||||||
from .bing.upload_image import upload_image
|
from ..bing.upload_image import upload_image
|
||||||
from .bing.conversation import Conversation, create_conversation, delete_conversation
|
from ..bing.conversation import Conversation, create_conversation, delete_conversation
|
||||||
from .needs_auth.BingCreateImages import BingCreateImages
|
from ..needs_auth.BingCreateImages import BingCreateImages
|
||||||
from .. import debug
|
from ... import debug
|
||||||
|
|
||||||
class Tones:
|
class Tones:
|
||||||
"""
|
"""
|
||||||
@ -35,7 +35,7 @@ class Bing(AsyncGeneratorProvider, ProviderModelMixin):
|
|||||||
"""
|
"""
|
||||||
label = "Microsoft Copilot in Bing"
|
label = "Microsoft Copilot in Bing"
|
||||||
url = "https://bing.com/chat"
|
url = "https://bing.com/chat"
|
||||||
working = True
|
working = False
|
||||||
supports_message_history = True
|
supports_message_history = True
|
||||||
default_model = "Balanced"
|
default_model = "Balanced"
|
||||||
default_vision_model = "gpt-4-vision"
|
default_vision_model = "gpt-4-vision"
|
@ -32,3 +32,4 @@ from .GPTalk import GPTalk
|
|||||||
from .Hashnode import Hashnode
|
from .Hashnode import Hashnode
|
||||||
from .Ylokh import Ylokh
|
from .Ylokh import Ylokh
|
||||||
from .OpenAssistant import OpenAssistant
|
from .OpenAssistant import OpenAssistant
|
||||||
|
from .Bing import Bing
|
@ -108,6 +108,25 @@ body {
|
|||||||
border: 1px solid var(--blur-border);
|
border: 1px solid var(--blur-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.new_version {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
padding: 10px;
|
||||||
|
font-weight: 500;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
color: var(--colour-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.white .new_version {
|
||||||
|
color: var(--colour-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.new_version a {
|
||||||
|
color: var(--colour-4);
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
}
|
||||||
|
|
||||||
.conversations {
|
.conversations {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
padding: var(--section-gap);
|
padding: var(--section-gap);
|
||||||
|
@ -1331,15 +1331,21 @@ async function load_version() {
|
|||||||
document.title = 'g4f - ' + versions["version"];
|
document.title = 'g4f - ' + versions["version"];
|
||||||
let text = "version ~ "
|
let text = "version ~ "
|
||||||
if (versions["version"] != versions["latest_version"]) {
|
if (versions["version"] != versions["latest_version"]) {
|
||||||
let release_url = 'https://github.com/xtekky/gpt4free/releases/tag/' + versions["latest_version"];
|
let release_url = 'https://github.com/xtekky/gpt4free/releases/latest';
|
||||||
let title = `New version: ${versions["latest_version"]}`;
|
let title = `New version: ${versions["latest_version"]}`;
|
||||||
text += `<a href="${release_url}" target="_blank" title="${title}">${versions["version"]}</a> 🆕`;
|
text += `<a href="${release_url}" target="_blank" title="${title}">${versions["version"]}</a> 🆕`;
|
||||||
|
const new_version = document.createElement("div");
|
||||||
|
new_version.classList.add("new_version");
|
||||||
|
const link = `<a href="${release_url}" target="_blank" title="${title}">v${versions["latest_version"]}</a>`;
|
||||||
|
new_version.innerHTML = `g4f ${link} 🆕`;
|
||||||
|
new_version.addEventListener("click", ()=>new_version.parentElement.removeChild(new_version));
|
||||||
|
document.body.appendChild(new_version);
|
||||||
} else {
|
} else {
|
||||||
text += versions["version"];
|
text += versions["version"];
|
||||||
}
|
}
|
||||||
document.getElementById("version_text").innerHTML = text
|
document.getElementById("version_text").innerHTML = text
|
||||||
}
|
}
|
||||||
setTimeout(load_version, 2000);
|
setTimeout(load_version, 100);
|
||||||
|
|
||||||
[imageInput, cameraInput].forEach((el) => {
|
[imageInput, cameraInput].forEach((el) => {
|
||||||
el.addEventListener('click', async () => {
|
el.addEventListener('click', async () => {
|
||||||
|
@ -3,7 +3,6 @@ pycryptodome
|
|||||||
curl_cffi>=0.6.2
|
curl_cffi>=0.6.2
|
||||||
aiohttp
|
aiohttp
|
||||||
certifi
|
certifi
|
||||||
duckduckgo-search>=5.0
|
|
||||||
nest_asyncio
|
nest_asyncio
|
||||||
werkzeug
|
werkzeug
|
||||||
pillow
|
pillow
|
||||||
|
Loading…
Reference in New Issue
Block a user