add button click and display
Browse files- .idea/.gitignore +3 -0
- .idea/Ask-ANRG.iml +12 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- static/script.js +10 -0
- static/style.css +11 -2
.idea/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
.idea/Ask-ANRG.iml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$" />
|
5 |
+
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
|
6 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
+
</component>
|
8 |
+
<component name="PyDocumentationSettings">
|
9 |
+
<option name="format" value="PLAIN" />
|
10 |
+
<option name="myDocStringFormat" value="Plain" />
|
11 |
+
</component>
|
12 |
+
</module>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/Ask-ANRG.iml" filepath="$PROJECT_DIR$/.idea/Ask-ANRG.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
static/script.js
CHANGED
@@ -2,6 +2,16 @@ const sendBtn = document.getElementById('send-btn');
|
|
2 |
const userInput = document.getElementById('user-input');
|
3 |
const apiKeyInput = document.getElementById('api-key-input');
|
4 |
const chatBox = document.getElementById('chat-box');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
sendBtn.addEventListener('click', () => {
|
7 |
const message = userInput.value.trim();
|
|
|
2 |
const userInput = document.getElementById('user-input');
|
3 |
const apiKeyInput = document.getElementById('api-key-input');
|
4 |
const chatBox = document.getElementById('chat-box');
|
5 |
+
const questionButtons = document.querySelectorAll('.question_btn');
|
6 |
+
questionButtons.forEach(btn => {
|
7 |
+
console.log(btn)
|
8 |
+
btn.addEventListener('click', function() {
|
9 |
+
console.log("questionButtons clicked: ", this)
|
10 |
+
const buttonTextContent = this.innerHTML; // Get the content of the button
|
11 |
+
userInput.value = buttonTextContent; // Set the user input to the button's content
|
12 |
+
sendBtn.click(); // Trigger the sending process
|
13 |
+
});
|
14 |
+
});
|
15 |
|
16 |
sendBtn.addEventListener('click', () => {
|
17 |
const message = userInput.value.trim();
|
static/style.css
CHANGED
@@ -12,8 +12,9 @@ body {
|
|
12 |
margin: 50px auto;
|
13 |
background-color: #fff;
|
14 |
padding: 20px;
|
|
|
15 |
border-radius: 5px;
|
16 |
-
|
17 |
}
|
18 |
|
19 |
.chat-box {
|
@@ -24,6 +25,14 @@ body {
|
|
24 |
margin-bottom: 10px;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
button {
|
28 |
background-color: #007BFF;
|
29 |
color: #fff;
|
@@ -31,11 +40,11 @@ button {
|
|
31 |
padding: 10px 15px;
|
32 |
border-radius: 5px;
|
33 |
cursor: pointer;
|
34 |
-
width: 80%;
|
35 |
}
|
36 |
|
37 |
.user-message, .bot-message {
|
38 |
margin: 10px 0;
|
|
|
39 |
padding: 10px;
|
40 |
border-radius: 5px;
|
41 |
}
|
|
|
12 |
margin: 50px auto;
|
13 |
background-color: #fff;
|
14 |
padding: 20px;
|
15 |
+
padding: 20px;
|
16 |
border-radius: 5px;
|
17 |
+
width: 600px;
|
18 |
}
|
19 |
|
20 |
.chat-box {
|
|
|
25 |
margin-bottom: 10px;
|
26 |
}
|
27 |
|
28 |
+
.demo {
|
29 |
+
display: flex;
|
30 |
+
justify-content: flex-end;
|
31 |
+
align-items: center;
|
32 |
+
width: 20%;
|
33 |
+
flex-direction: column;
|
34 |
+
}
|
35 |
+
|
36 |
button {
|
37 |
background-color: #007BFF;
|
38 |
color: #fff;
|
|
|
40 |
padding: 10px 15px;
|
41 |
border-radius: 5px;
|
42 |
cursor: pointer;
|
|
|
43 |
}
|
44 |
|
45 |
.user-message, .bot-message {
|
46 |
margin: 10px 0;
|
47 |
+
width: 70%; /* Each message takes up half of the screen width */
|
48 |
padding: 10px;
|
49 |
border-radius: 5px;
|
50 |
}
|