<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Travel Planner</title>
</head>
<body>
<script
defer
src="https://openai-widget.web.app/ChatComponent.bundle.js"
></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
// Check if the chat container exists
var chatContainer = document.getElementById("chat-container");
// If the chat container doesn't exist, create it
if (!chatContainer) {
chatContainer = document.createElement("div");
chatContainer.id = "chat-container";
document.body.appendChild(chatContainer);
}
let additionalInstructions = "User's favorite city is Paris."
// userId should be defined somewhere in your application
//additionalInstructions = "The current user id is" + userId
// Initialize the Chat component
if (window.ChatComponent) {
ChatComponent.init("<your-widget-id>", "#chat-container", additionalInstructions);
} else {
console.error("ChatComponent is not available");
}
});
</script>
</body>
</html>