mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
Added get available space
This commit is contained in:
parent
f4e177e948
commit
e97e6ca3a8
5
.gitignore
vendored
5
.gitignore
vendored
@ -177,4 +177,7 @@ outputs
|
|||||||
# ignore installation files
|
# ignore installation files
|
||||||
.installed
|
.installed
|
||||||
|
|
||||||
test.http
|
test.http
|
||||||
|
|
||||||
|
shared/*
|
||||||
|
!shared/.keep
|
1
api/langchain.py
Normal file
1
api/langchain.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# TODO : implement
|
13
app.py
13
app.py
@ -44,6 +44,8 @@ from gevent.pywsgi import WSGIServer
|
|||||||
import requests
|
import requests
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
import logging
|
import logging
|
||||||
|
import psutil
|
||||||
|
|
||||||
log = logging.getLogger('werkzeug')
|
log = logging.getLogger('werkzeug')
|
||||||
log.setLevel(logging.ERROR)
|
log.setLevel(logging.ERROR)
|
||||||
|
|
||||||
@ -82,6 +84,11 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
# =========================================================================================
|
# =========================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
self.add_endpoint(
|
||||||
|
"/get_available_space", "get_available_space", self.get_available_space, methods=["GET"]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
self.add_endpoint(
|
self.add_endpoint(
|
||||||
"/list_bindings", "list_bindings", self.list_bindings, methods=["GET"]
|
"/list_bindings", "list_bindings", self.list_bindings, methods=["GET"]
|
||||||
)
|
)
|
||||||
@ -461,6 +468,12 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
print("Set config results:")
|
print("Set config results:")
|
||||||
print(result)
|
print(result)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
def get_available_space(self):
|
||||||
|
current_drive = Path.cwd().anchor
|
||||||
|
disk_usage = psutil.disk_usage(current_drive)
|
||||||
|
available_space = disk_usage.free
|
||||||
|
return jsonify({"available_space":available_space})
|
||||||
|
|
||||||
def list_bindings(self):
|
def list_bindings(self):
|
||||||
bindings_dir = Path('./bindings') # replace with the actual path to the models folder
|
bindings_dir = Path('./bindings') # replace with the actual path to the models folder
|
||||||
|
@ -240,6 +240,21 @@ This Flask server provides various endpoints to manage and interact with the cha
|
|||||||
- "/help": GET request endpoint to display the help page.
|
- "/help": GET request endpoint to display the help page.
|
||||||
- "/get_all_personalities": GET request endpoint to get all personalities array
|
- "/get_all_personalities": GET request endpoint to get all personalities array
|
||||||
- "/get_personality": GET request endpoint to get speciffic data based on request
|
- "/get_personality": GET request endpoint to get speciffic data based on request
|
||||||
|
- "/get_available_space": GET request endpoint to retrieve the available space in the current folder's drive.
|
||||||
|
Method: GET
|
||||||
|
Description: Retrieves the available space in bytes for the current folder's drive.
|
||||||
|
Response:
|
||||||
|
Content-Type: application/json
|
||||||
|
Body: JSON object with a single entry 'available_space' containing the available space in bytes.
|
||||||
|
Example Response:
|
||||||
|
json
|
||||||
|
Copy code
|
||||||
|
{
|
||||||
|
"available_space": 1234567890
|
||||||
|
}
|
||||||
|
Example Usage:
|
||||||
|
Request: GET /disk_space
|
||||||
|
Response: 200 OK
|
||||||
|
|
||||||
## TODO Endpoints:
|
## TODO Endpoints:
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
tqdm
|
tqdm
|
||||||
|
psutil
|
||||||
flask
|
flask
|
||||||
flask_socketio
|
flask_socketio
|
||||||
pytest
|
pytest
|
||||||
@ -7,3 +8,4 @@ markdown
|
|||||||
gevent
|
gevent
|
||||||
gevent-websocket
|
gevent-websocket
|
||||||
pyaipersonality>=0.0.14
|
pyaipersonality>=0.0.14
|
||||||
|
langchain
|
0
shared/.keep
Normal file
0
shared/.keep
Normal file
Loading…
Reference in New Issue
Block a user