from fastapi import FastAPI app = FastAPI() @app.get("/example") def example(): new_final_ai_response = "这是 AIResponse 的内容" return {"AIResponse": new_final_ai_response} response = app.test_client().get("/example") response_data = response.json() ai_response = response_data["AIResponse"] print(ai_response)