67 lines
2.5 KiB
HTML
67 lines
2.5 KiB
HTML
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<title>НадTavern</title>
|
||
<link rel="icon" href="/favicon.ico" />
|
||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||
<link rel="manifest" href="/site.webmanifest" />
|
||
<meta name="theme-color" content="#ffffff" />
|
||
<style>
|
||
body { font-family: Arial, sans-serif; margin: 24px; }
|
||
textarea { width: 100%; height: 200px; }
|
||
pre { background: #111; color: #eee; padding: 12px; border-radius: 6px; overflow: auto; }
|
||
.row { display: flex; gap: 16px; }
|
||
.col { flex: 1; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<h1>НадTavern — Мини UI</h1>
|
||
<p>Тестовый интерфейс для запроса к <code>/v1/chat/completions</code> без стриминга.</p>
|
||
<p><a href="/ui/pipeline.html">Открыть редактор пайплайна (JSON)</a></p>
|
||
<p><a href="/ui/editor.html">Открыть визуальный редактор нод</a></p>
|
||
<div class="row">
|
||
<div class="col">
|
||
<h3>Ввод (OpenAI-формат)</h3>
|
||
<textarea id="payload"></textarea>
|
||
<button id="send">Отправить</button>
|
||
</div>
|
||
<div class="col">
|
||
<h3>Ответ</h3>
|
||
<pre id="out"></pre>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
const sample = {
|
||
model: "gpt-4o-mini",
|
||
messages: [
|
||
{ role: "system", content: "You are a helpful assistant." },
|
||
{ role: "user", content: "Привет! Расскажи коротко о проекте НадTavern." }
|
||
],
|
||
temperature: 0.2,
|
||
max_tokens: 128
|
||
};
|
||
document.getElementById('payload').value = JSON.stringify(sample, null, 2);
|
||
document.getElementById('send').onclick = async () => {
|
||
const raw = document.getElementById('payload').value;
|
||
try {
|
||
const res = await fetch('/v1/chat/completions', {
|
||
method: 'POST',
|
||
headers: { 'Content-Type': 'application/json' },
|
||
body: raw
|
||
});
|
||
const json = await res.json();
|
||
document.getElementById('out').textContent = JSON.stringify(json, null, 2);
|
||
} catch (e) {
|
||
document.getElementById('out').textContent = String(e);
|
||
}
|
||
};
|
||
</script>
|
||
</body>
|
||
</html>
|
||
|
||
|