svelte-chatbot-test / src /components /TokenInput.svelte
ferrywuai's picture
Add ChatSettings component with slider-based parameter control
cacced0
<script lang="ts">
import { token } from "../stores/token";
let input = "";
function confirm() {
const trimmed = input.trim();
if (!trimmed) return;
token.set(trimmed);
}
</script>
<form class="token-form" on:submit|preventDefault={confirm}>
<input
type="password"
bind:value={input}
placeholder="Hugging Face token..."
aria-label="HF token input"
/>
<button type="submit" disabled={input.trim() === ""}>Confirm</button>
</form>
<style>
.token-form {
display: flex;
gap: 8px;
padding: 12px;
border-top: 1px solid #eef2ff;
}
input {
flex: 1 1 auto;
min-height: 40px;
max-height: 160px;
resize: none;
padding: 10px 12px;
border-radius: 10px;
border: 1px solid #e6eef8;
outline: none;
font-size: 0.95rem;
background: #fbfdff;
}
input:focus {
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
border-color: rgba(59, 130, 246, 0.6);
}
button {
flex: 0 0 auto;
padding: 0 14px;
border-radius: 10px;
border: none;
background: linear-gradient(180deg, #2563eb, #1d4ed8);
color: #fff;
font-weight: 600;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 72px;
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
@media (max-width: 640px) {
.token-form {
padding: 10px;
}
button {
min-width: 56px;
padding: 0 10px;
}
}
</style>