move files
Browse files
angrybird.py β games/game_angrybird.py
RENAMED
|
File without changes
|
snake.py β games/game_snake.py
RENAMED
|
File without changes
|
main_util.py β games/game_util.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from fastapi import HTTPException, status
|
| 2 |
|
| 3 |
-
import
|
| 4 |
-
import
|
| 5 |
|
| 6 |
|
| 7 |
GAME_ANGRY_BIRD = 'angrybird'
|
|
@@ -10,7 +10,7 @@ GAME_SNAKE = 'snake'
|
|
| 10 |
|
| 11 |
def nlp(game: str, command: str):
|
| 12 |
if game == GAME_ANGRY_BIRD:
|
| 13 |
-
return
|
| 14 |
if game == GAME_SNAKE:
|
| 15 |
-
return
|
| 16 |
-
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
|
|
|
| 1 |
from fastapi import HTTPException, status
|
| 2 |
|
| 3 |
+
import games.game_snake as game_snake
|
| 4 |
+
import games.game_angrybird as game_angrybird
|
| 5 |
|
| 6 |
|
| 7 |
GAME_ANGRY_BIRD = 'angrybird'
|
|
|
|
| 10 |
|
| 11 |
def nlp(game: str, command: str):
|
| 12 |
if game == GAME_ANGRY_BIRD:
|
| 13 |
+
return game_angrybird.process(command)
|
| 14 |
if game == GAME_SNAKE:
|
| 15 |
+
return game_snake.process(command)
|
| 16 |
+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
main.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
-
import
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
@@ -11,4 +11,4 @@ async def root():
|
|
| 11 |
|
| 12 |
@app.get("/nlp")
|
| 13 |
def test(game: str, command: str):
|
| 14 |
-
return
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
+
import games.game_util as game_util
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
|
|
| 11 |
|
| 12 |
@app.get("/nlp")
|
| 13 |
def test(game: str, command: str):
|
| 14 |
+
return game_util.nlp(game, command)
|