Skip to content

Commit

Permalink
renaming files properly
Browse files Browse the repository at this point in the history
  • Loading branch information
nagendra committed Dec 2, 2023
1 parent e27c0cf commit e4c77ca
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 133 deletions.
48 changes: 48 additions & 0 deletions chat.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#chat{
width:50%;
margin:auto;
border:2px solid green;
list-style-type: none;
position: relative;
}
.initial{
font-weight: bold;

}
.client{
display: flex;
justify-content: end;

}
.clientchat{
border:1px solid red;
color:green
}
.clientchat:hover{
background-color:rgb(70, 176, 70);
color:white;
}
.botchat:hover{
background-color: rgb(180, 89, 89);
color:white;
}
.bot{
display: inline-block;
max-width:50%;

}
.botchat{
border:1px solid gray;

}
.clientchat{
max-width:50%;
}
.botchat,.clientchat{
padding:5px;
border-radius:1px 10px 10px 10px;
cursor: pointer;
margin:2px;

}

53 changes: 2 additions & 51 deletions chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,14 @@
<head>
<title>'title her'
</title>
<style type="text/css">
#chat{
width:50%;
margin:auto;
border:2px solid green;
list-style-type: none;
position: relative;
}
.initial{
font-weight: bold;

}
.client{
display: flex;
justify-content: end;

}
.clientchat{
border:1px solid red;
color:green
}
.clientchat:hover{
background-color:rgb(70, 176, 70);
color:white;
}
.botchat:hover{
background-color: rgb(180, 89, 89);
color:white;
}
.bot{
display: inline-block;
max-width:50%;

}
.botchat{
border:1px solid gray;

}
.clientchat{
max-width:50%;
}
.botchat,.clientchat{
padding:5px;
border-radius:1px 10px 10px 10px;
cursor: pointer;
margin:2px;

}

</style>
<link rel="stylesheet" href="./chat.css">
</head>
<body>
<div id="chat">

