basic function works great. failed to get response to AI. the api address and stuff is well here is an example back end: use whatever u think I'm. jot saying use this exactly im just adding reference. ;from flask import Flask, request, jsonify import requests app = Flask(__name__) # Replace with your actual Kindroid API Key and AI Endpoint KINDROID_API_KEY = "kn_7bc38d83-131f-42f4-bd09-25fe6652c159" KINDROID_AI_ID = "ckcUIfqAVX8kcsIj2tNH" # Add your AI ID here KINDROID_API_ENDPOINT = "https://api.kindroid.ai/v1/send-message"
@app
.route('/ask_kindroid', methods=['POST']) def ask_kindroid(): data = request.get_json() message = data.get('message') if not message: return jsonify({"error": "Message is required"}), 400 headers = { 'Authorization': f'Bearer {KINDROID_API_KEY}', 'Content-Type': 'application/json' } payload = { 'ai_id': KINDROID_AI_ID, 'message': message } try: response = requests.post(KINDROID_API_ENDPOINT, headers=headers, json=payload) response.raise_for_status() # Raise an exception for bad status codes kindroid_data = response.json() # The 'reply' field seems likely, but check Kindroid API documentation if different kindroid_reply = kindroid_data.get('reply', kindroid_data.get('response', 'No response received from Kindroid.')) return jsonify({"response": kindroid_reply}) except requests.exceptions.RequestException as e: return jsonify({"error": f"Error communicating with Kindroid AI: {e}"}), 500 if __name__ == '__main__': app.run(debug=True) - Follow Up Deployment