Skip to content

Commit

Permalink
added missing ressource highlight.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesvan authored Oct 6, 2023
1 parent a1c3bf4 commit bd52cb7
Showing 1 changed file with 29 additions and 32 deletions.
61 changes: 29 additions & 32 deletions interface.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/vs.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>

<!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/go.min.js"></script>

<?php
session_start();

Expand All @@ -7,28 +14,13 @@
}

?>
<head>
<title>HAWKI</title>
<?php
if (file_exists(".env")){
$env = parse_ini_file('.env');
}
$favicon = isset($env) ? ($env["FAVICON_URI"]??false) : getenv("FAVICON_URI");
if ($favicon) {
echo
'<link rel="shortcut icon" type="image/x-icon" href="'. $favicon .'" media="screen" />
<link rel="icon" type="image/x-icon" href="'. $favicon .'" media="screen" />
';
}
?>
</head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="app.css">

<link rel="stylesheet" href="app.css">

<div class="wrapper">
<div class="sidebar">
<div class="logo" onclick="load(this, 'chat.htm')">
<img src="/img/logo.svg" alt="Logo">
<img src="/img/hawki.svg" alt="HAWK Logo" width="150px">
</div>
<div class="menu">
<details>
Expand Down Expand Up @@ -124,17 +116,11 @@

</div>
<div class="info">
<a href="#" onclick="load(this, 'about.htm')">Über HAWKI</a>
<a href="#" onclick="load(this, 'about.htm')">Über HAWK-KI</a>
<a href="#" id="feedback" onclick="load(this, 'userpost.php')">Feedback</a>
<a href=<?php
if (file_exists(".env")){
$env = parse_ini_file('.env');
}
if ((isset($env) ? $env["Authentication"] : getenv("Authentication")) == "OIDC"){
echo "oidc_logout.php";
} else echo "logout.php" ?>>Abmelden (<?php echo $_SESSION['username']?>)</a>
<a href="logout.php">Abmelden</a>
<br>
<a href="/datenschutz" target="_blank" >Datenschutz</a>
<a href="#" onclick="load(this, 'datenschutz.htm')">Datenschutz</a>
<a href="/impressum" target="_blank">Impressum</a>
</div>
</div>
Expand Down Expand Up @@ -223,8 +209,6 @@

</div>



<template id="message">
<div class="message">
<div class="message-content">
Expand All @@ -247,6 +231,16 @@
</div>
</div>

<div class="modal" onclick="modalClick(this)" id="gpt4">
<div class="modal-content">
<h2>Upgrade auf GPT4</h2>
<p>Die Hochschule stellt Ihnen jetzt GPT4 zur Verfügung.
Komplexere Eingaben können nun besser verstanden und verarbeitet werden.
Sie sollten nun präzisere Antworten erhalten. Die Wartezeit auf eine Antwort kann sich geringfügig verlängern.</p>
<button>Bestätigen</button>
</div>
</div>

<script>
visualViewport.addEventListener("resize", update);
visualViewport.addEventListener("scroll", update);
Expand Down Expand Up @@ -425,7 +419,6 @@ function escapeHTML(str) {
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}



function addMessage(message){
Expand All @@ -440,7 +433,7 @@ function addMessage(message){
if(message.role == "assistant"){
messageElement.querySelector(".message-icon").textContent = "AI";
}else{
messageElement.querySelector(".message-icon").textContent = '<?= isset($_SESSION['initials']) ? $_SESSION['initials']: $_SESSION['username'] ?>';
messageElement.querySelector(".message-icon").textContent = '<?= $_SESSION['username'] ?>';
messageElement.querySelector(".message").classList.add("me");
}

Expand Down Expand Up @@ -475,6 +468,10 @@ function copyToInput(selector) {
document.querySelector("#data-protection").remove();
}

if(localStorage.getItem("gpt4")){
document.querySelector("#gpt4").remove();
}

function modalClick(element){
localStorage.setItem(element.id, "true")
element.remove();
Expand All @@ -487,7 +484,7 @@ function modalClick(element){
const inputField = document.querySelector(".userpost-field");

let message = {};
message.role = '<?= isset($_SESSION['initials']) ? $_SESSION['initials']: $_SESSION['username'] ?>';
message.role = '<?= $_SESSION['username'] ?>';
message.content = inputField.value.trim();

fetch('userpost.php', {
Expand Down

0 comments on commit bd52cb7

Please sign in to comment.