</div>
</body>
<script src="./chatx.js"></script>
<script src="./chat.js"></script>
<script type="text/javascript">
var a={
"attendance issues": {
Expand Down
162 changes: 80 additions & 82 deletions chat.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,82 @@
a={
"attendance issues": {
"teacher": "database is down currently",
"app": {
"hanging": "requirements are 4gb",
"report issues": {
"on service": "database is down currently",
"on help": "database is down currently"
}
},
"other": "database is down currently"
},
"want to know my attendance?": {
"yearly": "database is down currently",
"monthly": "database is down currently",
"todays": "database is down currently",
"other": "database is down currently"
},
"raise complaint?": {
"on faculty": "database is down currently",
"on ams_app": "database is down currently",
"other": "database is down currently"
},
"want to give feedback on app?": "database is down currently",
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
content=document.getElementById("chat");
initial(a);
function initial(a){
x=document.createElement("li");
y=document.createTextNode("hi i am your personal assistant")
x.appendChild(y);
x.setAttribute("class","initial");
content.appendChild(x);
bot(a);


}

function terminal(){
x=document.createElement("div");
x.setAttribute("class","bot");
x.innerHTML=`<li class='botchat' onclick='(()=>{reciever("RESTART"),initial(${JSON.stringify(a)})})()'>Restart</li><li class='botchat' onClick="agent()">chat with agent</li>`;
content.appendChild(x);
}
function bot(a){

con="";
keys=Object.keys(a);
if (typeof(a)==typeof({})){
keys.forEach((i) => {
con+=`<li onclick='(()=>{reciever("${i}"),bot(${JSON.stringify(a[i])})})()' class='botchat'>${i}</li>`;

});
x=document.createElement("div");
x.setAttribute("class","bot");
x.innerHTML=con;
content.appendChild(x);
// console.log(con)
var Chatbot = /** @class */ (function () {
function Chatbot(_a, chat) {
var content = _a.content, container = _a.container, objectName = _a.objectName;
this.chat = {
welcomeMsg: "Hi I am your personal assistant",
sendOfMsg: "Thanks for your feedback",
redirectMsg: "Chat with our agent",
redirectLink: ""
};
Chatbot.chatContent = content;
Chatbot.objectName = objectName;
this.chat = __assign(__assign({}, this.chat), chat);
console.log(chat);
this.containerRef = container;
}
else{
reciever(`'${a}'`);
x=document.createElement("div");
x.setAttribute("class","bot");
x.innerHTML=`<li class="botchat">Does this clarify your doubt?</li><br><li class="botchat" onclick='(()=>{reciever("yes");feedback()})()'>yes</li><li class="botchat" onclick='(()=>{reciever("no");terminal()})()'>no</li>`;
content.appendChild(x);
}



}
function feedback(){
x=document.createElement("b");
x.setAttribute("class","final");
y=document.createTextNode("Thanks for your interest");
x.appendChild(y);
content.appendChild(x);
}
function reciever(i){
x=document.createElement("div");
x.setAttribute("class","client");
x.innerHTML=`<li class="clientchat">${i}</li>`;
content.appendChild(x);

}
Chatbot.prototype.initialise = function () {
var x = document.createElement("li");
var y = document.createTextNode(this.chat.welcomeMsg);
x.appendChild(y);
x.setAttribute("class", "initial");
this.containerRef.appendChild(x);
this.bot(Chatbot.chatContent);
};
;
Chatbot.prototype.bot = function (messageContent) {
var con = "";
var keys = Object.keys(messageContent);
if (typeof (messageContent) == typeof ({})) {
keys.forEach(function (i) {
con += "<li onclick='(()=>{".concat(Chatbot.objectName, ".reciever(\"").concat(i, "\"),").concat(Chatbot.objectName, ".bot(").concat(JSON.stringify(messageContent[i]), ")})()' class='botchat'>").concat(i, "</li>");
});
var x = document.createElement("div");
x.setAttribute("class", "bot");
x.innerHTML = con;
this.containerRef.appendChild(x);
// console.log(con)
}
else {
this.reciever("'".concat(messageContent, "'"));
var x = document.createElement("div");
x.setAttribute("class", "bot");
x.innerHTML = "<li class=\"botchat\">Does this clarify your doubt?</li><br><li class=\"botchat\" onclick='(()=>{".concat(Chatbot.objectName, ".reciever(\"yes\");").concat(Chatbot.objectName, ".feedback()})()'>yes</li><li class=\"botchat\" onclick='(()=>{").concat(Chatbot.objectName, ".reciever(\"no\");").concat(Chatbot.objectName, ".finalise()})()'>no</li>");
this.containerRef.appendChild(x);
}
};
;
Chatbot.prototype.reciever = function (recieverChat) {
var x = document.createElement("div");
x.setAttribute("class", "client");
x.innerHTML = "<li class=\"clientchat\">".concat(recieverChat, "</li>");
this.containerRef.appendChild(x);
};
;
Chatbot.prototype.finalise = function () {
var x = document.createElement("div");
x.setAttribute("class", "bot");
x.innerHTML = "<li class='botchat' onclick='(()=>{".concat(Chatbot.objectName, ".reciever(\"RESTART\"),").concat(Chatbot.objectName, ".initial(").concat(JSON.stringify(Chatbot.chatContent), ")})()'>Restart</li><li class='botchat' onClick=\"agent()\"><a href=\"").concat(this.chat.redirectLink, "\">").concat(this.chat.redirectMsg, "</a></li>");
this.containerRef.appendChild(x);
};
;
Chatbot.prototype.feedback = function () {
var x = document.createElement("b");
x.setAttribute("class", "final");
var y = document.createTextNode(this.chat.sendOfMsg);
x.appendChild(y);
this.containerRef.appendChild(x);
};
;
return Chatbot;
}());
;
File renamed without changes.

0 comments on commit e4c77ca

Please sign in to comment.