This commit is contained in:
2023-02-25 18:13:14 +01:00
parent 7c2eca2c04
commit 393cea762c
5 changed files with 104 additions and 0 deletions

3
demos/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Demo 1
./cps-exploits.mp4

BIN
demos/cps-explits.mp4 Normal file

Binary file not shown.

73
demos/index.html Normal file
View File

@@ -0,0 +1,73 @@
<html>
<head>
<title>Help</title>
</head>
<body>
<h1>Help</h1>
<p> Welcome! Please enter your issue below and we will try to help you. </p>
<div class="inputs">
<input type="text" name="issue" id="issue">
<button onclick="sendIssue()">Send</button>
</div>
<div id="result"></div>
</body>
</html>
<script>
function sendIssue() {
var issue = document.getElementById("issue").value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("result").innerHTML = JSON.parse(this.response).response;
}
};
xhttp.open("GET", "/help?issue=" + issue, true);
xhttp.send();
}
</script>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, Helvetica, sans-serif;
}
h1 {
text-align: center;
}
p {
text-align: center;
margin: 10% 20%;
}
.inputs{
text-align: center;
}
input {
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 16px;
padding: 12px 20px 12px 40px;
transition: width 0.4s ease-in-out;
width: 60%;
}
input:focus {
width: 70%;
}
button {
background-color: #4CAF50;
border: none;
border-radius: 4px;
color: white;
cursor: pointer;
font-size: 16px;
padding: 12px 20px;
transition: 0.3s;
}
button:hover {
background-color: #45a049;
}
#result {
text-align: center;
margin: 10% 20%;
}
</style>

26
demos/server.js Normal file
View File

@@ -0,0 +1,26 @@
const { OpenAILLM, SuppresServer, DataGenerator } = require('/home/velocitatem/Documents/Projects/suppress/suppress/suppress.js');
const config = require('../config.json');
const openAILLM = new OpenAILLM(config.key);
prompt = `
Wikipedia is a free, online encyclopedia that operates under an open-source management style. It is the largest and most-read reference work in history, with over 6 million articles in the English-language version alone. It is hosted by the Wikimedia Foundation, a non-profit organization funded mainly through donations. Wikipedia is written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWiki. Its unique structure allows anyone to edit and create pages, which has been praised for enabling the democratization of knowledge. Wikipedia has been widely used as a corpus for linguistic research in computational linguistics, information retrieval, and natural language processing. It commonly serves as a target knowledge base for the entity linking problem and to the related problem of word-sense disambiguation. Anyone can sign up for a Wikipedia account and create a page about anything, even themselves. Wikipedia is available in over 329 languages, covering the most popular worldwide languages.
Wikipedia is enabled by wiki software, otherwise known as wiki engines, which allow content to be written using a simplified markup language and sometimes edited with the help of a rich-text editor. There are dozens of different wiki engines in use, both standalone and part of other software, such as bug tracking systems. Some wiki engines are free and open-source, whereas others are proprietary. Some permit control over different functions, such as editing rights, while others may permit access without enforcing access control. Other rules may be imposed to organize content.
We have a new customer. How can this customer be helped?
This is the issue a customer is facing: {issue}
`
const dataGenerator = new DataGenerator(prompt, null, openAILLM).set({doFormat: false});
const server = new SuppresServer();
server.createEndpoint("/help", "GET", dataGenerator);
// host the index.html file in the current directory
server.app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html');
});
server.start(3000);