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

XFEstudio/gpt4free

Add live update

1525fcd3
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

5 个文件 +25 -8
Modified README.md +2 -3
@@ -112,11 +112,10 @@ docker run -p 8080:8080 -p 7900:7900 \
112 112 mkdir -p ${PWD}/har_and_cookies ${PWD}/generated_media
113 113 chown -R 1000:1000 ${PWD}/har_and_cookies ${PWD}/generated_media
114 114 docker run \
115 -p 1337:1337 \
115 -p 1337:1337 -p 8080:1337 \
116 116 -v ${PWD}/har_and_cookies:/app/har_and_cookies \
117 117 -v ${PWD}/generated_media:/app/generated_media \
118 hlohaus789/g4f:latest-slim \
119 /bin/sh -c 'rm -rf /app/g4f && pip install -U g4f[slim] && python -m g4f --debug'
118 hlohaus789/g4f:latest-slim
120 119 ```
121 120
122 121 5. **Access the Client Interface:**
Modified docker-compose-slim.yml +2 -2
@@ -7,9 +7,9 @@ services:
7 7 build:
8 8 context: .
9 9 dockerfile: docker/Dockerfile-slim
10 command: python -m g4f --debug --port 8080
11 10 volumes:
12 - .:/app
11 - ./generated_media:/app/generated_media
12 - ./har_and_cookies:/app/har_and_cookies
13 13 ports:
14 14 - '8080:8080'
15 15 - '1337:8080'
Modified docker/Dockerfile-slim +2 -1
@@ -31,7 +31,8 @@ ENV HOME /home/$G4F_USER
31 31 ENV PATH "${HOME}/.local/bin:${PATH}"
32 32
33 33 RUN git clone https://github.com/xtekky/gpt4free.git $G4F_DIR
34 RUN crontab docker/update-cron
34 RUN printf "0 * * * * python -m etc.update\n" > cronfile
35 RUN crontab cronfile
35 36 RUN pip install --no-cache-dir -r requirements-slim.txt
36 37
37 38 CMD python -m g4f --debug --reload
Deleted docker/update-cron +0 -2
@@ -1,2 +0,0 @@
1 0 * * * * g4f python -m etc.update
2 #
Added etc/tool/update.py +19 -0
@@ -0,0 +1,19 @@
1 import os
2 from g4f import version
3 from subprocess import call, STDOUT
4
5 if __name__ == "__main__":
6 if not os.getenv("G4F_LIVE"):
7 print("Live mode is not enabled. Exiting update script.")
8 exit(0)
9 command = ["git", "fetch"]
10 call(command, stderr=STDOUT)
11 command = ["git", "reset", "--hard", "master"]
12 call(command, stderr=STDOUT)
13 command = ["git" ,"pull", "origin", "main"]
14 call(command, stderr=STDOUT)
15 current_version = version.get_git_version()
16 with open("g4f/debug.py", "a") as f:
17 f.write(f"\nversion: str = '{current_version}'\n")
18 command = ["pip", "install", "-U", "-r" , "requirements-slim.txt"]
19 call(command, stderr=STDOUT)