mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-05 18:20:35 -08:00
Add live update
This commit is contained in:
parent
f71a729948
commit
1525fcd3e0
5 changed files with 25 additions and 8 deletions
19
etc/tool/update.py
Normal file
19
etc/tool/update.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import os
|
||||
from g4f import version
|
||||
from subprocess import call, STDOUT
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not os.getenv("G4F_LIVE"):
|
||||
print("Live mode is not enabled. Exiting update script.")
|
||||
exit(0)
|
||||
command = ["git", "fetch"]
|
||||
call(command, stderr=STDOUT)
|
||||
command = ["git", "reset", "--hard", "master"]
|
||||
call(command, stderr=STDOUT)
|
||||
command = ["git" ,"pull", "origin", "main"]
|
||||
call(command, stderr=STDOUT)
|
||||
current_version = version.get_git_version()
|
||||
with open("g4f/debug.py", "a") as f:
|
||||
f.write(f"\nversion: str = '{current_version}'\n")
|
||||
command = ["pip", "install", "-U", "-r" , "requirements-slim.txt"]
|
||||
call(command, stderr=STDOUT)
|
||||
Loading…
Add table
Add a link
Reference in a new issue