From 7711eef38c3eba28fe7f95f514f4556103f56268 Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:11:18 -0400 Subject: [PATCH 01/10] Add test server --- test_interface.html | 51 +++++++++++++++++++++++++++++++++++++++++++++ test_server.py | 20 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 test_interface.html create mode 100644 test_server.py diff --git a/test_interface.html b/test_interface.html new file mode 100644 index 0000000..e53d574 --- /dev/null +++ b/test_interface.html @@ -0,0 +1,51 @@ + + + + + Chat²GPT Test Rig + + + +

Chat²GPT Test Rig

+
+
+

+ +
+ +

+ +
+
+ +
+ + + + \ No newline at end of file diff --git a/test_server.py b/test_server.py new file mode 100644 index 0000000..0205d6a --- /dev/null +++ b/test_server.py @@ -0,0 +1,20 @@ +from flask import Flask, request, jsonify +from main import process_event + +app = Flask(__name__) + +@app.route('/post', methods=['POST']) +def google_chat_event(): + try: + # Get the Google Chat-like event data from the request body + event_data = request.json + + # Call process_event function from main.py + response = process_event(event_data) + + return jsonify(response) + except Exception as e: + return jsonify({"error": str(e)}), 500 + +if __name__ == "__main__": + app.run(port=5000) From d4f81e6f5a53938f96b98f05804a21737ea93097 Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:13:53 -0400 Subject: [PATCH 02/10] Update .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4d4b985..23d21bd 100644 --- a/.gitignore +++ b/.gitignore @@ -160,6 +160,7 @@ cython_debug/ #.idea/ .DS_Store +.env # Docs site _site/ @@ -167,4 +168,4 @@ _site/ .jekyll-cache/ .jekyll-metadata .bundle/ -vendor/ \ No newline at end of file +vendor/ From 53ee14ecebd0d2ccf8f861448619cfd6574eada3 Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:26:18 -0400 Subject: [PATCH 03/10] Update gcp-deploy.yml --- .github/workflows/gcp-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gcp-deploy.yml b/.github/workflows/gcp-deploy.yml index 7a30140..ee7fe88 100644 --- a/.github/workflows/gcp-deploy.yml +++ b/.github/workflows/gcp-deploy.yml @@ -7,6 +7,8 @@ on: paths: - '**.py' - 'requirements.txt' + paths-ignore: + - 'test*' workflow_dispatch: jobs: From 1e7c40be089059bbccc0c7bb277b4b423134e985 Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:39:36 -0400 Subject: [PATCH 04/10] Update test_server.py --- test_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test_server.py b/test_server.py index 0205d6a..8574475 100644 --- a/test_server.py +++ b/test_server.py @@ -1,7 +1,11 @@ from flask import Flask, request, jsonify from main import process_event -app = Flask(__name__) +app = Flask(__name__, static_url_path='', static_folder='.') + +@app.route('/') +def root(): + return send_from_directory('.', 'test_interface.html') @app.route('/post', methods=['POST']) def google_chat_event(): From cfd385d37c705280e9b28c638ec244845353dfeb Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:41:34 -0400 Subject: [PATCH 05/10] Update test_server.py --- test_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_server.py b/test_server.py index 8574475..9e95706 100644 --- a/test_server.py +++ b/test_server.py @@ -1,4 +1,4 @@ -from flask import Flask, request, jsonify +from flask import Flask, request, jsonify, send_from_directory from main import process_event app = Flask(__name__, static_url_path='', static_folder='.') From 49630674d59d4290c46dc08db336c79b6d697216 Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 19:49:02 -0400 Subject: [PATCH 06/10] Update gcp-deploy.yml --- .github/workflows/gcp-deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/gcp-deploy.yml b/.github/workflows/gcp-deploy.yml index ee7fe88..7a30140 100644 --- a/.github/workflows/gcp-deploy.yml +++ b/.github/workflows/gcp-deploy.yml @@ -7,8 +7,6 @@ on: paths: - '**.py' - 'requirements.txt' - paths-ignore: - - 'test*' workflow_dispatch: jobs: From eb6a0b18af734cb7515726848f25c5a9d0db6c1a Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 20:25:24 -0400 Subject: [PATCH 07/10] Update test_interface.html --- test_interface.html | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/test_interface.html b/test_interface.html index e53d574..598bbe4 100644 --- a/test_interface.html +++ b/test_interface.html @@ -10,10 +10,6 @@

Chat²GPT Test Rig




- -
- -

@@ -23,24 +19,13 @@

Chat²GPT Test Rig

- \ No newline at end of file + From 58d3c6c40e5c521ff7505e69fd1483828785f86a Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 20:55:26 -0400 Subject: [PATCH 08/10] Update test_server.py --- test_server.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test_server.py b/test_server.py index 9e95706..08532b2 100644 --- a/test_server.py +++ b/test_server.py @@ -10,15 +10,12 @@ def root(): @app.route('/post', methods=['POST']) def google_chat_event(): try: - # Get the Google Chat-like event data from the request body - event_data = request.json - - # Call process_event function from main.py - response = process_event(event_data) - - return jsonify(response) + # Get the event data from the request body + response = process_event(request) + return response except Exception as e: return jsonify({"error": str(e)}), 500 if __name__ == "__main__": app.run(port=5000) + From 7fb824e67528e6c9284862476baa7de4b311a5ef Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 22:19:46 -0400 Subject: [PATCH 09/10] HTMX < jQuery --- test_interface.html | 34 ++++++++++++++++++++++------------ test_server.py | 14 ++++++++++++-- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/test_interface.html b/test_interface.html index 598bbe4..8908de8 100644 --- a/test_interface.html +++ b/test_interface.html @@ -3,11 +3,11 @@ Chat²GPT Test Rig - +

Chat²GPT Test Rig

-
+


@@ -15,21 +15,31 @@

Chat²GPT Test Rig

- diff --git a/test_server.py b/test_server.py index 08532b2..e4617e5 100644 --- a/test_server.py +++ b/test_server.py @@ -1,5 +1,6 @@ from flask import Flask, request, jsonify, send_from_directory from main import process_event +import json app = Flask(__name__, static_url_path='', static_folder='.') @@ -10,6 +11,16 @@ def root(): @app.route('/post', methods=['POST']) def google_chat_event(): try: + # Debug: Print the raw request data + print("Raw Request Data:", request.data) + + # Debug: Try to load JSON manually + try: + json.loads(request.data) + print("JSON is well-formed") + except json.JSONDecodeError as e: + print("JSON Decode Error:", e) + # Get the event data from the request body response = process_event(request) return response @@ -17,5 +28,4 @@ def google_chat_event(): return jsonify({"error": str(e)}), 500 if __name__ == "__main__": - app.run(port=5000) - + app.run(port=5000, debug=True) From ee07da67882e07dba9f9a6f061cb07202c575dc1 Mon Sep 17 00:00:00 2001 From: Justin Hayes <52832301+justinh-rahb@users.noreply.github.com> Date: Sat, 2 Sep 2023 22:22:23 -0400 Subject: [PATCH 10/10] Update test_server.py --- test_server.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test_server.py b/test_server.py index e4617e5..37a263c 100644 --- a/test_server.py +++ b/test_server.py @@ -14,13 +14,6 @@ def google_chat_event(): # Debug: Print the raw request data print("Raw Request Data:", request.data) - # Debug: Try to load JSON manually - try: - json.loads(request.data) - print("JSON is well-formed") - except json.JSONDecodeError as e: - print("JSON Decode Error:", e) - # Get the event data from the request body response = process_event(request) return response