Closed yimengqiangu closed 1 year ago
我配置CALLBACK_URL=http://127.0.0.1:8000/callback,它没有被调用 from fastapi import FastAPI from typing import List, TypedDict
app = FastAPI()
class Attachment(TypedDict): id: int url: str proxy_url: str filename: str content_type: str width: int height: int size: int ephemeral: bool
class EmbedsImage(TypedDict): url: str proxy_url: str
class Embed(TypedDict): type: str description: str image: EmbedsImage
class CallbackData(TypedDict): type: str id: int content: str attachments: List[Attachment] embeds: List[Embed] trigger_id: str
@app.post("/callback") async def callback(callback_data: CallbackData):
# callback_data.type # callback_data.id # callback_data.content # callback_data.attachments # callback_data.embeds # callback_data.trigger_id # 在这里进行处理和逻辑操作 return {"message": "Callback received"}
if name == "main": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000)
执行以上代码
python --version
No response
解决了吗,问下怎么操作的
问题简述
我配置CALLBACK_URL=http://127.0.0.1:8000/callback,它没有被调用 from fastapi import FastAPI from typing import List, TypedDict
app = FastAPI()
class Attachment(TypedDict): id: int url: str proxy_url: str filename: str content_type: str width: int height: int size: int ephemeral: bool
class EmbedsImage(TypedDict): url: str proxy_url: str
class Embed(TypedDict): type: str description: str image: EmbedsImage
class CallbackData(TypedDict): type: str id: int content: str attachments: List[Attachment] embeds: List[Embed] trigger_id: str
@app.post("/callback") async def callback(callback_data: CallbackData):
在这里可以访问解析后的参数
if name == "main": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000)
复现方式
执行以上代码
环境信息
python --version
)额外信息
No response
一点点的自我检查