diff --git a/GUI/back-end/main.py b/GUI/back-end/main.py index 76d6e9f..c9e05b9 100644 --- a/GUI/back-end/main.py +++ b/GUI/back-end/main.py @@ -36,7 +36,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']) @@ -48,7 +48,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}) @@ -77,4 +77,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 diff --git a/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx b/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx index 7f065b7..3129242 100644 --- a/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx +++ b/GUI/front-end/src/components/displays/chat/ChatDisplay.tsx @@ -36,10 +36,13 @@ 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