35 lines
618 B
Python
35 lines
618 B
Python
import sys
|
|
|
|
from fastapi import FastAPI
|
|
import uvicorn
|
|
|
|
from brain_openai import CloudChatBrain
|
|
|
|
|
|
|
|
#def start_application():
|
|
# app = FastAPI()
|
|
# # app.include_router(api_router)
|
|
# # brain = CloudChatBrain()
|
|
# return app
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) == 1:
|
|
port = 8890
|
|
else:
|
|
port = int(sys.argv[1])
|
|
|
|
app = FastAPI()
|
|
|
|
@app.post("/command/")
|
|
def post_command(payload: dict):
|
|
prompt = payload.get("prompt")
|
|
return {"response": prompt}
|
|
|
|
|
|
#app = start_application()
|
|
uvicorn.run(app, host="0.0.0.0", port=port, log_level="debug")
|