renamed endpoint

This commit is contained in:
Saifeddine ALOUI 2023-05-28 08:53:54 +02:00
parent e97e6ca3a8
commit d193319fa6
2 changed files with 13 additions and 8 deletions

11
app.py
View File

@ -85,7 +85,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
self.add_endpoint(
"/get_available_space", "get_available_space", self.get_available_space, methods=["GET"]
"/disk_usage", "disk_usage", self.disk_usage, methods=["GET"]
)
@ -469,11 +469,14 @@ class Gpt4AllWebUI(GPT4AllAPI):
print(result)
return jsonify(result)
def get_available_space(self):
def disk_usage(self):
current_drive = Path.cwd().anchor
disk_usage = psutil.disk_usage(current_drive)
available_space = disk_usage.free
return jsonify({"available_space":available_space})
return jsonify({
"total_space":disk_usage.total,
"available_space":disk_usage.free,
"percent_usage":disk_usage.percent
})
def list_bindings(self):
bindings_dir = Path('./bindings') # replace with the actual path to the models folder

View File

@ -240,18 +240,20 @@ This Flask server provides various endpoints to manage and interact with the cha
- "/help": GET request endpoint to display the help page.
- "/get_all_personalities": GET request endpoint to get all personalities array
- "/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.
- "/disk_usage": 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
```json
{
"available_space": 1234567890
"total_space":1000000000000,
"available_space":515358106014,
"percent_usage":51.53
}
```
Example Usage:
Request: GET /disk_space
Response: 200 OK