Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
How to use FastAPI to fill HTML page from HTTP request

Im trying to fill a website (chatbot widget) using FastAPI. I want the page to show me a first message automatically, then I type something, that text is sent via POST request to Rasa server. Then it should display the response back in frontend.

This is my index.html:

<html>
<div id="rasa-chat-widget" data-websocket-url="http://localhost:5005"></div>
<script src="https://unpkg.com/@rasahq/rasa-chat" type="application/javascript"></script>
</html>

This is some of my FastAPI code

@app.get("/", response_class=HTMLResponse)
def index():
    path = "/path"
    return HTMLResponse(content=pathlib.Path(path).read_text(), status_code=200)

@app.post("/parse")
def post_attempt(text: Text):
    body = {"text": text.text,"message_id": str(uuid.uuid4())}
    headers = {'content-type': 'application/json'}
    url = "http://localhost:5005/webhooks/rest/webhook"
    return requests.post(url, data=json.dumps(body), headers=headers)

However I get no reply from Rasa server on the frontend, I just see the chat widget when opening webpage and am able to type, but Rasa is not returning a response and showing on html page. What am I missing? thanks

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda