From 3c57aa8ece5cec3da9631788a3ffc8539a55060b Mon Sep 17 00:00:00 2001 From: Sage The DM Date: Wed, 18 Sep 2024 12:52:36 +0200 Subject: [PATCH 1/4] Tried to make the website responsive --- app/styles/header.css | 1 + app/styles/history.css | 2 +- app/styles/master.css | 1 + app/styles/responsive.css | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 app/styles/responsive.css diff --git a/app/styles/header.css b/app/styles/header.css index 8ecc019..abb1b66 100644 --- a/app/styles/header.css +++ b/app/styles/header.css @@ -10,6 +10,7 @@ header { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); z-index: 1000; font-family: var(--font-family); + height: 5vh; } header li { diff --git a/app/styles/history.css b/app/styles/history.css index 2aaa58d..24a5777 100644 --- a/app/styles/history.css +++ b/app/styles/history.css @@ -5,8 +5,8 @@ overflow: hidden; background-color: var(--history-background-color); padding: 1em; - border-radius: 2em; margin: 1em; + border-radius: 2em; } .history { diff --git a/app/styles/master.css b/app/styles/master.css index 4b21879..9223084 100644 --- a/app/styles/master.css +++ b/app/styles/master.css @@ -11,3 +11,4 @@ @import './input.css'; @import './faq.css'; @import './scrollbar.css'; +@import './responsive.css'; diff --git a/app/styles/responsive.css b/app/styles/responsive.css new file mode 100644 index 0000000..533118e --- /dev/null +++ b/app/styles/responsive.css @@ -0,0 +1,34 @@ +/* responsive.css */ + +/* Responsive behavior - applies only on smaller screens */ +@media (max-width: 1200px) { + /* Left panel as an overlay */ + .left-panel { + margin: 0 auto; + min-width: 100vw; + max-width: 100vw; + padding: 1em; + } + + .left-panel.hidden { + width: 0; /* Set width to 0 when hidden */ + visibility: hidden; /* Fully hide the panel */ + margin: 0; + padding: 0; + overflow: hidden; + } + + header { + height: 125px; + } + + header li { + flex-direction: column; + display: block; + padding: 2px; + } + + body { + margin-top: 100px; + } +} -- 2.39.5 From 75a7438881767c3d64cfd018df08568624e427a6 Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Wed, 18 Sep 2024 15:01:31 +0200 Subject: [PATCH 2/4] AHHHHHHHH HELP I CANT REVERT AHHHHHH --- app/styles/responsive.css | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/app/styles/responsive.css b/app/styles/responsive.css index 533118e..4bb6554 100644 --- a/app/styles/responsive.css +++ b/app/styles/responsive.css @@ -2,6 +2,7 @@ /* Responsive behavior - applies only on smaller screens */ @media (max-width: 1200px) { + /* Left panel as an overlay */ .left-panel { margin: 0 auto; @@ -11,8 +12,10 @@ } .left-panel.hidden { - width: 0; /* Set width to 0 when hidden */ - visibility: hidden; /* Fully hide the panel */ + width: 0; + /* Set width to 0 when hidden */ + visibility: hidden; + /* Fully hide the panel */ margin: 0; padding: 0; overflow: hidden; @@ -31,4 +34,24 @@ body { margin-top: 100px; } -} + + .conversation-container.expanded { + + width: 0; + /* Set width to 0 when hidden */ + visibility: hidden; + /* Fully hide the panel */ + margin: 0; + padding: 0; + overflow: hidden; + } + + .conversation-container.collapsed { + margin: 0 auto; + min-width: 100vw; + max-width: 100vw; + padding: 1em; + margin-left: 0; + + } +} \ No newline at end of file -- 2.39.5 From 30edc6e7959fe963f46c61b502fff3ceb1f4bbc0 Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Wed, 18 Sep 2024 16:16:53 +0200 Subject: [PATCH 3/4] chat history. --- app/InputBackend.tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/app/InputBackend.tsx b/app/InputBackend.tsx index ed02d47..44fb740 100644 --- a/app/InputBackend.tsx +++ b/app/InputBackend.tsx @@ -26,39 +26,44 @@ const handleCopyClick = () => { // Handle copy action }; -const InputBackend:React.FC = () => { +const InputBackend: React.FC = () => { async function prompt_mistral(model: string, prompt: string, system: string) { const apiKey = "m3kZRjN8DRSIo88r8Iti9hmKGWIklrLY"; - + const client = new Mistral({ apiKey: apiKey }); - + var chatResponse = await client.chat.complete({ model: model, messages: [{ role: 'user', content: prompt }, { role: 'system', content: system, }], }); - + if (chatResponse && chatResponse.choices && chatResponse.choices.length > 0) { if (chatResponse.choices[0].message.content) { addMessage('AI: ' + chatResponse.choices[0].message.content); - console.error('Error: Brain Not Found'); console.log(messages) } } else { console.error('Error: Unexpected API response:', chatResponse); } } - + const handleSendClick = (message: string) => { + var system = "You are a helpful assistant. The following is the chat history." + for (let index = 0; index < messages.length; index++) { + system += messages[index] + " "; + }; + addMessage('User: ' + message); - prompt_mistral("mistral-large-latest", message, "You are a helpful assistant.") + prompt_mistral("mistral-large-latest", message, system) }; + const [messages, setMessages] = useState([ 'User: Hello!', 'AI: Hi there!', 'User: How are you?', 'AI: I’m good, thank you!' ]); - + const addMessage = (message: string) => { setMessages((prevMessages) => [...prevMessages, message]); }; @@ -69,12 +74,12 @@ const InputBackend:React.FC = () => { onResendClick={handleResendClick} onEditClick={handleEditClick} onCopyClick={handleCopyClick} - /> + /> + /> ); }; -- 2.39.5 From 2327fc343a67a6dba5898c6368f491403eee9c90 Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Wed, 18 Sep 2024 16:29:58 +0200 Subject: [PATCH 4/4] Update app/styles/history.css --- app/styles/history.css | 1 + 1 file changed, 1 insertion(+) diff --git a/app/styles/history.css b/app/styles/history.css index 24a5777..d1adcd0 100644 --- a/app/styles/history.css +++ b/app/styles/history.css @@ -6,6 +6,7 @@ background-color: var(--history-background-color); padding: 1em; margin: 1em; + margin-right: 0; border-radius: 2em; } -- 2.39.5