Skip to content

Conversation

ayoubelmhamdi
Copy link

add support to send data like:

fileTMP="$1"
curl -s -F file=@"${fileTMP}" http://127.0.0.1:5500/
-@app.route('/')
+@app.route("/", methods=["GET", "POST"])
-async def index() -> None:
+async def index() -> str:
     """
     Main function
     """
     bot = EdgeGPT.Chatbot(proxy=args.proxy)

+    if request.method == "GET":
+        question = request.args.get("text")
+        print("get")
+    else:
+        file = request.files["file"]
+        text = file.read().decode("utf-8")
+        question = text
+        print("Post reading the file", question)

@aledipa aledipa merged commit a930a64 into aledipa:main Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants