Delete static/demo/multiturn.html
Browse files- static/demo/multiturn.html +0 -145
static/demo/multiturn.html
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
|
4 |
-
<head>
|
5 |
-
<meta charset="UTF-8" />
|
6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
7 |
-
<title>Responsible Prompting - Multi-Turn Chat</title>
|
8 |
-
|
9 |
-
<!-- IBM Plex Sans -->
|
10 |
-
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&display=swap"
|
11 |
-
rel="stylesheet" />
|
12 |
-
|
13 |
-
<!-- Carbon CSS (for tabs and tags) -->
|
14 |
-
<link rel="stylesheet" href="static/styles/carbon-components.min.css"/>
|
15 |
-
|
16 |
-
<link rel="stylesheet" href="static/styles/style_multiturn.css"/>
|
17 |
-
|
18 |
-
<script type="text/javascript" src="static/demo/js/d3.v7.min.js"></script>
|
19 |
-
<script type="text/javascript" src="static/demo/js/jquery-3.7.1.min.js"></script>
|
20 |
-
<script type="text/javascript" src="static/demo/js/main.js"></script>
|
21 |
-
<script type="text/javascript" src="static/demo/js/marked.min.js"></script>
|
22 |
-
|
23 |
-
</head>
|
24 |
-
|
25 |
-
<body>
|
26 |
-
<div id="tooltip" style="opacity: 0;" class="tooltip"></div>
|
27 |
-
|
28 |
-
<a id='learn-more-container' href="https://github.com/IBM/responsible-prompting-api" target="_blank">
|
29 |
-
<div id='learn-more-text' >Learn More</div>
|
30 |
-
<img src="static/demo/imgs/arrow-up-right.svg" class="icon" style="color: #0f62fe; right: 0; padding: 1.5px"/>
|
31 |
-
</a>
|
32 |
-
<!-- ===== Header: Title + Carbon Tabs ===== -->
|
33 |
-
<div class="header-container">
|
34 |
-
<div style="display: flex; flex-direction: row; gap: 2rem;">
|
35 |
-
<div style="display: flex; flex-direction: column; gap: 1rem; padding-left: 1rem;">
|
36 |
-
<h4 style="display: flex; font-size: xx-large; font-weight: 300; flex: 1;">Responsible Prompting</h4>
|
37 |
-
<div style="display: flex;">
|
38 |
-
<div style="align-content: center;">Model: </div>
|
39 |
-
<select id="modelSelect"></select>
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
|
43 |
-
<div style="width: 55%;" class="intro">
|
44 |
-
<p>
|
45 |
-
Responsible Prompting is a tool that aims at supporting users in crafting prompts that embed responsible values and help avoid harmful prompts, in prompting-time.
|
46 |
-
</p>
|
47 |
-
</div>
|
48 |
-
</div>
|
49 |
-
</div>
|
50 |
-
|
51 |
-
<!-- === Chat View === -->
|
52 |
-
<div id="chat-content">
|
53 |
-
<div id="chat" class="chat-container"></div>
|
54 |
-
|
55 |
-
<!-- Input area -->
|
56 |
-
<div class="input-area">
|
57 |
-
<div id="userInputDiv" contenteditable placeholder="Enter your prompt...">Act as a professional designer with 20 years of experience creating and testing UX interfaces and landing sites for a variety of IT applications. We are in need of more people and an increased budget to be able to keep up with clients' needs. What kind of evidence should I gather to support my demands to gain more resources?</div>
|
58 |
-
|
59 |
-
<div style="display: flex; justify-content: space-between; gap: 1rem; align-items: center;">
|
60 |
-
<div id="recommendation"></div>
|
61 |
-
<!-- Send button -->
|
62 |
-
<button id="sendBtn" class="btn">
|
63 |
-
<img src="static/demo/imgs/send.svg" alt="Send" class="icon"/>
|
64 |
-
</button>
|
65 |
-
</div>
|
66 |
-
</div>
|
67 |
-
|
68 |
-
<div style="padding: 0.5rem; color: gray">AI responses may be inaccurate, please verify information independently.</div>
|
69 |
-
</div>
|
70 |
-
|
71 |
-
<script>
|
72 |
-
var modelId = '';
|
73 |
-
document.addEventListener('DOMContentLoaded', () => {
|
74 |
-
// Populate the different models options
|
75 |
-
// id -> id of the model on HF, name -> name displayed to the user
|
76 |
-
const models = [
|
77 |
-
{ id: 'mistralai/Mistral-7B-Instruct-v0.3', name: 'Mistral 7B Instruct v0.3' },
|
78 |
-
{ id: 'meta-llama/Llama-4-Scout-17B-16E-Instruct', name: 'Llama 4 Scout' },
|
79 |
-
];
|
80 |
-
const modelSelect = document.getElementById('modelSelect');
|
81 |
-
|
82 |
-
models.forEach(model => {
|
83 |
-
const option = document.createElement('option');
|
84 |
-
option.value = model.id;
|
85 |
-
option.textContent = model.name;
|
86 |
-
modelSelect.appendChild(option);
|
87 |
-
});
|
88 |
-
|
89 |
-
// Set default selection
|
90 |
-
modelId = models[0].id;
|
91 |
-
|
92 |
-
// Record when model changes
|
93 |
-
modelSelect.addEventListener('change', function() {
|
94 |
-
const selectedModel = models.find(model => model.id === this.value);
|
95 |
-
modelId = selectedModel.id;
|
96 |
-
});
|
97 |
-
});
|
98 |
-
|
99 |
-
// To show the bottom of text in the prompt input box
|
100 |
-
var objDiv = document.getElementById("userInputDiv");
|
101 |
-
objDiv.scrollTop = objDiv.scrollHeight;
|
102 |
-
|
103 |
-
let generating = false;
|
104 |
-
$("#userInputDiv").on("input", function () {
|
105 |
-
if($("#userInputDiv").text().length > 0) {
|
106 |
-
if(!generating) $("#sendBtn").attr("disabled", false);
|
107 |
-
generateRecommendations("#sendBtn", "#userInputDiv", "#recommendation");
|
108 |
-
} else {
|
109 |
-
$("#sendBtn").attr("disabled", true);
|
110 |
-
}
|
111 |
-
});
|
112 |
-
|
113 |
-
// // To generate recommendation when the page loads
|
114 |
-
$("#userInputDiv").trigger('input');
|
115 |
-
|
116 |
-
$("#sendBtn").on("click", () => {
|
117 |
-
const rawText = $("#userInputDiv").text() || "";
|
118 |
-
|
119 |
-
// Clear input box and recommendations
|
120 |
-
$("#userInputDiv").text("");
|
121 |
-
$("#recommendation").empty();
|
122 |
-
$("#sendBtn").attr("disabled", true);
|
123 |
-
|
124 |
-
// Generate LLM response
|
125 |
-
generateResponse(rawText, "#chat", "#sendBtn");
|
126 |
-
});
|
127 |
-
|
128 |
-
// Pressing Enter (without Shift) also sends
|
129 |
-
$("#userInput").on("keydown", function (e) {
|
130 |
-
if (e.key === "Enter" && !e.shiftKey) {
|
131 |
-
e.preventDefault();
|
132 |
-
if (!$("#sendBtn").attr("disabled")) {
|
133 |
-
$("#sendBtn").click();
|
134 |
-
}
|
135 |
-
}
|
136 |
-
});
|
137 |
-
|
138 |
-
$("#userInputDiv").on('keyup', () => {
|
139 |
-
if($("#userInputDiv").html() == "<br>") {
|
140 |
-
$("#userInputDiv").html("");
|
141 |
-
}
|
142 |
-
})
|
143 |
-
</script>
|
144 |
-
</body>
|
145 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|