-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beginnings of a tool to simplify connecting LLMs in different tabs
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |