Skip to content

Commit

Permalink
Beginnings of a tool to simplify connecting LLMs in different tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ToonTalk committed Jul 23, 2024
1 parent 3d93eac commit bdd4ed8
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions apps/clipboard-assembly-webpage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Input and Clipboard Assembly</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.input-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
}
input[type="text"] {
width: 100%;
padding: 5px;
}
button {
padding: 5px 10px;
cursor: pointer;
}
#result {
margin-top: 20px;
padding: 10px;
border: 1px solid #ccc;
background-color: #f9f9f9;
white-space: pre-wrap;
}
</style>
</head>
<body>
<h1>Text Input and Clipboard Assembly</h1>
<div class="input-group">
<label for="name">Name:</label>
<input type="text" id="name" placeholder="Enter name">
</div>
<div class="input-group">
<label for="message">Message:</label>
<input type="text" id="message" placeholder="Enter message">
</div>
<div class="input-group">
<label for="model-name">Model Name:</label>
<input type="text" id="model-name" placeholder="Enter model name">
</div>
<button id="assemble-button">Assemble and Copy</button>
<div id="result"></div>

<script>
document.getElementById('assemble-button').addEventListener('click', async function() {
try {
const name = document.getElementById('name').value;
const message = document.getElementById('message').value;
const modelName = document.getElementById('model-name').value;

// Read from clipboard
const clipboardContent = await navigator.clipboard.readText();

const assembledString = `${name}: ${message}\n---------------\n${modelName}: ${clipboardContent}`;

const resultDiv = document.getElementById('result');
resultDiv.textContent = assembledString;

// Write to clipboard
await navigator.clipboard.writeText(assembledString);
alert('Assembled string has been copied to clipboard!');
} catch (err) {
console.error('Failed to read or write clipboard: ', err);
alert('Error accessing clipboard. Please make sure you have granted clipboard permissions and try again. If the issue persists, you can manually copy the text from below.');
}
});
</script>
</body>
</html>

0 comments on commit bdd4ed8

Please sign in to comment.