File size: 3,498 Bytes
d397a55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width" />
	<title>Renewable Energy Chat</title>
	<link rel="stylesheet" href="style.css" />
	<style>
		.chat-container {
			max-width: 800px;
			margin: 0 auto;
			padding: 20px;
		}
		.chat-box {
			height: 400px;
			border: 1px solid #ccc;
			border-radius: 5px;
			padding: 10px;
			overflow-y: scroll;
			margin-bottom: 10px;
			background-color: #f9f9f9;
		}
		.message {
			margin-bottom: 10px;
			padding: 8px 12px;
			border-radius: 18px;
			max-width: 70%;
		}
		.user-message {
			background-color: #007bff;
			color: white;
			margin-left: auto;
		}
		.bot-message {
			background-color: #e9ecef;
			color: black;
			margin-right: auto;
		}
		.input-area {
			display: flex;
			gap: 10px;
		}
		.input-area input {
			flex-grow: 1;
			padding: 10px;
			border-radius: 5px;
			border: 1px solid #ccc;
		}
		.input-area button {
			padding: 10px 20px;
			background-color: #007bff;
			color: white;
			border: none;
			border-radius: 5px;
			cursor: pointer;
		}
	</style>
</head>
<body>
	<div class="chat-container">
		<h1>Renewable Energy Chat</h1>
		<div class="chat-box" id="chatBox">
			<div class="message bot-message">
				Welcome to the Renewable Energy Chat! How can I help you with renewable energy forecasting today?
			</div>
		</div>
		<div class="input-area">
			<input type="text" id="userInput" placeholder="Ask about renewable energy...">
			<button onclick="sendMessage()">Send</button>
		</div>
	</div>

	<script>
		function sendMessage() {
			const userInput = document.getElementById('userInput');
			const chatBox = document.getElementById('chatBox');
			
			if (userInput.value.trim() === '') return;
			
			// Add user message
			const userMessage = document.createElement('div');
			userMessage.className = 'message user-message';
			userMessage.textContent = userInput.value;
			chatBox.appendChild(userMessage);
			
			// Generate bot response
			const botMessage = document.createElement('div');
			botMessage.className = 'message bot-message';
			
			// Simple response logic
			const question = userInput.value.toLowerCase();
			if (question.includes('forecast') || question.includes('dự báo')) {
				botMessage.textContent = 'Renewable energy forecasting is challenging due to weather dependency. Our research combines Reinforcement Learning and Adversarial Training for more accurate predictions.';
			} else if (question.includes('solar') || question.includes('mặt trời')) {
				botMessage.textContent = 'Solar energy forecasting requires handling daily patterns and weather conditions. Advanced models can predict output with over 90% accuracy for short-term forecasts.';
			} else if (question.includes('wind') || question.includes('gió')) {
				botMessage.textContent = 'Wind power forecasting is complex due to turbulence and local effects. Our adversarial training approach helps handle extreme wind conditions better.';
			} else {
				botMessage.textContent = 'Thank you for your interest in renewable energy forecasting. Could you be more specific about your question regarding solar, wind, or forecasting methods?';
			}
			
			chatBox.appendChild(botMessage);
			userInput.value = '';
			chatBox.scrollTop = chatBox.scrollHeight;
		}
		
		// Allow sending with Enter key
		document.getElementById('userInput').addEventListener('keypress', function(e) {
			if (e.key === 'Enter') {
				sendMessage();
			}
		});
	</script>
</body>
</html>