Händelsestyrd läsning av apiEndpoint och useModel

This commit is contained in:
2024-07-30 23:45:07 +02:00
parent d038f1ac24
commit 5771e52c49
+20 -6
View File
@@ -14,14 +14,27 @@
<textarea id="userInput" placeholder="Type your message..." rows="5"></textarea> <textarea id="userInput" placeholder="Type your message..." rows="5"></textarea>
<button id="sendButton" onclick="sendMessage()">Send</button> <button id="sendButton" onclick="sendMessage()">Send</button>
<!-- Get the apiEndpoint --> <!-- Get the apiEndpoint and the useModel -->
<script> <!-- <script>
const apiEndpoint = window.apiEndpoint; const apiEndpoint = window.apiEndpoint;
const useModel = window.useModel; const useModel = window.useModel;
console.log("client.html - API Endpoint: ", apiEndpoint);
console.log("client.html - use model: ", useModel);
</script> -->
<script>
let apiEndpoint; // Make variable available outside of the scope of the event listener
let useModel; // Make variable available outside of the scope of the event listener
window.addEventListener('message', function(event) {
if (event.origin === 'http://localhost:5004') { // Make sure this matches your origin
const { apiEndpoint, useModel } = event.data;
console.log("client.html - API Endpoint: ", apiEndpoint);
console.log("client.html - use model: ", useModel);
}
});
</script> </script>
<!-- Marked for markdown rendering --> <!-- Marked-it for markdown rendering -->
<!-- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/markdown-it@14.1.0/dist/markdown-it.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/markdown-it@14.1.0/dist/markdown-it.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/markdown-it@14/dist/markdown-it.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/markdown-it@14/dist/markdown-it.min.js"></script>
@@ -40,8 +53,7 @@
</script> </script>
<!-- Get the javascript handling communication with the backend -->
<script src="/js/frontend.js"></script>
<script> <script>
const chatContainer = document.getElementById('chatbox'); const chatContainer = document.getElementById('chatbox');
@@ -67,6 +79,8 @@
</script> </script>
<!-- Get the javascript handling communication with the backend -->
<script src="/js/frontend.js"></script>
</body> </body>
</html> </html>