Use OpenAI GPT models to QA your Confluence documentation. See the Medium companion article https://medium.com/@francois.ascani/running-chatgpt-on-your-internal-confluence-documentation-d7761aa8fc68 for a detailed description of the code.
PS: I would replace the (hyper) basic Flask app with a Streamlit application. See https://medium.com/@francois.ascani/how-i-built-a-ask-me-anything-chatbot-web-app-with-gpt-3-python-and-streamlit-9f7e6ee4b4e1 as an example.