|
<!DOCTYPE html> |
|
<html lang="ko"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>๋ฌธ์ ๊ฒ์</title> |
|
<style> |
|
.container { |
|
width: 50%; |
|
margin: 0 auto; |
|
padding: 20px; |
|
text-align: center; |
|
border: 1px solid #ccc; |
|
border-radius: 8px; |
|
background-color: #f9f9f9; |
|
} |
|
.search-bar { |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
gap: 10px; |
|
} |
|
input[type="text"], select { |
|
padding: 10px; |
|
border: 1px solid #ccc; |
|
border-radius: 4px; |
|
font-size: 14px; |
|
} |
|
input[type="text"] { |
|
flex: 1; |
|
} |
|
select { |
|
flex: 0.5; |
|
} |
|
button { |
|
padding: 10px 20px; |
|
background-color: #007bff; |
|
color: white; |
|
border: none; |
|
border-radius: 4px; |
|
cursor: pointer; |
|
font-size: 14px; |
|
} |
|
button:hover { |
|
background-color: #0056b3; |
|
} |
|
.results, .evaluation, .stream-output { |
|
margin-top: 5px; |
|
} |
|
.stream-output { |
|
text-align: left; |
|
white-space: pre-wrap; |
|
border: 1px solid #ccc; |
|
padding: 10px; |
|
height: 500px; |
|
overflow-y: scroll; |
|
} |
|
nav { |
|
background-color: #333; |
|
padding: 10px; |
|
text-align: center; |
|
} |
|
nav ul { |
|
list-style-type: none; |
|
padding: 0; |
|
margin: 0; |
|
} |
|
nav ul li { |
|
display: inline; |
|
margin: 0 15px; |
|
} |
|
nav ul li a { |
|
color: white; |
|
text-decoration: none; |
|
font-weight: bold; |
|
} |
|
nav ul li a:hover { |
|
text-decoration: underline; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<header> |
|
<nav> |
|
<ul> |
|
<li><a href="/search">๋ฌธ์ ๊ฒ์</a></li> |
|
<li><a href="/">ํ์ผ ์
๋ก๋</a></li> |
|
</ul> |
|
</nav> |
|
</header> |
|
<div class="container"> |
|
<h2>๋ฌธ์ ๊ฒ์</h2> |
|
<form id="search-form" class="search-bar"> |
|
<input type="text" id="query" name="query" placeholder="๊ฒ์์ด๋ฅผ ์
๋ ฅํ์ธ์..." required> |
|
<select id="model" name="model"> |
|
<option value="Qwen/Qwen2.5-72B-Instruct">Qwen/Qwen2.5-72B-Instruct</option> |
|
<option value="meta-llama/Llama-3.3-70B-Instruct">meta-llama/Llama-3.3-70B-Instruct</option> |
|
<option value="CohereForAI/c4ai-command-r-plus-08-2024">CohereForAI/c4ai-command-r-plus-08-2024</option> |
|
<option value="Qwen/QwQ-32B-Preview">Qwen/QwQ-32B-Preview</option> |
|
<option value="nvidia/Llama-3.1-Nemotron-70B-Instruct-HF">nvidia/Llama-3.1-Nemotron-70B-Instruct-HF</option> |
|
<option value="Qwen/Qwen2.5-Coder-32B-Instruct">Qwen/Qwen2.5-Coder-32B-Instruct</option> |
|
<option value="meta-llama/Llama-3.2-11B-Vision-Instruct">meta-llama/Llama-3.2-11B-Vision-Instruct</option> |
|
<option value="NousResearch/Hermes-3-Llama-3.1-8B">NousResearch/Hermes-3-Llama-3.1-8B</option> |
|
<option value="mistralai/Mistral-Nemo-Instruct-2407">mistralai/Mistral-Nemo-Instruct-2407</option> |
|
<option value="microsoft/Phi-3.5-mini-instruct">microsoft/Phi-3.5-mini-instruct</option> |
|
</select> |
|
<button type="submit">๊ฒ์</button> |
|
</form> |
|
<h3>์ค์๊ฐ ๊ฒฐ๊ณผ</h3> |
|
<div id="stream-output" class="stream-output"> |
|
|
|
<div id="stream-content"> |
|
|
|
</div> |
|
</div> |
|
</div> |
|
|
|
<script> |
|
let currentController = null; |
|
|
|
document.getElementById("search-form").addEventListener("submit", async (event) => { |
|
event.preventDefault(); |
|
const query = document.getElementById("query").value; |
|
const model = document.getElementById("model").value; |
|
const outputContainer = document.getElementById("stream-content"); |
|
|
|
|
|
if (currentController) { |
|
currentController.abort(); |
|
} |
|
currentController = new AbortController(); |
|
const signal = currentController.signal; |
|
|
|
|
|
outputContainer.textContent = "๊ฒ์ ์ค...\n"; |
|
|
|
try { |
|
const response = await fetch("/search/stream", { |
|
method: "POST", |
|
headers: { |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}, |
|
body: new URLSearchParams({ query, model }), |
|
signal, |
|
}); |
|
|
|
const reader = response.body.getReader(); |
|
const decoder = new TextDecoder("utf-8"); |
|
|
|
while (true) { |
|
const { value, done } = await reader.read(); |
|
if (done) break; |
|
outputContainer.textContent += decoder.decode(value); |
|
outputContainer.scrollTop = outputContainer.scrollHeight; |
|
} |
|
} catch (error) { |
|
if (error.name === "AbortError") { |
|
outputContainer.textContent += "\n์์ฒญ์ด ์ทจ์๋์์ต๋๋ค.\n"; |
|
} else { |
|
outputContainer.textContent = `์ค๋ฅ ๋ฐ์: ${error.message}`; |
|
} |
|
} finally { |
|
currentController = null; |
|
} |
|
}); |
|
</script> |
|
</body> |
|
</html> |
|
|