public void SendMessageToRasa(string msg) { // Create a json object from user message PostMessageJson postMessage = new PostMessageJson { sender = "user", message = msg }; string jsonBody = JsonUtility.ToJson(postMessage); print("User json : " + jsonBody); // Create a post request with the data to send to Rasa server StartCoroutine(PostRequest(rasa_url, jsonBody)); }
private void SendWebCameraImage() { Color32[] imageDataColor32 = webcam.WebcamTexture.GetPixels32(); //TODO: ad-hoc solution, the only quick way to know whether web cam was initialized bool webCameraInitialized = imageDataColor32.Length != 256; if (webCameraInitialized == false) { return; } PostMessageJson postMessageJson = new PostMessageJson() { imageData = Color32ArrayToByteArray(imageDataColor32) }; string jsonBody = JsonUtility.ToJson(postMessageJson); emotionRequest = StartCoroutine(PostRequest(apiUrl, jsonBody)); }