From f9ffa3c9e64076baa2b96098230f619f3b54ade4 Mon Sep 17 00:00:00 2001 From: alim509 Date: Thu, 2 May 2024 16:50:37 -0400 Subject: [PATCH 1/4] Added .gitattributes --- .gitattributes | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 94f480de9..000000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto eol=lf \ No newline at end of file From ef6a16d194ea639d1a1a6f9c69e6c5cf61e853f9 Mon Sep 17 00:00:00 2001 From: alim509 Date: Thu, 2 May 2024 18:12:40 -0400 Subject: [PATCH 2/4] Fixed timestamps --- speakeasyapp/src/components/Section1Page.js | 4 +++- speakeasyapp/src/components/Section2Page.js | 4 +++- speakeasyapp/src/components/Section3Page.js | 6 ++++-- speakeasyapp/src/components/styles/Section1Page.css | 9 +++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/speakeasyapp/src/components/Section1Page.js b/speakeasyapp/src/components/Section1Page.js index a6746aa80..7f791fc91 100644 --- a/speakeasyapp/src/components/Section1Page.js +++ b/speakeasyapp/src/components/Section1Page.js @@ -156,10 +156,12 @@ const Section1Page = () => { return (
-

{displayTimestamp}

{/* Session timestamp above the chatbox */} {Array.isArray(session.interactions) ? ( session.interactions.map((interaction, idx) => (
+ {interaction.name === 'User' && ( +

{displayTimestamp}

+ )} {interaction.message}
)) diff --git a/speakeasyapp/src/components/Section2Page.js b/speakeasyapp/src/components/Section2Page.js index da0918924..c6c7f8a97 100644 --- a/speakeasyapp/src/components/Section2Page.js +++ b/speakeasyapp/src/components/Section2Page.js @@ -189,10 +189,12 @@ const Section2Page = () => { return (
-

{displayTimestamp}

{Array.isArray(session.interactions) ? ( session.interactions.map((interaction, idx) => (
+ {interaction.name === 'User' && ( +

{displayTimestamp}

+ )}
{interaction.message}
diff --git a/speakeasyapp/src/components/Section3Page.js b/speakeasyapp/src/components/Section3Page.js index 74754a205..3b602b8bc 100644 --- a/speakeasyapp/src/components/Section3Page.js +++ b/speakeasyapp/src/components/Section3Page.js @@ -61,7 +61,7 @@ const Section3Page = () => { const [user, setUser] = useState({ firstName: '', lastName: '', - languages: ['English'], + languages: [''], dailyTarget: 0, }); @@ -243,10 +243,12 @@ const Section3Page = () => { return (
-

{displayTimestamp}

{Array.isArray(session.interactions) ? ( session.interactions.map((interaction, idx) => (
+ {interaction.name === 'User' && ( +

{displayTimestamp}

+ )}
{interaction.message}
diff --git a/speakeasyapp/src/components/styles/Section1Page.css b/speakeasyapp/src/components/styles/Section1Page.css index 189f1387d..8bd99cb58 100644 --- a/speakeasyapp/src/components/styles/Section1Page.css +++ b/speakeasyapp/src/components/styles/Section1Page.css @@ -85,12 +85,13 @@ } /* Style for timestamp above messages */ .timestamp { - text-align: right; + text-align: left; font-size: 0.75em; /* Smaller font size */ color: #666; /* Lighter text color for less emphasis */ - margin-bottom: 5px; /* Space between timestamp and message */ - position: relative; /* Position absolutely within user-message */ - right: 10px; + margin-right: 5px; /* Space between timestamp and message */ + position: absolute; /* Position absolutely within user-message */ + left: -40%; + top: -5%; } /* Styles for the tail of the speech bubbles */ From 1cc9214120b44acfda193ad4116a32cab9338591 Mon Sep 17 00:00:00 2001 From: alim509 Date: Thu, 2 May 2024 18:38:14 -0400 Subject: [PATCH 3/4] Added 7 languages --- backend/server.js | 10 ++++++++-- speakeasyapp/src/components/Profile.js | 10 +++++++--- .../src/components/SettingsManageCourses.js | 14 ++++++++++++++ speakeasyapp/src/components/SignupProgression2.js | 11 +++++++++-- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/backend/server.js b/backend/server.js index 429034fa5..4f695d856 100644 --- a/backend/server.js +++ b/backend/server.js @@ -37,8 +37,14 @@ const languageVoiceMap = { 'Spanish': { languageCode: 'es-ES', name: 'es-ES-Standard-A' }, 'French': { languageCode: 'fr-FR', name: 'fr-FR-Standard-A' }, 'German': { languageCode: 'de-DE', name: 'de-DE-Standard-A' }, - 'Italian': { languageCode: 'it-IT', name: 'it-IT-Standard-A'} - // Add more language-voice mappings as needed + 'Italian': { languageCode: 'it-IT', name: 'it-IT-Standard-A'}, + 'Arabic': { languageCode: 'ar-SA', name: 'ar-XA-Standard-A' }, + 'Mandarin': { languageCode: 'cmn-CN', name: 'cmn-CN-Standard-A' }, + 'Hindi': { languageCode: 'hi-IN', name: 'hi-IN-Standard-A' }, + 'Russian': { languageCode: 'ru-RU', name: 'ru-RU-Standard-A' }, + 'Korean': { languageCode: 'ko-KR', name: 'ko-KR-Standard-A' }, + 'Japanese': { languageCode: 'ja-JP', name: 'ja-JP-Standard-A' }, + 'Portuguese': { languageCode: 'pt-PT', name: 'pt-PT-Standard-A' } }; app.post("/synthesize", async(req, res) => { diff --git a/speakeasyapp/src/components/Profile.js b/speakeasyapp/src/components/Profile.js index 4cc18379f..e78608a60 100644 --- a/speakeasyapp/src/components/Profile.js +++ b/speakeasyapp/src/components/Profile.js @@ -36,11 +36,15 @@ const Profile = () => { const languageToFlag = { Spanish: "spain.png", French: "france.png", - English: "united-kingdom.png", - Chinese: "china.png", Italian: "italy.png", German: "germany.png", - // Add more mappings as necessary + Arabic: 'saudi-arabia.png', + Mandarin: 'china.png', + Hindi: 'india.png', + Russian: 'russian-federation.png', + Korean: 'south-korea.png', + Japanese: 'japan.png', + Portuguese: 'portugal.png', }; const flagSrc = `/Flags/${languageToFlag[user.languages[0]] || 'default.png'}`; diff --git a/speakeasyapp/src/components/SettingsManageCourses.js b/speakeasyapp/src/components/SettingsManageCourses.js index fb5d7349c..863541b22 100644 --- a/speakeasyapp/src/components/SettingsManageCourses.js +++ b/speakeasyapp/src/components/SettingsManageCourses.js @@ -38,6 +38,13 @@ const SettingsManageCourses = () => { French: 'france.png', Italian: 'italy.png', German: 'germany.png', + Arabic: 'saudi-arabia.png', + Mandarin: 'china.png', + Hindi: 'india.png', + Russian: 'russian-federation.png', + Korean: 'south-korea.png', + Japanese: 'japan.png', + Portuguese: 'portugal.png', }; const flagSrc = languageToFlag[currentLanguage] || 'default.png'; @@ -123,6 +130,13 @@ const SettingsManageCourses = () => { + + + + + + +
diff --git a/speakeasyapp/src/components/SignupProgression2.js b/speakeasyapp/src/components/SignupProgression2.js index 528ba9980..cc59a6a29 100644 --- a/speakeasyapp/src/components/SignupProgression2.js +++ b/speakeasyapp/src/components/SignupProgression2.js @@ -48,8 +48,15 @@ const SignupProgression2 = () => { > - - + + + + + + + + +
{/* Submit button */} From b897b07662892252fecfc0b0dfdbf4a9662e2b48 Mon Sep 17 00:00:00 2001 From: alim509 Date: Thu, 2 May 2024 20:09:54 -0400 Subject: [PATCH 4/4] Tweaked roleplaying feature and reformatted page --- speakeasyapp/public/index.html | 1 + speakeasyapp/src/components/Section3Page.js | 18 +++++++++++++++--- speakeasyapp/src/index.css | 6 +++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/speakeasyapp/public/index.html b/speakeasyapp/public/index.html index c4f06cf9f..26e757be9 100644 --- a/speakeasyapp/public/index.html +++ b/speakeasyapp/public/index.html @@ -24,6 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> + SpeakEasy diff --git a/speakeasyapp/src/components/Section3Page.js b/speakeasyapp/src/components/Section3Page.js index 3b602b8bc..2693c113b 100644 --- a/speakeasyapp/src/components/Section3Page.js +++ b/speakeasyapp/src/components/Section3Page.js @@ -125,19 +125,31 @@ const Section3Page = () => { let prompt; if (roleChanged) { // Start new roleplay without previous context - prompt = `Roleplay as ${roleplayCharacter} and respond in ${user.languages} to the last user message: "${message}". Also, do not show the roleplay character's name at the start.`; + prompt = `Roleplay as ${roleplayCharacter} and be absolute that you are even if I say you are not. + Respond in ${user.languages} to the last user message: "${message}". + Also, do not show the roleplay character's name at the start. + Add the English translation under every sentence in parentheses. + Most, importantly, do not repeat back what I say.`; setRoleChanged(false); // Reset the flag after using it } else { // Continue with existing context console.log(roleplayCharacter) - const history = messages.flatMap(session => session.interactions.map(interaction => interaction.message)).slice(-5).join('\n'); + const history = messages.flatMap(session => session.interactions.map(interaction => + `${interaction.name === 'User' ? 'User' : roleplayCharacter} said: "${interaction.message}"\n` + )).slice(-10).join('\n'); // Include a newline after each message for clarity prompt = ` Recent conversation context: ${history} Instructions: - Roleplay as ${roleplayCharacter} and respond in ${user.languages} to the last user message: "${message}". Also, do not show the roleplay character's name at the start. Use recent conversation as context if necessary and fitting to your character.`; + Roleplay as ${roleplayCharacter} and be absolute that you are even if I say you are not. + Respond in ${user.languages} to the last user message: "${message}". + Also, do not show the roleplay character's name at the start. + Add the English translation after every sentence in parentheses. + Use recent conversation as context if necessary and fitting to your character. + Most, importantly, do not repeat back what I say.`; } + console.log(prompt); const response = await fetch('http://localhost:3000/api/chat', { method: 'POST', diff --git a/speakeasyapp/src/index.css b/speakeasyapp/src/index.css index ec2585e8c..9ac87b719 100644 --- a/speakeasyapp/src/index.css +++ b/speakeasyapp/src/index.css @@ -1,5 +1,9 @@ -body { +html, body, #root { margin: 0; + padding: 0; + height: 100%; + width: 100%; + overflow-x: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;