File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 1
- from fastapi import APIRouter , Request
1
+ from fastapi import APIRouter , FastAPI
2
2
from fastapi .responses import JSONResponse
3
3
4
4
router = APIRouter ()
5
+ app = FastAPI ()
5
6
6
7
@router .get ('/api6' )
7
- async def get_text_from_user (request : Request ):
8
- request_body = await request .json ()
9
- user_input = request_body .get ("input_text" , "" )
10
- file_text = user_input [:200 ] # Read the first 200 characters from the user input
11
-
8
+ async def get_text_from_file ():
9
+ with open ('input.txt' , 'r' ) as file :
10
+ file_text = file .read (200 )
12
11
return JSONResponse (content = {"blendData" : file_text })
12
+
13
+ @router .post ('/api7' )
14
+ async def write_text_to_file (text : str ):
15
+ with open ('input.txt' , 'w' ) as file :
16
+ file .write (text )
17
+ return JSONResponse (content = {"message" : "Text successfully written to input.txt" })
18
+
19
+ app .include_router (router )
Original file line number Diff line number Diff line change 1
- fuck that niggaa
1
+ hello i am Friday your personal assistant
You can’t perform that action at this time.
0 commit comments