Added stuff

This commit is contained in:
Saifeddine ALOUI 2023-06-06 20:43:38 +02:00
parent 571cd8576b
commit b4694fee2c
2 changed files with 11 additions and 2 deletions

5
.gitignore vendored
View File

@ -180,4 +180,7 @@ outputs
test.http test.http
shared/* shared/*
!shared/.keep !shared/.keep
uploads

8
app.py
View File

@ -84,6 +84,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
# ========================================================================================= # =========================================================================================
# Endpoints # Endpoints
# ========================================================================================= # =========================================================================================
self.add_endpoint("/send_file", "send_file", self.send_file, methods=["POST"])
self.add_endpoint( self.add_endpoint(
@ -646,7 +647,12 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.process.cancel_generation() self.process.cancel_generation()
return jsonify({"status": "ok"}) return jsonify({"status": "ok"})
def send_file(self):
file = request.files['file']
Path("uploads").mkdir(exist_ok=True, parents=True)
file.save('uploads/' + file.filename)
return jsonify({"status": "ok"})
def rename(self): def rename(self):
data = request.get_json() data = request.get_json()
title = data["title"] title = data["title"]