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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="vi">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Trợ lý Hành chính Phường/Xã</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
font-family: 'Arial', sans-serif;
|
| 10 |
+
line-height: 1.6;
|
| 11 |
+
color: #333;
|
| 12 |
+
max-width: 800px;
|
| 13 |
+
margin: 0 auto;
|
| 14 |
+
padding: 20px;
|
| 15 |
+
background-color: #f5f5f5;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
header {
|
| 19 |
+
text-align: center;
|
| 20 |
+
margin-bottom: 30px;
|
| 21 |
+
padding-bottom: 15px;
|
| 22 |
+
border-bottom: 1px solid #e0e0e0;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
h1 {
|
| 26 |
+
color: #2c3e50;
|
| 27 |
+
font-size: 24px;
|
| 28 |
+
margin-bottom: 5px;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.input-section {
|
| 32 |
+
background-color: #fff;
|
| 33 |
+
padding: 20px;
|
| 34 |
+
border-radius: 5px;
|
| 35 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 36 |
+
margin-bottom: 20px;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
label {
|
| 40 |
+
display: block;
|
| 41 |
+
margin-bottom: 8px;
|
| 42 |
+
font-weight: bold;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
input[type="text"] {
|
| 46 |
+
width: 100%;
|
| 47 |
+
padding: 10px;
|
| 48 |
+
border: 1px solid #ddd;
|
| 49 |
+
border-radius: 4px;
|
| 50 |
+
font-size: 16px;
|
| 51 |
+
box-sizing: border-box;
|
| 52 |
+
margin-bottom: 10px;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
button {
|
| 56 |
+
background-color: #3498db;
|
| 57 |
+
color: white;
|
| 58 |
+
border: none;
|
| 59 |
+
padding: 10px 20px;
|
| 60 |
+
border-radius: 4px;
|
| 61 |
+
cursor: pointer;
|
| 62 |
+
font-size: 16px;
|
| 63 |
+
transition: background-color 0.3s;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
button:hover {
|
| 67 |
+
background-color: #2980b9;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
#output {
|
| 71 |
+
background-color: #fff;
|
| 72 |
+
padding: 20px;
|
| 73 |
+
border-radius: 5px;
|
| 74 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 75 |
+
min-height: 150px;
|
| 76 |
+
white-space: pre-wrap;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.status {
|
| 80 |
+
color: #7f8c8d;
|
| 81 |
+
font-style: italic;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/* Kiểu dáng cho kết quả đầu ra sạch sẽ */
|
| 85 |
+
.clean-output {
|
| 86 |
+
font-family: 'Arial', sans-serif;
|
| 87 |
+
line-height: 1.6;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.clean-output strong {
|
| 91 |
+
font-weight: bold;
|
| 92 |
+
color: #2c3e50;
|
| 93 |
+
}
|
| 94 |
+
</style>
|
| 95 |
+
</head>
|
| 96 |
+
<body>
|
| 97 |
+
<header>
|
| 98 |
+
<h1>Trợ lý Hành chính Phường/Xã</h1>
|
| 99 |
+
<p>Hỗ trợ tra cứu thông tin hành chính</p>
|
| 100 |
+
</header>
|
| 101 |
+
|
| 102 |
+
<section class="input-section">
|
| 103 |
+
<label for="query">Nhập yêu cầu tra cứu:</label>
|
| 104 |
+
<input type="text" id="query" placeholder="Ví dụ: Phường Phú Tân thuộc quận/huyện nào?">
|
| 105 |
+
<button onclick="sendQuery()">Tra cứu</button>
|
| 106 |
+
</section>
|
| 107 |
+
|
| 108 |
+
<section>
|
| 109 |
+
<h2>Kết quả tra cứu</h2>
|
| 110 |
+
<div id="output" class="status clean-output">Kết quả sẽ hiển thị tại đây sau khi tra cứu...</div>
|
| 111 |
+
</section>
|
| 112 |
+
|
| 113 |
+
<script src="https://cdn.socket.io/4.5.4/socket.io.min.js"></script>
|
| 114 |
+
<script>
|
| 115 |
+
const socket = io("wss://tracuuphuongxa.trolyao.org", {
|
| 116 |
+
transports: ["websocket"]
|
| 117 |
+
});
|
| 118 |
+
|
| 119 |
+
socket.on("connect", () => {
|
| 120 |
+
console.log("Kết nối thành công:", socket.id);
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
+
socket.on("disconnect", () => {
|
| 124 |
+
console.log("Mất kết nối với hệ thống");
|
| 125 |
+
});
|
| 126 |
+
|
| 127 |
+
socket.on("chat_on_response_chunk", (chunk) => {
|
| 128 |
+
const output = document.getElementById("output");
|
| 129 |
+
if (output.classList.contains("status")) {
|
| 130 |
+
output.classList.remove("status");
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Xử lý làm sạch kết quả đầu ra
|
| 134 |
+
let cleanChunk = chunk
|
| 135 |
+
.replace(/###/g, '') // Loại bỏ dấu ###
|
| 136 |
+
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // Chuyển **text** thành <strong>
|
| 137 |
+
.replace(/\n/g, '<br>'); // Xử lý xuống dòng
|
| 138 |
+
|
| 139 |
+
output.innerHTML += cleanChunk;
|
| 140 |
+
});
|
| 141 |
+
|
| 142 |
+
function sendQuery() {
|
| 143 |
+
const userInput = document.getElementById("query").value.trim();
|
| 144 |
+
if (!userInput) {
|
| 145 |
+
alert("Vui lòng nhập yêu cầu tra cứu");
|
| 146 |
+
return;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
const output = document.getElementById("output");
|
| 150 |
+
output.innerHTML = "Đang xử lý yêu cầu...";
|
| 151 |
+
output.className = "status clean-output";
|
| 152 |
+
|
| 153 |
+
const payload = {
|
| 154 |
+
history: [
|
| 155 |
+
{ user: userInput, bot: "" }
|
| 156 |
+
],
|
| 157 |
+
approach: "rrr",
|
| 158 |
+
username: "anonymous_phuongxa",
|
| 159 |
+
fullname: "anonymous_phuongxa",
|
| 160 |
+
overrides: {
|
| 161 |
+
user_model: "llm-vtcc-foundation-70b",
|
| 162 |
+
retrieval_mode: "text",
|
| 163 |
+
temperature: 0.2,
|
| 164 |
+
fulltext_search_retriever: true,
|
| 165 |
+
use_whitelist: true,
|
| 166 |
+
use_summary_answer: true,
|
| 167 |
+
confirm_decision: true,
|
| 168 |
+
use_llm_filter: true,
|
| 169 |
+
use_confirm_answer: true,
|
| 170 |
+
chatgpt_model: "llm-vtcc-foundation-70b",
|
| 171 |
+
chatgpt_model_gen_query: "llm-vtcc-foundation-70b",
|
| 172 |
+
model_llm_search: "GPT-4o-128K",
|
| 173 |
+
model_llm_filter: "GPT-4o-128K",
|
| 174 |
+
use_reference: false,
|
| 175 |
+
regen_reference: false,
|
| 176 |
+
use_api_search_tree: false,
|
| 177 |
+
type_hybrid_search: "Priority semantic",
|
| 178 |
+
type_search_engine: "bing",
|
| 179 |
+
mode_think: false,
|
| 180 |
+
mode_search: false,
|
| 181 |
+
no_prompt: false
|
| 182 |
+
}
|
| 183 |
+
};
|
| 184 |
+
|
| 185 |
+
socket.emit("request_chatbot", JSON.stringify(payload));
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
// Xử lý phím Enter
|
| 189 |
+
document.getElementById("query").addEventListener("keypress", function(event) {
|
| 190 |
+
if (event.key === "Enter") {
|
| 191 |
+
sendQuery();
|
| 192 |
+
}
|
| 193 |
+
});
|
| 194 |
+
</script>
|
| 195 |
+
</body>
|
| 196 |
+
</html>
|