This commit is contained in:
hackrobot
2024-07-16 07:34:09 +08:00
parent abea0b82f4
commit 371e0e21b6

View File

@@ -1,4 +1,5 @@
from fastapi import FastAPI, HTTPException, Depends
from fastapi.responses import JSONResponse
from sqlalchemy.orm import Session
from typing import List, Optional,Any
@@ -30,6 +31,9 @@ def get_db():
finally:
db.close()
@app.get("/")
def root():
return {"message": "Hello World"}
@@ -55,7 +59,14 @@ def add_user(
nickname=nickname, remark=remark, wechat_number=wechat_number,
wxid=wxid, gender=gender, friendaddtime=friendaddtime,
openid=openid))
return f'''{nickname}你好,\n我是机器人助理\n一名开发者,副业:跨境电商,#公众号:异度世界'''
response=f'''{nickname}你好,\n我是机器人助理\n一名开发者,副业:跨境电商,#公众号:异度世界'''
content = {
"answer": response,
"answer_type": "text",
}
headers = {"Content-Type": "application/json"}
return JSONResponse(content=content, headers=headers)
# return f'''{nickname}你好,\n我是机器人助理\n一名开发者,副业:跨境电商,#公众号:异度世界'''
@app.get("/users/")
def read_users(skip: int = 0, limit: int = 10, db: Session = Depends(get_db)):