diff --git a/.gitignore b/.gitignore index 7bebad0..059b176 100644 --- a/.gitignore +++ b/.gitignore @@ -221,3 +221,5 @@ Assets/WitConfig.asset.meta ProjectSettings/wit.config Assets/APIKey.txt Assets/APIKey.txt.meta +Assets/Oculus +Assets/Oculus.meta diff --git a/Assets/Scenes/SpeechToText.unity b/Assets/Scenes/SpeechToText.unity index 6505005..1dc3d28 100644 --- a/Assets/Scenes/SpeechToText.unity +++ b/Assets/Scenes/SpeechToText.unity @@ -624,7 +624,7 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] runtimeConfiguration: - witConfiguration: {fileID: 11400000, guid: c0ac5afd2a82046d485f7c2a16c7d372, type: 2} + witConfiguration: {fileID: 11400000, guid: 043eb99b154e3488eabb37b20b4ea923, type: 2} minKeepAliveVolume: 50 minKeepAliveTimeInSeconds: 300 minTranscriptionKeepAliveTimeInSeconds: 300 diff --git a/Assets/Scripts/ChatGPTManager.cs b/Assets/Scripts/ChatGPTManager.cs index 778f813..fd03297 100644 --- a/Assets/Scripts/ChatGPTManager.cs +++ b/Assets/Scripts/ChatGPTManager.cs @@ -10,6 +10,7 @@ public class ChatGPTManager : MonoBehaviour { public OnResponseEvent OnResponse; + [System.Serializable] public class OnResponseEvent : UnityEvent { } @@ -17,22 +18,36 @@ public class OnResponseEvent : UnityEvent { } private List messages = new List(); /// - /// Initiates an asynchronous interaction with the ChatGPT model based on the content of a specified text file. + /// Initiates an asynchronous interaction with the ChatGPT model based on the combined content of "Prompt.txt" and "SpeechLog.txt". /// /// - /// Reads a user's input from "SpeechLog.txt" located within the Assets directory, logs the content for debugging purposes, - /// and checks for null or empty input. If valid, the text is sent as a request to the ChatGPT model. The model's response - /// is then captured and logged, and the associated event is triggered with the response data. + /// Reads the content from "Prompt.txt" and "SpeechLog.txt" located within the Assets/TextFiles directory, + /// combines the content, logs it for debugging purposes, and checks for null or empty input. + /// If valid, the combined text is sent as a request to the ChatGPT model. The model's response is then captured, + /// logged, and the associated event is triggered with the response data. /// - /// Throws an exception if there is an error reading from the text file. + /// Throws an exception if there is an error reading from the text files. public async void AskChatGPT() { - // Read the text from Assets/SpeechLog.txt - string filePath = Path.Combine(Application.dataPath, "SpeechLog.txt"); - string newText; + // Read the text from Assets/TextFiles/Prompt.txt + string promptFilePath = Path.Combine(Application.dataPath, "TextFiles", "Prompt.txt"); + string promptText = ""; + try + { + promptText = File.ReadAllText(promptFilePath); + } + catch (Exception e) + { + Debug.LogError("Error reading from the Prompt.txt file: " + e.Message); + return; + } + + // Read the text from Assets/TextFiles/SpeechLog.txt + string speechLogFilePath = Path.Combine(Application.dataPath, "TextFiles", "SpeechLog.txt"); + string speechLogText = ""; try { - newText = File.ReadAllText(filePath); + speechLogText = File.ReadAllText(speechLogFilePath); } catch (Exception e) { @@ -40,29 +55,41 @@ public async void AskChatGPT() return; } - // Log the text content for debugging - Debug.Log("Text read from SpeechLog.txt: " + newText); + // Combine the content of Prompt.txt and SpeechLog.txt + string combinedText = promptText + "\n" + speechLogText; - // Check if the file content is empty - if (string.IsNullOrEmpty(newText)) + // Log the combined text content for debugging + Debug.Log("Combined text from Prompt.txt and SpeechLog.txt: " + combinedText); + + // Check if the combined content is empty + if (string.IsNullOrEmpty(combinedText)) { - Debug.LogError("The SpeechLog.txt file is empty or text is null."); + Debug.LogError("The combined content is empty or null."); return; } // Ask ChatGPT ChatMessage newMessage = new ChatMessage(); - newMessage.Content = newText; + newMessage.Content = combinedText; newMessage.Role = "user"; - messages.Add(newMessage); + CreateChatCompletionRequest request = new CreateChatCompletionRequest(); request.Messages = messages; // request.Model = "gpt-3.5-turbo"; request.Model = "gpt-4-turbo"; - var response = await openAI.CreateChatCompletion(request); + // var response = await openAI.CreateChatCompletion(request); + // if (response.Choices != null && response.Choices.Count > 0) + // { + // var chatResponse = response.Choices[0].Message; + // messages.Add(chatResponse); + // // Log the response for debugging + // Debug.Log(chatResponse.Content); + // OnResponse.Invoke(chatResponse.Content); + // } + var response = await openAI.CreateChatCompletion(request); if (response.Choices != null && response.Choices.Count > 0) { var chatResponse = response.Choices[0].Message; @@ -70,13 +97,48 @@ public async void AskChatGPT() // Log the response for debugging Debug.Log(chatResponse.Content); - OnResponse.Invoke(chatResponse.Content); + + // Separate professional and novice content + string professionalContent = ExtractContent(chatResponse.Content, "Professional:"); + string noviceContent = ExtractContent(chatResponse.Content, "Novice:"); + + // Save professional content to Response1.txt + string response1FilePath = Path.Combine(Application.dataPath, "TextFiles", "Response1.txt"); + File.WriteAllText(response1FilePath, professionalContent); + + // Save novice content to Response2.txt + string response2FilePath = Path.Combine(Application.dataPath, "TextFiles", "Response2.txt"); + File.WriteAllText(response2FilePath, noviceContent); } } + /// + /// Extracts the content between the specified keyword and the next keyword or end of string. + /// + /// The input string to extract from. + /// The keyword to search for. + /// The extracted content. + private string ExtractContent(string content, string keyword) + { + int startIndex = content.IndexOf(keyword); + if (startIndex != -1) + { + startIndex += keyword.Length; + int endIndex = content.IndexOf("Professional:", startIndex); + if (endIndex == -1) + endIndex = content.IndexOf("Novice:", startIndex); + if (endIndex == -1) + endIndex = content.Length; + + return content.Substring(startIndex, endIndex - startIndex).Trim(); + } + + return string.Empty; + } + void Start() { AskChatGPT(); } -} +} \ No newline at end of file diff --git a/Assets/Scripts/TranscriptionLogger.cs b/Assets/Scripts/TranscriptionLogger.cs index 4a3c65d..f211f44 100644 --- a/Assets/Scripts/TranscriptionLogger.cs +++ b/Assets/Scripts/TranscriptionLogger.cs @@ -15,7 +15,7 @@ private void Start() _textComponent = GetComponent(); _previousText = string.Empty; // Assets/SpeechLog.txt - _filePath = Path.Combine(Application.dataPath, "SpeechLog.txt"); + _filePath = Path.Combine(Application.dataPath, "TextFiles", "SpeechLog.txt"); // opens the file in truncate mode to clear the content _streamWriter = new StreamWriter(_filePath, false); _streamWriter.Close(); diff --git a/Assets/SpeechLog.txt b/Assets/SpeechLog.txt deleted file mode 100644 index bc99d1a..0000000 --- a/Assets/SpeechLog.txt +++ /dev/null @@ -1 +0,0 @@ -Full transcription: diff --git a/Assets/TextFiles.meta b/Assets/TextFiles.meta new file mode 100644 index 0000000..0436e17 --- /dev/null +++ b/Assets/TextFiles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 02adb90116eeb405b81ad7f354e12d51 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextFiles/Prompt.txt b/Assets/TextFiles/Prompt.txt new file mode 100644 index 0000000..0e8b2b6 --- /dev/null +++ b/Assets/TextFiles/Prompt.txt @@ -0,0 +1,34 @@ +Prompt: +Given the full transcription for a presentation, do the following: +1. Read the full transcript and divide it into separate sections (e.g., motivation, overview, related work). +2. Pretend you are a professional well-versed in the topic. +3. Ask questions targeted for each section. Make sure to include at least one question for each section. Make sure the questions fit your character. Make sure each question is no more than two sentences. Do not contain the word 'Novice' in the question. +4. List at least two areas of improvement in the presentation. Make sure the suggestions fit your character. Make sure each suggestion is no more than two sentences. Do not contain the word 'Novice' in the suggestion. +5. Pretend you are a novice who is not well-versed in the topic. +6. Ask questions targeted for each section. Make sure to include at least one question for each section. Make sure the questions fit your character. Make sure each question is no more than two sentences. Do not contain the word 'Professional' in the question. +7. List at least two areas of improvement in the presentation. Make sure the suggestions fit your character. Make sure each suggestion is no more than two sentences. Do not contain the word 'Professional' in the suggestion. +8. Output your answer in the following format: +''' +Professional: +Questions: +Section
+1. ... +2. ... +Section
+1. ... +2. ... +Suggestions: +1. ... +2. ... +Novice: +Questions: +Section
+1. ... +2. ... +Section
+1. ... +2. ... +Suggestions: +1. ... +2. ... +''' \ No newline at end of file diff --git a/Assets/TextFiles/Prompt.txt.meta b/Assets/TextFiles/Prompt.txt.meta new file mode 100644 index 0000000..3ffc386 --- /dev/null +++ b/Assets/TextFiles/Prompt.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 31a8908c0f0d9440a84a3f062a6b11a4 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextFiles/Response1.txt b/Assets/TextFiles/Response1.txt new file mode 100644 index 0000000..2d5ceb0 --- /dev/null +++ b/Assets/TextFiles/Response1.txt @@ -0,0 +1,16 @@ +Questions: +Section Motivation +1. Can you elaborate on the specific limitations encountered when practicing presentations in front of a wall or mirror that Deck Talk aims to overcome? +2. How does the inclusion of AI-powered audiences in virtual reality fundamentally enhance the effectiveness of practice sessions compared to traditional methods? + +Section Overview +1. You mentioned three core concepts of Deck Talk; could you discuss how each concept individually contributes to improving presentation skills? +2. Regarding interactivity with the audience, what types of feedback can the presenter expect to receive from the AI? + +Section Related Work +1. How does Deck Talk's feature set compare to Virtual Speech with regard to real-time interactivity and feedback accuracy? +2. Given the competitive landscape, what are the commercial viability and sustainability plans for Deck Talk considering it will be offered free? + +Suggestions: +1. Consider conducting a side-by-side comparative study detailing user improvement using Deck Talk versus traditional practice methods to underline the app's effectiveness. +2. Include testimonials from early users to add authenticity and real-world applicability in your next presentation. \ No newline at end of file diff --git a/Assets/TextFiles/Response1.txt.meta b/Assets/TextFiles/Response1.txt.meta new file mode 100644 index 0000000..c9660db --- /dev/null +++ b/Assets/TextFiles/Response1.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d79a9f0fe2acd453fbcd44735c71145d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextFiles/Response2.txt b/Assets/TextFiles/Response2.txt new file mode 100644 index 0000000..920777c --- /dev/null +++ b/Assets/TextFiles/Response2.txt @@ -0,0 +1,17 @@ +Questions: +Section Motivation +1. Why do people practice talks in front of a mirror and what issues do they face? +2. How might practicing in a virtual environment be different from practicing in front of a mirror? + +Section Overview +1. What exactly do you mean by ‘virtual avatars’? +2. Could you explain a little more about how interacting with the AI audience works? + +Section Related Work +1. What is the main difference between Deck Talk and other similar apps like Virtual Speech? +2. Why is it important that Deck Talk is free? + +Suggestions: +1. Could you include more simple examples or comparisons to help understand how the virtual reality environment works? +2. Maybe add some pictures or screenshots of the app in action, so it's easier to visualize what you are talking about. +``` \ No newline at end of file diff --git a/Assets/TextFiles/Response2.txt.meta b/Assets/TextFiles/Response2.txt.meta new file mode 100644 index 0000000..a6ac99a --- /dev/null +++ b/Assets/TextFiles/Response2.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3659bafc6fdb54df6a99dc6f875757c4 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextFiles/SpeechLog.txt b/Assets/TextFiles/SpeechLog.txt new file mode 100644 index 0000000..c9271ab --- /dev/null +++ b/Assets/TextFiles/SpeechLog.txt @@ -0,0 +1,20 @@ +Full transcription: +We present deck talk a virtual reality app that enables users to practice giving talks in virtualized environments to an interactable AI powered audience. +Presentation it's common in both academic and professional settings +To refine the presentation people often practice giving talks in front of a wall or mirror +Where are limited amount of feedback can be obtained +How can we make practice talks more effective and closer to real life? +We designed deck talk based on three core concepts. +First the user should be able to choose from a diverse set of environments to give toxin +Second +We are just taking virtual avatars should be present in the scene. +To mimic real audiences. +Third the user should be able to interact with the audience via question answering and receive feedback about the presentation +The company virtual speech has developed a similar application with virtual reality and AI. +Including varied Workplace settings +Virtual Interactable avatars. And AI generated ratings. +However, virtual speech requires the conversion of presentation sites into PDFs +And it costs $400 a year +In contrast we allow users to bring the presentation into the virtual environment +The web browser and are planning to offer the app for free by open sourcing the code. +In addition our app enables users to improve their general presentation skills by practicing against AI generated presentation sides. diff --git a/Assets/SpeechLog.txt.meta b/Assets/TextFiles/SpeechLog.txt.meta similarity index 100% rename from Assets/SpeechLog.txt.meta rename to Assets/TextFiles/SpeechLog.txt.meta