From 727d1c03e05103e66a8733fe90238aacdfcc7d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Preik=C5=A1a?= Date: Tue, 28 May 2024 23:38:47 +0300 Subject: [PATCH 1/4] fix: fixes --- GUI/back-end/main.py | 4 ++-- GUI/front-end/.env.development | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/back-end/main.py b/GUI/back-end/main.py index c4c8bf9..dfe645a 100644 --- a/GUI/back-end/main.py +++ b/GUI/back-end/main.py @@ -41,7 +41,7 @@ def process(): return '' with open("key") as f: - openai.api_key = f.readline() + openai.api_key = f.readline().strip() discussions = [{"role": "system", "content": "I guessed number 5"}] discussions.append({"role": "user", "content": request_data}) @@ -55,4 +55,4 @@ def process(): # Run the app if __name__ == '__main__': - app.run(debug=True, port=8080) \ No newline at end of file + app.run(debug=True, host='0.0.0.0', port=8080) \ No newline at end of file diff --git a/GUI/front-end/.env.development b/GUI/front-end/.env.development index 133bda4..3d803f3 100644 --- a/GUI/front-end/.env.development +++ b/GUI/front-end/.env.development @@ -1 +1 @@ -VITE_API_URL=http://localhost:8080/api/v1 \ No newline at end of file +VITE_API_URL=http://34.29.163.210:8080/api/v1 \ No newline at end of file From b93db4b2aac46cf42f1fd1d62017985e83117283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Preik=C5=A1a?= Date: Tue, 28 May 2024 23:41:14 +0300 Subject: [PATCH 2/4] fix: error on cors --- GUI/back-end/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GUI/back-end/main.py b/GUI/back-end/main.py index dfe645a..a984ef9 100644 --- a/GUI/back-end/main.py +++ b/GUI/back-end/main.py @@ -29,7 +29,7 @@ app.register_blueprint(router_bp('/api/v1')) # Configurations -cors = CORS(app, origins=origins) +cors = CORS(app, resources={r"/*": {"origins": "*"}}) @app.route('/api/v1/request', methods=['POST']) From 1ca961133ff313263263411dc9057a12a8722a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Preik=C5=A1a?= Date: Tue, 28 May 2024 23:45:51 +0300 Subject: [PATCH 3/4] fix: updated isInputDisabled state --- GUI/front-end/src/components/displays/chat/ChatDisplay.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx b/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx index 7f065b7..9ababf5 100644 --- a/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx +++ b/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx @@ -36,6 +36,7 @@ export const ChatDisplay: React.FC = () => { ]); const responseResult = await sendRequest.mutateAsync(content); + setIsInputDisabled(false); setChatInstances((prevInstances) => [ ...prevInstances, From 900f0258472f698f4f4d97edeaf76964623ca494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Preik=C5=A1a?= Date: Tue, 28 May 2024 23:59:34 +0300 Subject: [PATCH 4/4] fix: added break lines --- GUI/front-end/src/components/displays/chat/ChatDisplay.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx b/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx index 9ababf5..3129242 100644 --- a/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx +++ b/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx @@ -38,9 +38,11 @@ export const ChatDisplay: React.FC = () => { const responseResult = await sendRequest.mutateAsync(content); setIsInputDisabled(false); + const formatedResponse = responseResult.replace(/(?:\r\n|\r|\n)/g, '
'); + setChatInstances((prevInstances) => [ ...prevInstances, - } author={applicationContext.name} content={responseResult} />, + } author={applicationContext.name} content={formatedResponse} />, ]); // Temporary mock up response