input: Write a function to create a simple chatbot using Python and Dialogflow, which can answer questions about the current days of the week. The function should create a Flask app, set up an API, and handle requests to detect user intent. If the session ID is not present, it should create one.
  assert create_chatbot()
  assert detect_intent_text("What day is it today?")
output: 
  def create_chatbot():
      from flask import Flask, request, jsonify
      from google.cloud import dialogflow
      import uuid
  
      app = Flask(__name__)
  
      @app.route('/detect_intent', methods=['POST'])
      def detect_intent():
          data = request.json
          project_id = "your-project-id"
          session_id = data.get('session_id', str(uuid.uuid4()))
          text = data['text']
          language_code = "en"
  
          session_client = dialogflow.SessionsClient()
          session = session_client.session_path(project_id, session_id)
          text_input = dialogflow.TextInput(text=text, language_code=language_code)
          query_input = dialogflow.QueryInput(text=text_input)
          response = session_client.detect_intent(session=session, query_input=query_input)
  
          return jsonify({
              'session_id': session_id,
              'response': response.query_result.fulfillment_text
          })
  
      return app
  
  def detect_intent_text(text):
      app = create_chatbot()
      with app.test_client() as client:
          response = client.post('/detect_intent', json={'text': text})
          return response.json['response']
  