kritsanan commited on
Commit
672a4ed
·
verified ·
1 Parent(s): 61aa179

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +306 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Chatbot 55
3
- emoji: 🐢
4
- colorFrom: indigo
5
- colorTo: green
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: chatbot-55
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,306 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="th">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ผู้ช่วย อปท. | Local Government Assistant</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap" rel="stylesheet">
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+ <style>
11
+ body {
12
+ font-family: 'Sarabun', sans-serif;
13
+ background-color: #F5F9FF;
14
+ }
15
+ .chat-container {
16
+ width: 360px;
17
+ height: 640px;
18
+ margin: 0 auto;
19
+ position: relative;
20
+ overflow: hidden;
21
+ box-shadow: 0 0 20px rgba(0,0,0,0.1);
22
+ }
23
+ .bot-bubble {
24
+ background-color: #E6F0FF;
25
+ border-radius: 16px 16px 16px 0;
26
+ max-width: 80%;
27
+ }
28
+ .user-bubble {
29
+ background-color: #0078FF;
30
+ color: white;
31
+ border-radius: 16px 16px 0 16px;
32
+ max-width: 80%;
33
+ }
34
+ .quick-reply {
35
+ background-color: #E6F0FF;
36
+ border-radius: 20px;
37
+ width: 80px;
38
+ height: 40px;
39
+ font-size: 14px;
40
+ transition: all 0.2s;
41
+ }
42
+ .quick-reply:hover {
43
+ background-color: #D0E2FF;
44
+ }
45
+ .pulse {
46
+ animation: pulse 1.5s infinite;
47
+ }
48
+ @keyframes pulse {
49
+ 0% { opacity: 0.6; }
50
+ 50% { opacity: 1; }
51
+ 100% { opacity: 0.6; }
52
+ }
53
+ .header-shadow {
54
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
55
+ }
56
+ .font-size-selector {
57
+ width: 120px;
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="bg-gray-100 flex items-center justify-center p-4">
62
+ <!-- Chat App Container (360x640px) -->
63
+ <div class="chat-container bg-white flex flex-col">
64
+ <!-- Header Section -->
65
+ <header class="bg-blue-700 text-white header-shadow z-10">
66
+ <div class="flex items-center justify-between px-4 py-3">
67
+ <!-- Logo and App Name -->
68
+ <div class="flex items-center">
69
+ <img src="https://img5.pic.in.th/file/secure-sv1/307460108_387435583599238_6386334495691428178_n-removebg-preview.png"
70
+ alt="ผู้ช่วย อปท. Logo"
71
+ class="h-8">
72
+ <h1 class="ml-2 text-lg font-bold">ผู้ช่วย อปท.</h1>
73
+ </div>
74
+
75
+ <!-- Header Controls -->
76
+ <div class="flex items-center space-x-2">
77
+ <!-- Font Size Adjuster -->
78
+ <div class="relative font-size-selector">
79
+ <select aria-label="ปรับขนาดตัวอักษร"
80
+ class="bg-blue-600 text-white text-sm rounded px-2 py-1">
81
+ <option value="small">ตัวเล็ก</option>
82
+ <option value="medium" selected>ตัวกลาง</option>
83
+ <option value="large">ตัวใหญ่</option>
84
+ </select>
85
+ </div>
86
+
87
+ <!-- Close Button -->
88
+ <button aria-label="ปิดแอปพลิเคชัน"
89
+ class="w-8 h-8 flex items-center justify-center rounded-full bg-blue-600">
90
+ <i class="fas fa-times"></i>
91
+ </button>
92
+ </div>
93
+ </div>
94
+ </header>
95
+
96
+ <!-- Chat Area -->
97
+ <main class="flex-1 overflow-y-auto p-3 bg-white">
98
+ <!-- Welcome Message -->
99
+ <div class="mb-4">
100
+ <div class="bot-bubble px-4 py-3">
101
+ <p>สวัสดีค่ะ! ยินดีต้อนรับสู่บริการผู้ช่วย อปท.</p>
102
+ <p class="mt-1">ฉันสามารถช่วยเหลือคุณในเรื่อง:</p>
103
+ <ul class="list-disc pl-5 mt-1">
104
+ <li>ข้อมูลบริการท้องถิ่น</li>
105
+ <li>แบบฟอร์มออนไลน์</li>
106
+ <li>นัดหมายบริการ</li>
107
+ <li>ปัญหาสาธารณูปโภค</li>
108
+ </ul>
109
+ <p class="text-xs text-gray-500 mt-2">10:30 น.</p>
110
+ </div>
111
+ </div>
112
+
113
+ <!-- User Message -->
114
+ <div class="mb-4 flex justify-end">
115
+ <div class="user-bubble px-4 py-3">
116
+ <p>ต้องการยื่นแบบฟอร์มภาษีที่ดิน</p>
117
+ <p class="text-xs text-blue-100 mt-2">10:32 น.</p>
118
+ </div>
119
+ </div>
120
+
121
+ <!-- Bot Response with Quick Replies -->
122
+ <div class="mb-4">
123
+ <div class="bot-bubble px-4 py-3">
124
+ <p>คุณต้องการยื่นแบบฟอร์มภาษีที่ดินสำหรับ:</p>
125
+
126
+ <!-- Quick Replies -->
127
+ <div class="mt-3 flex flex-wrap gap-2">
128
+ <button class="quick-reply flex items-center justify-center">
129
+ ที่อยู่อาศัย
130
+ </button>
131
+ <button class="quick-reply flex items-center justify-center">
132
+ ที่ดินว่างเปล่า
133
+ </button>
134
+ <button class="quick-reply flex items-center justify-center">
135
+ เกษตรกรรม
136
+ </button>
137
+ <button class="quick-reply flex items-center justify-center">
138
+ อื่นๆ
139
+ </button>
140
+ </div>
141
+ <p class="text-xs text-gray-500 mt-2">10:33 น.</p>
142
+ </div>
143
+ </div>
144
+
145
+ <!-- API Loading State -->
146
+ <div class="mb-4">
147
+ <div class="bot-bubble px-4 py-3 flex items-center space-x-2">
148
+ <div class="w-2 h-2 rounded-full bg-gray-600 pulse"></div>
149
+ <div class="w-2 h-2 rounded-full bg-gray-600 pulse" style="animation-delay: 0.2s"></div>
150
+ <div class="w-2 h-2 rounded-full bg-gray-600 pulse" style="animation-delay: 0.4s"></div>
151
+ </div>
152
+ </div>
153
+
154
+ <!-- API Error State -->
155
+ <div class="mb-4 hidden" id="error-message">
156
+ <div class="bot-bubble px-4 py-3 bg-red-100 border border-red-300">
157
+ <p class="text-red-700">ขออภัยในความไม่สะดวก ระบบไม่สามารถเชื่อมต่อกับฐานข้อมูลได้ในขณะนี้</p>
158
+ <button class="mt-2 text-sm text-blue-600 font-medium">ลองอีกครั้ง</button>
159
+ <p class="text-xs text-gray-500 mt-2">10:35 น.</p>
160
+ </div>
161
+ </div>
162
+ </main>
163
+
164
+ <!-- Input Section -->
165
+ <footer class="bg-gray-50 border-t border-gray-200">
166
+ <!-- Quick Action Buttons -->
167
+ <div class="px-3 py-2 flex justify-around bg-blue-50">
168
+ <button class="flex flex-col items-center text-xs text-blue-700">
169
+ <i class="fas fa-file-alt text-lg mb-1"></i>
170
+ <span>แบบฟอร์ม</span>
171
+ </button>
172
+ <button class="flex flex-col items-center text-xs text-blue-700">
173
+ <i class="fas fa-calendar-check text-lg mb-1"></i>
174
+ <span>นัดหมาย</span>
175
+ </button>
176
+ <button class="flex flex-col items-center text-xs text-blue-700">
177
+ <i class="fas fa-map-marked-alt text-lg mb-1"></i>
178
+ <span>แผนที่</span>
179
+ </button>
180
+ <button class="flex flex-col items-center text-xs text-blue-700">
181
+ <i class="fas fa-question-circle text-lg mb-1"></i>
182
+ <span>ช่วยเหลือ</span>
183
+ </button>
184
+ </div>
185
+
186
+ <!-- Input Area -->
187
+ <div class="flex items-center p-2">
188
+ <!-- Attachment Button -->
189
+ <button aria-label="แนบไฟล์"
190
+ class="w-10 h-10 flex items-center justify-center rounded-full text-gray-600 mr-1">
191
+ <i class="fas fa-paperclip text-xl"></i>
192
+ </button>
193
+
194
+ <!-- Text Input -->
195
+ <div class="flex-1 mx-1">
196
+ <input type="text"
197
+ placeholder="พิมพ์ข้อความ..."
198
+ class="w-full px-4 py-2 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-transparent"
199
+ style="min-height: 44px; font-size: 16px;">
200
+ </div>
201
+
202
+ <!-- Voice Input -->
203
+ <button aria-label="ป้อนด้วยเสียง"
204
+ class="w-10 h-10 flex items-center justify-center rounded-full text-gray-600 mr-1">
205
+ <i class="fas fa-microphone text-xl"></i>
206
+ </button>
207
+
208
+ <!-- Send Button -->
209
+ <button aria-label="ส่งข้อความ"
210
+ class="w-10 h-10 flex items-center justify-center rounded-full bg-blue-600 text-white">
211
+ <i class="fas fa-paper-plane text-xl"></i>
212
+ </button>
213
+ </div>
214
+ </footer>
215
+ </div>
216
+
217
+ <!-- API Integration Documentation (Hidden in UI) -->
218
+ <div class="hidden">
219
+ <h2>API Integration Requirements</h2>
220
+ <h3>1. LINE Messaging API</h3>
221
+ <ul>
222
+ <li>Endpoint: https://api.line.me/v2/bot/message/reply</li>
223
+ <li>Authentication: Bearer token (Channel Access Token)</li>
224
+ <li>Message types supported: Text, Image, Quick Reply, Template</li>
225
+ <li>Rate limit: 1000 messages/second</li>
226
+ </ul>
227
+
228
+ <h3>2. Local Government Database API</h3>
229
+ <ul>
230
+ <li>Endpoint: https://api.localgov.go.th/services</li>
231
+ <li>Authentication: OAuth 2.0 with client credentials</li>
232
+ <li>Required headers: X-API-Key, Content-Type: application/json</li>
233
+ <li>Data format: JSON with UTF-8 encoding</li>
234
+ </ul>
235
+
236
+ <h3>3. Google Cloud APIs</h3>
237
+ <ul>
238
+ <li>Speech-to-Text: Thai language model</li>
239
+ <li>Vision API: For document/image processing</li>
240
+ <li>Authentication: Service account JSON key</li>
241
+ </ul>
242
+
243
+ <h3>Error Handling Procedures</h3>
244
+ <ol>
245
+ <li>Display user-friendly error message in Thai</li>
246
+ <li>Log technical details to server</li>
247
+ <li>Retry failed requests (max 3 attempts)</li>
248
+ <li>Fallback to cached data when available</li>
249
+ <li>Provide alternative contact methods when API fails</li>
250
+ </ol>
251
+
252
+ <h3>PDPA Compliance</h3>
253
+ <ul>
254
+ <li>All personal data encrypted in transit and at rest</li>
255
+ <li>User consent obtained before data collection</li>
256
+ <li>Data retention policy: 90 days for chat logs</li>
257
+ <li>Right to erasure implemented</li>
258
+ </ul>
259
+ </div>
260
+
261
+ <script>
262
+ document.addEventListener('DOMContentLoaded', function() {
263
+ // Simulate API error after 5 seconds
264
+ setTimeout(() => {
265
+ document.getElementById('error-message').classList.remove('hidden');
266
+ }, 5000);
267
+
268
+ // Handle quick reply clicks
269
+ const quickReplies = document.querySelectorAll('.quick-reply');
270
+ quickReplies.forEach(reply => {
271
+ reply.addEventListener('click', function() {
272
+ const text = this.textContent.trim();
273
+ console.log('Quick reply selected:', text);
274
+ // In real app, this would trigger API call to local government services
275
+ });
276
+ });
277
+
278
+ // Handle font size adjustment
279
+ const fontSizeSelect = document.querySelector('select');
280
+ fontSizeSelect.addEventListener('change', function() {
281
+ const size = this.value;
282
+ let newSize = '16px';
283
+ if(size === 'small') newSize = '14px';
284
+ if(size === 'large') newSize = '18px';
285
+
286
+ document.body.style.fontSize = newSize;
287
+ document.querySelector('input[type="text"]').style.fontSize = newSize;
288
+ });
289
+
290
+ // Handle voice input
291
+ const voiceButton = document.querySelector('[aria-label="ป้อนด้วยเสียง"]');
292
+ voiceButton.addEventListener('click', function() {
293
+ console.log('Voice input activated');
294
+ // Would integrate with Web Speech API or Google Cloud Speech-to-Text
295
+ });
296
+
297
+ // Handle attachment
298
+ const attachButton = document.querySelector('[aria-label="แนบไฟล์"]');
299
+ attachButton.addEventListener('click', function() {
300
+ console.log('Attachment dialog opened');
301
+ // Would trigger file input for document/image upload
302
+ });
303
+ });
304
+ </script>
305
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=kritsanan/chatbot-55" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
306
+ </html>
prompts.txt ADDED
File without changes