A Flask web application that provides a chat interface to interact with your Google Cloud Dialogflow CX agent
- Python 3.9 or higher
- Google Cloud Project with Dialogflow CX and AI Application enabled
- Dialogflow CX agent created
-
Clone or download this project
-
Install dependencies
pip install -r requirements.txt
-
Set up Google Cloud authentication
Option A: Using gcloud CLI
gcloud auth application-default login
Option B: Using service account key
- Download your service account key from Google Cloud Console
- Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable
-
Configure your Dialogflow CX settings
Create a
.envfile in the project root:# Flask Configuration SECRET_KEY=your-secret-key-change-this-in-production # Google Cloud Dialogflow CX Configuration PROJECT_ID=your-google-cloud-project-id LOCATION_ID=us-central1 AGENT_ID=your-dialogflow-cx-agent-id LANGUAGE_CODE=en-us # Google Cloud Authentication GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json
## Usage
1. **Start the application**
```bash
python app.py
-
Open your browser Navigate to
http://localhost:5000 -
Start chatting Type your messages and interact with your Dialogflow CX agent
GET /: Main chat interfacePOST /chat: Send a message to Dialogflow CXGET /config: View current configuration (for debugging)POST /reset_session: Reset the current conversation session