From cb8d54576413647778d3c31d6420d31b80a94b6f Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Thu, 19 Sep 2024 16:24:16 +0200 Subject: [PATCH 1/2] uh oh --- app/ProcessAPI.js | 30 +++++++++++++++--------------- py/api.py | 10 +++++----- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/ProcessAPI.js b/app/ProcessAPI.js index f32e175..c161c62 100644 --- a/app/ProcessAPI.js +++ b/app/ProcessAPI.js @@ -10,30 +10,30 @@ onmessage = function (e) { }; switch (functionName) { case "getAccess": - axios.get('https://localhost:5000/interstellar/api/ai_create') + axios.get('https://127.0.0.1:5000/interstellar/api/ai_create') .then(Response => { - postMessage(Response.data.access_token) - }).catch(error => { - console.error("Error with GET Token request:", error) - }) + postMessage(Response.data.access_token) + }).catch(error => { + console.error("Error with GET Token request:", error) + }) break case "postRequest": - axios.post('https://localhost:5000/interstellar/api/ai_send', data) + axios.post('https://127.0.0.1:5000/interstellar/api/ai_send', data) .then(Response => { postMessage(Response.data) }).catch(error => { - console.error("Error:", error) + console.error("Error:", error) }) break case "getResponse": - axios.get('https://localhost:5000/interstellar/api/ai_get?access_token='+access_token) - .then(Response => { - postMessage(Response.data.response) - }).catch(error => { - console.error("Error with GET response request:", error) - }) + axios.get('https://127.0.0.1:5000/interstellar/api/ai_get?access_token=' + access_token) + .then(Response => { + postMessage(Response.data.response) + }).catch(error => { + console.error("Error with GET response request:", error) + }) break } - - + + } \ No newline at end of file diff --git a/py/api.py b/py/api.py index d372b22..9cf2e63 100644 --- a/py/api.py +++ b/py/api.py @@ -6,11 +6,12 @@ import secrets class AI: @staticmethod - def process_local(model, message, system, return_class, access_token): + def process_local(model, messages, return_class, access_token): stream = ollama.chat( model=model, - messages=[{'role': 'user', 'content': message}, {'role': 'system', 'content': system}], + messages=messages, stream=True, + options={"temperature": 0}, ) for chunk in stream: @@ -35,13 +36,12 @@ class API: @self.app.route('/interstellar/api/ai_send', methods=['POST']) def send_ai(): data = request.get_json() - message = data.get('message') + messages = data.get('messages') ai_model = data.get('ai_model') - system_prompt = data.get('system_prompt') access_token = data.get('access_token') if access_token not in self.ai_response: return jsonify({'status': 401, 'error': 'Invalid access token'}) - self.ai.process_local(ai_model, message, system_prompt, self, access_token) + self.ai.process_local(ai_model, messages, self, access_token) return jsonify({'status': 200}) @self.app.route('/interstellar/api/ai_get', methods=['GET']) From 06b92492ae3c3592b913705b22f4fe8e3532e9a6 Mon Sep 17 00:00:00 2001 From: sageTheDM Date: Thu, 19 Sep 2024 16:27:24 +0200 Subject: [PATCH 2/2] Responsive design update --- app/Header.tsx | 2 +- app/styles/responsive.css | 120 +++++++++++++++++++++++++------------- 2 files changed, 82 insertions(+), 40 deletions(-) diff --git a/app/Header.tsx b/app/Header.tsx index 1b28f1a..2a1c9d0 100644 --- a/app/Header.tsx +++ b/app/Header.tsx @@ -14,7 +14,7 @@ const Header: React.FC = ({ onViewChange, showDivs, toggleDivs, sho
  • -
  • diff --git a/app/styles/responsive.css b/app/styles/responsive.css index d485f15..1a66c07 100644 --- a/app/styles/responsive.css +++ b/app/styles/responsive.css @@ -1,51 +1,93 @@ /* Responsive behavior - applies only on smaller screens */ @media (max-width: 1200px) { + *{ + margin: 0; + padding: 0; + } + + /* Header styles */ + header { + flex-direction: column; + align-items: center; + position: relative; + top: 0; + left: 0; + margin-top: 5px; + padding-top: 0; + width: 100%; + } + + /* Container styles */ + .container { + display: flex; + flex-direction: column; + align-items: center; + width: 100vw; + overflow: hidden; + margin: 0; + padding: 0; + } + header li{ + display: flex; + flex-direction: column; + justify-content: center; + margin: 0; + } + + header li button { + margin: 2px; + margin-bottom: 0; + } + + header li img { + height: 1.5em; + vertical-align: middle; + margin-top: 10px; + } + + /* Left panel styles */ + .left-panel { + display: none; /* Initially hidden */ + min-width: 90%; /* Takes full width when visible */ + margin: 0; + } + + .left-panel.visible { display: block; } - .container { - display: flex; - justify-content: center; /* Centers horizontally */ - width: 90vw; - margin-top: 10vh; - } - - .left-panel { - display: none; /* Initially hidden */ - min-width: 90%; /* Takes full width when shown */ - margin: 0; - } - - - .conversation-container { - width: 90%; + /* Conversation container styles */ + .conversation-container { + width: 90%; + height: 90%; } - .left-panel.visible { - display: block; + .conversation-container.collapsed { + width: 0; + padding: 0; + border: none; + overflow: hidden; } - .conversation-container.collapsed { - display: none; + .conversation-container.expanded { + width: 100%; } - .conversation-container.expanded { - width: 100%; - } - - .grid { + /* Grid styles */ + .grid { grid-template-columns: 1fr; /* One item per line */ } - .model-box { - max-width: none; /* Remove max-width constraint */ - margin: 0 auto; /* Center each model-box */ + /* Model box styles */ + .model-box { + max-width: none; /* Remove max-width */ + margin: 0 auto; /* Center each model-box */ } - .input { + /* Input styles */ + .input { grid-column: 1 / -1; - flex-direction: row; gap: 10px; padding: 0.5em; margin: 0 auto; @@ -53,16 +95,16 @@ width: 90%; } - .input input { - font-size: 1em; /* Adjust font size */ - max-width: 65%; - margin-right: 0; + .input input { + font-size: 1em; /* Adjust font size */ + max-width: 65%; + margin-right: 0; } - .input button { - height: 40px; /* Adjust button height */ - width: 40px; /* Adjust button width */ - font-size: 1.2em; /* Adjust button font size */ - margin: auto; + .input button { + height: 40px; /* Adjust button height */ + width: 40px; /* Adjust button width */ + font-size: 1.2em; /* Adjust button font size */ + margin: auto; } } \ No newline at end of file