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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>เซียนกุ้งลาดพร้าว - Ladprao Shrimp Oracle</title>
|
| 7 |
+
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
| 8 |
+
<style>
|
| 9 |
+
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600;700&display=swap');
|
| 10 |
+
|
| 11 |
+
body {
|
| 12 |
+
font-family: 'Prompt', sans-serif;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
.custom-scrollbar::-webkit-scrollbar {
|
| 16 |
+
width: 4px;
|
| 17 |
+
}
|
| 18 |
+
.custom-scrollbar::-webkit-scrollbar-track {
|
| 19 |
+
background: transparent;
|
| 20 |
+
}
|
| 21 |
+
.custom-scrollbar::-webkit-scrollbar-thumb {
|
| 22 |
+
background: rgba(255,255,255,0.1);
|
| 23 |
+
border-radius: 4px;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
@keyframes fadeSlideIn {
|
| 27 |
+
from {
|
| 28 |
+
opacity: 0;
|
| 29 |
+
transform: translateY(10px);
|
| 30 |
+
}
|
| 31 |
+
to {
|
| 32 |
+
opacity: 1;
|
| 33 |
+
transform: translateY(0);
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.animate-fade-slide {
|
| 38 |
+
animation: fadeSlideIn 0.5s ease-out forwards;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
@keyframes pulse-glow {
|
| 42 |
+
0%, 100% { box-shadow: 0 0 15px rgba(249, 115, 22, 0.3); }
|
| 43 |
+
50% { box-shadow: 0 0 25px rgba(249, 115, 22, 0.5); }
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.pulse-glow {
|
| 47 |
+
animation: pulse-glow 2s infinite;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
input[type="date"]::-webkit-calendar-picker-indicator,
|
| 51 |
+
input[type="time"]::-webkit-calendar-picker-indicator {
|
| 52 |
+
filter: invert(1) opacity(0.5);
|
| 53 |
+
}
|
| 54 |
+
</style>
|
| 55 |
+
</head>
|
| 56 |
+
<body class="min-h-screen bg-[#0f172a] text-slate-100 flex flex-col">
|
| 57 |
+
|
| 58 |
+
<!-- Background -->
|
| 59 |
+
<div class="fixed inset-0 z-0 pointer-events-none">
|
| 60 |
+
<div class="absolute top-0 left-0 w-full h-[300px] bg-gradient-to-b from-purple-900/30 to-transparent"></div>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<!-- Header -->
|
| 64 |
+
<header class="flex-none h-16 bg-[#0f172a]/90 backdrop-blur-md border-b border-white/10 flex items-center justify-between px-4 z-50 sticky top-0">
|
| 65 |
+
<div class="flex items-center gap-3">
|
| 66 |
+
<div class="w-9 h-9 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 flex items-center justify-center shadow-lg pulse-glow">
|
| 67 |
+
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 68 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"/>
|
| 69 |
+
</svg>
|
| 70 |
+
</div>
|
| 71 |
+
<div class="leading-tight">
|
| 72 |
+
<h1 id="headerTitle" class="text-base font-bold text-white">เซียนกุ้งลาดพร้าว</h1>
|
| 73 |
+
<p id="headerSubtitle" class="text-[10px] text-slate-400">AI ทำนายผล คู่/คี่</p>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<div class="flex gap-2">
|
| 78 |
+
<button id="langBtn" class="p-2 bg-white/5 rounded-full hover:bg-white/10 transition-colors">
|
| 79 |
+
<svg class="w-4 h-4 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 80 |
+
<circle cx="12" cy="12" r="10"/>
|
| 81 |
+
<path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
|
| 82 |
+
</svg>
|
| 83 |
+
</button>
|
| 84 |
+
<button id="resetBtn" class="p-2 bg-white/5 rounded-full text-red-400 hover:bg-white/10 transition-colors hidden">
|
| 85 |
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 86 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
| 87 |
+
</svg>
|
| 88 |
+
</button>
|
| 89 |
+
</div>
|
| 90 |
+
</header>
|
| 91 |
+
|
| 92 |
+
<!-- Main Content -->
|
| 93 |
+
<main id="mainContent" class="flex-1 p-4 pb-48 custom-scrollbar relative z-10">
|
| 94 |
+
|
| 95 |
+
<!-- Input Step -->
|
| 96 |
+
<div id="inputStep" class="max-w-md mx-auto space-y-6 animate-fade-slide">
|
| 97 |
+
|
| 98 |
+
<!-- Intro Card -->
|
| 99 |
+
<div class="bg-gradient-to-br from-slate-800 to-slate-900 border border-white/10 rounded-2xl p-5 shadow-xl">
|
| 100 |
+
<h2 class="text-orange-400 font-bold mb-2 flex items-center gap-2 text-sm uppercase tracking-wider">
|
| 101 |
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 102 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"/>
|
| 103 |
+
</svg>
|
| 104 |
+
<span id="introTitle">ระบบคำนวณดวงเกมตกกุ้ง</span>
|
| 105 |
+
</h2>
|
| 106 |
+
<p id="introText" class="text-xs text-slate-300 leading-relaxed">ระบบ AI ผสานศาสตร์ปาจื้อและจื่อเวยฯ วิเคราะห์เกมชั่งน้ำหนักกุ้งลาดพร้าว คำนวณดัชนีโชคลาภและฟันธง 'คู่' หรือ 'คี่' ตามเวลาจริง</p>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<!-- API Key -->
|
| 110 |
+
<div class="space-y-2">
|
| 111 |
+
<label id="apiKeyLabel" class="text-xs font-semibold text-purple-400 uppercase ml-1">1. ใส่คีย์สมอง (DeepSeek API)</label>
|
| 112 |
+
<div class="relative">
|
| 113 |
+
<svg class="absolute left-3 top-3.5 h-4 w-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 114 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/>
|
| 115 |
+
</svg>
|
| 116 |
+
<input
|
| 117 |
+
type="password"
|
| 118 |
+
id="apiKeyInput"
|
| 119 |
+
placeholder="sk-..."
|
| 120 |
+
class="w-full pl-10 pr-4 py-3 bg-slate-900/50 border border-white/20 rounded-xl text-sm focus:border-orange-500 outline-none transition-all"
|
| 121 |
+
/>
|
| 122 |
+
</div>
|
| 123 |
+
<p id="apiKeyNote" class="text-[10px] text-slate-500 ml-1">*คีย์ใช้ส่งข้อมูลหา AI เท่านั้น ไม่มีการบันทึก</p>
|
| 124 |
+
|
| 125 |
+
<!-- Demo Mode Toggle -->
|
| 126 |
+
<label class="flex items-center gap-2 mt-2 cursor-pointer group">
|
| 127 |
+
<input type="checkbox" id="demoModeToggle" class="w-4 h-4 rounded bg-slate-800 border-orange-500 text-orange-500 focus:ring-orange-500 focus:ring-offset-0">
|
| 128 |
+
<span id="demoModeLabel" class="text-xs text-orange-400 group-hover:text-orange-300">🎮 โหมดทดสอบ (ไม่ต้องใช้ API Key)</span>
|
| 129 |
+
</label>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
<!-- User Form -->
|
| 133 |
+
<div class="space-y-3 bg-white/5 p-4 rounded-2xl border border-white/5">
|
| 134 |
+
<label id="userInfoLabel" class="text-xs font-semibold text-purple-400 uppercase mb-2 block">2. ข้อมูลเจ้าชะตา (กรอกครั้งเดียว)</label>
|
| 135 |
+
|
| 136 |
+
<div class="grid grid-cols-2 gap-3">
|
| 137 |
+
<div>
|
| 138 |
+
<label id="nameLabelEl" class="text-[10px] text-slate-500 mb-1 block">ชื่อเล่น</label>
|
| 139 |
+
<input type="text" id="nameInput" class="w-full p-2 bg-slate-900 rounded-lg border border-white/10 text-sm outline-none focus:border-orange-500" />
|
| 140 |
+
</div>
|
| 141 |
+
<div>
|
| 142 |
+
<label id="genderLabelEl" class="text-[10px] text-slate-500 mb-1 block">เพศ</label>
|
| 143 |
+
<div class="flex bg-slate-900 rounded-lg p-1 border border-white/10 h-[38px]">
|
| 144 |
+
<button id="maleBtn" class="flex-1 rounded-md text-xs bg-blue-600 text-white transition-colors">ชาย</button>
|
| 145 |
+
<button id="femaleBtn" class="flex-1 rounded-md text-xs text-slate-500 transition-colors">หญิง</button>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
|
| 150 |
+
<div class="grid grid-cols-2 gap-3">
|
| 151 |
+
<div>
|
| 152 |
+
<label id="birthDateLabelEl" class="text-[10px] text-slate-500 mb-1 block">วันเกิด</label>
|
| 153 |
+
<input type="date" id="birthDateInput" class="w-full p-2 bg-slate-900 rounded-lg border border-white/10 text-sm text-slate-300 outline-none focus:border-orange-500" />
|
| 154 |
+
</div>
|
| 155 |
+
<div>
|
| 156 |
+
<label id="birthTimeLabelEl" class="text-[10px] text-slate-500 mb-1 block">เวลาเกิด</label>
|
| 157 |
+
<input type="time" id="birthTimeInput" class="w-full p-2 bg-slate-900 rounded-lg border border-white/10 text-sm text-slate-300 outline-none focus:border-orange-500" />
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<div>
|
| 162 |
+
<label id="birthCityLabelEl" class="text-[10px] text-slate-500 mb-1 block">จังหวัดเกิด</label>
|
| 163 |
+
<input type="text" id="birthCityInput" placeholder="กทม." class="w-full p-2 bg-slate-900 rounded-lg border border-white/10 text-sm outline-none focus:border-orange-500" />
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
|
| 167 |
+
<!-- Initial Target -->
|
| 168 |
+
<div class="space-y-3">
|
| 169 |
+
<label id="targetLabel" class="text-xs font-semibold text-purple-400 uppercase ml-1">3. เริ่มทำนายรอบแรก</label>
|
| 170 |
+
<div class="grid grid-cols-2 gap-3">
|
| 171 |
+
<div class="relative">
|
| 172 |
+
<svg class="absolute left-3 top-3 h-4 w-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 173 |
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/>
|
| 174 |
+
<line x1="16" y1="2" x2="16" y2="6"/>
|
| 175 |
+
<line x1="8" y1="2" x2="8" y2="6"/>
|
| 176 |
+
<line x1="3" y1="10" x2="21" y2="10"/>
|
| 177 |
+
</svg>
|
| 178 |
+
<input type="date" id="targetDateInput" class="w-full pl-9 p-3 bg-slate-900/50 border border-white/20 rounded-xl text-sm text-white outline-none focus:border-orange-500" />
|
| 179 |
+
</div>
|
| 180 |
+
<div class="relative">
|
| 181 |
+
<svg class="absolute left-3 top-3 h-4 w-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 182 |
+
<circle cx="12" cy="12" r="10"/>
|
| 183 |
+
<polyline points="12 6 12 12 16 14"/>
|
| 184 |
+
</svg>
|
| 185 |
+
<input type="time" id="targetTimeInput" value="20:30" class="w-full pl-9 p-3 bg-slate-900/50 border border-white/20 rounded-xl text-sm text-white outline-none focus:border-orange-500" />
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
<!-- Start Button -->
|
| 191 |
+
<button id="startBtn" class="w-full py-4 bg-gradient-to-r from-orange-600 to-red-600 text-white font-bold rounded-xl shadow-lg shadow-orange-900/40 active:scale-95 transition-transform flex items-center justify-center gap-2 hover:from-orange-500 hover:to-red-500">
|
| 192 |
+
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 193 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"/>
|
| 194 |
+
</svg>
|
| 195 |
+
<span id="startBtnText">วิเคราะห์ผล (คู่/คี่)</span>
|
| 196 |
+
</button>
|
| 197 |
+
|
| 198 |
+
<!-- Advanced Toggle -->
|
| 199 |
+
<div class="pt-2 text-center">
|
| 200 |
+
<button id="advancedToggle" class="text-[10px] text-slate-500 flex items-center justify-center gap-1 mx-auto hover:text-slate-400 transition-colors">
|
| 201 |
+
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 202 |
+
<circle cx="12" cy="12" r="3"/>
|
| 203 |
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
|
| 204 |
+
</svg>
|
| 205 |
+
<span id="advancedText">ตั้งค่า AI (ขั้นสูง)</span>
|
| 206 |
+
<svg id="advancedChevron" class="w-3 h-3 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 207 |
+
<polyline points="6 9 12 15 18 9"/>
|
| 208 |
+
</svg>
|
| 209 |
+
</button>
|
| 210 |
+
<div id="advancedPanel" class="hidden mt-2">
|
| 211 |
+
<textarea id="systemPromptInput" class="w-full h-32 bg-black/30 border border-white/10 rounded-lg p-2 text-[10px] font-mono text-slate-400 outline-none focus:border-orange-500"></textarea>
|
| 212 |
+
<button id="restoreDefaultBtn" class="mt-2 text-[10px] text-orange-400 hover:text-orange-300">คืนค่าเดิม</button>
|
| 213 |
+
</div>
|
| 214 |
+
</div>
|
| 215 |
+
</div>
|
| 216 |
+
|
| 217 |
+
<!-- Chat Step -->
|
| 218 |
+
<div id="chatStep" class="max-w-md mx-auto space-y-4 hidden">
|
| 219 |
+
<div id="chatMessages"></div>
|
| 220 |
+
|
| 221 |
+
<!-- Loading -->
|
| 222 |
+
<div id="loadingIndicator" class="hidden flex justify-start">
|
| 223 |
+
<div class="bg-slate-800 rounded-2xl rounded-tl-none p-3 flex items-center gap-2">
|
| 224 |
+
<svg class="w-4 h-4 animate-spin text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 225 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
| 226 |
+
</svg>
|
| 227 |
+
<span id="loadingText" class="text-xs text-slate-400">AI กำลังคำนวณดวง...</span>
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
+
|
| 231 |
+
<div id="chatEnd" class="h-4"></div>
|
| 232 |
+
</div>
|
| 233 |
+
</main>
|
| 234 |
+
|
| 235 |
+
<!-- Bottom Action Bar (for repeat bets) -->
|
| 236 |
+
<div id="bottomBar" class="fixed bottom-0 left-0 right-0 bg-[#0f172a]/95 backdrop-blur-xl border-t border-white/10 p-4 z-50 hidden animate-fade-slide">
|
| 237 |
+
<div class="max-w-md mx-auto">
|
| 238 |
+
<div class="flex items-center justify-between mb-2">
|
| 239 |
+
<span class="text-xs font-bold text-purple-400 uppercase flex items-center gap-1">
|
| 240 |
+
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 241 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
| 242 |
+
</svg>
|
| 243 |
+
<span id="nextRoundTitle">รอบถัดไป?</span>
|
| 244 |
+
</span>
|
| 245 |
+
<span id="nextRoundDesc" class="text-[10px] text-slate-500">ดวงเดิม เปลี่ยนแค่เวลาแทง</span>
|
| 246 |
+
</div>
|
| 247 |
+
|
| 248 |
+
<div class="flex gap-2">
|
| 249 |
+
<div class="relative flex-1">
|
| 250 |
+
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
| 251 |
+
<svg class="h-4 w-4 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 252 |
+
<circle cx="12" cy="12" r="10"/>
|
| 253 |
+
<polyline points="12 6 12 12 16 14"/>
|
| 254 |
+
</svg>
|
| 255 |
+
</div>
|
| 256 |
+
<input
|
| 257 |
+
type="time"
|
| 258 |
+
id="nextTimeInput"
|
| 259 |
+
value="20:30"
|
| 260 |
+
class="block w-full pl-10 pr-2 py-3 bg-slate-900 border border-white/20 rounded-xl text-sm text-white focus:ring-2 focus:ring-orange-500 focus:border-transparent outline-none font-mono"
|
| 261 |
+
/>
|
| 262 |
+
</div>
|
| 263 |
+
<button
|
| 264 |
+
id="predictNextBtn"
|
| 265 |
+
class="bg-gradient-to-r from-orange-600 to-red-600 hover:from-orange-500 hover:to-red-500 text-white px-6 rounded-xl font-bold shadow-lg shadow-orange-900/30 active:scale-95 transition-all flex items-center gap-2"
|
| 266 |
+
>
|
| 267 |
+
<span id="predictNextText">ทำนายรอบใหม่</span>
|
| 268 |
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 269 |
+
<line x1="5" y1="12" x2="19" y2="12"/>
|
| 270 |
+
<polyline points="12 5 19 12 12 19"/>
|
| 271 |
+
</svg>
|
| 272 |
+
</button>
|
| 273 |
+
</div>
|
| 274 |
+
<div class="mt-2 text-center">
|
| 275 |
+
<input
|
| 276 |
+
type="date"
|
| 277 |
+
id="nextDateInput"
|
| 278 |
+
class="bg-transparent text-[10px] text-slate-600 text-center w-24 outline-none"
|
| 279 |
+
/>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
</div>
|
| 283 |
+
|
| 284 |
+
<script>
|
| 285 |
+
// --- Translation Data ---
|
| 286 |
+
const TRANSLATIONS = {
|
| 287 |
+
'th': {
|
| 288 |
+
title: "เซียนกุ้งลาดพร้าว",
|
| 289 |
+
subtitle: "AI ทำนายผล คู่/คี่",
|
| 290 |
+
reset: "ล้างข้อมูล",
|
| 291 |
+
introTitle: "ระบบคำนวณดวงเกมตกกุ้ง",
|
| 292 |
+
introText: "ระบบ AI ผสานศาสตร์ปาจื้อและจื่อเวยฯ วิเคราะห์เกมชั่งน้ำหนักกุ้งลาดพร้าว คำนวณดัชนีโชคลาภและฟันธง 'คู่' หรือ 'คี่' ตามเวลาจริง",
|
| 293 |
+
apiKeyLabel: "1. ใส่คีย์สมอง (DeepSeek API)",
|
| 294 |
+
apiKeyPlaceholder: "sk-...",
|
| 295 |
+
apiKeyNote: "*คีย์ใช้ส่งข้อมูลหา AI เท่านั้น ไม่มีการบันทึก",
|
| 296 |
+
userInfoLabel: "2. ข้อมูลเจ้าชะตา (กรอกครั้งเดียว)",
|
| 297 |
+
nameLabel: "ชื่อเล่น",
|
| 298 |
+
genderLabel: "เพศ",
|
| 299 |
+
male: "ชาย",
|
| 300 |
+
female: "หญิง",
|
| 301 |
+
birthDateLabel: "วันเกิด",
|
| 302 |
+
birthTimeLabel: "เวลาเกิด",
|
| 303 |
+
birthCityLabel: "จังหวัดเกิด",
|
| 304 |
+
birthCityPlaceholder: "กทม.",
|
| 305 |
+
targetLabel: "3. เริ่มทำนายรอบแรก",
|
| 306 |
+
targetDateLabel: "วันที่เล่น",
|
| 307 |
+
targetQuestionLabel: "เวลาที่จะแทง",
|
| 308 |
+
advancedSettings: "ตั้งค่า AI (ขั้นสูง)",
|
| 309 |
+
restoreDefault: "คืนค่าเดิม",
|
| 310 |
+
startAnalysis: "วิเคราะห์ผล (คู่/คี่)",
|
| 311 |
+
loading: "AI กำลังคำนวณดวง...",
|
| 312 |
+
reportTitle: "ผลการทำนาย",
|
| 313 |
+
errorApiKey: "ต้องใส่ API Key ก่อนครับ",
|
| 314 |
+
errorInfo: "กรุณากรอกวันเวลาเกิดให้ครบ",
|
| 315 |
+
aiRole: "หมอดู AI",
|
| 316 |
+
initialGreeting: (name) => `สวัสดีคุณ ${name} ได้รับข้อมูลดวงชะตาแล้ว กำลังเชื่อมต่อจักรวาล...`,
|
| 317 |
+
nextRoundTitle: "รอบถัดไป?",
|
| 318 |
+
nextRoundDesc: "ดวงเดิม เปลี่ยนแค่เวลาแทง",
|
| 319 |
+
predictNext: "ทำนายรอบใหม่"
|
| 320 |
+
},
|
| 321 |
+
'zh-TW': {
|
| 322 |
+
title: "曼谷運勢智囊",
|
| 323 |
+
subtitle: "DeepSeek AI 驅動 - 釣蝦場單雙預測",
|
| 324 |
+
reset: "重置",
|
| 325 |
+
introTitle: "命理融合預測系統",
|
| 326 |
+
introText: "本系統結合八字與紫微斗數,專門針對曼谷 Ladprao 釣蝦場的秤重遊戲進行分析。AI 將計算您的偏財指數與最佳下注策略(單/雙)。",
|
| 327 |
+
apiKeyLabel: "1. API 金鑰",
|
| 328 |
+
apiKeyPlaceholder: "sk-...",
|
| 329 |
+
apiKeyNote: "*您的 Key 不會被儲存。",
|
| 330 |
+
userInfoLabel: "2. 命主資料",
|
| 331 |
+
nameLabel: "暱稱",
|
| 332 |
+
genderLabel: "性別",
|
| 333 |
+
male: "男",
|
| 334 |
+
female: "女",
|
| 335 |
+
birthDateLabel: "出生日期",
|
| 336 |
+
birthTimeLabel: "出生時間",
|
| 337 |
+
birthCityLabel: "出生地",
|
| 338 |
+
birthCityPlaceholder: "曼谷",
|
| 339 |
+
targetLabel: "3. 首次預測",
|
| 340 |
+
targetDateLabel: "日期",
|
| 341 |
+
targetQuestionLabel: "下注時間",
|
| 342 |
+
advancedSettings: "進階設定",
|
| 343 |
+
restoreDefault: "恢復預設",
|
| 344 |
+
startAnalysis: "開始預測",
|
| 345 |
+
loading: "正在計算...",
|
| 346 |
+
reportTitle: "預測報告",
|
| 347 |
+
errorApiKey: "請輸入 API Key。",
|
| 348 |
+
errorInfo: "請填寫完整資訊。",
|
| 349 |
+
aiRole: "AI",
|
| 350 |
+
initialGreeting: (name) => `您好 ${name},資料已確認,正在推算...`,
|
| 351 |
+
nextRoundTitle: "下一輪預測?",
|
| 352 |
+
nextRoundDesc: "保留命盤,僅修改時間",
|
| 353 |
+
predictNext: "預測新時間"
|
| 354 |
+
},
|
| 355 |
+
'en': {
|
| 356 |
+
title: "Ladprao Oracle",
|
| 357 |
+
subtitle: "Shrimp Game AI Prediction",
|
| 358 |
+
reset: "Reset",
|
| 359 |
+
introTitle: "Prediction System",
|
| 360 |
+
introText: "Combines BaZi and ZiWei DouShu to analyze the Ladprao Shrimp weighing game. AI calculates Odd/Even strategy based on time.",
|
| 361 |
+
apiKeyLabel: "1. DeepSeek API Key",
|
| 362 |
+
apiKeyPlaceholder: "sk-...",
|
| 363 |
+
apiKeyNote: "*Key is not stored.",
|
| 364 |
+
userInfoLabel: "2. Your Details",
|
| 365 |
+
nameLabel: "Name",
|
| 366 |
+
genderLabel: "Gender",
|
| 367 |
+
male: "Male",
|
| 368 |
+
female: "Female",
|
| 369 |
+
birthDateLabel: "Birth Date",
|
| 370 |
+
birthTimeLabel: "Birth Time",
|
| 371 |
+
birthCityLabel: "Birth City",
|
| 372 |
+
birthCityPlaceholder: "Bangkok",
|
| 373 |
+
targetLabel: "3. First Bet",
|
| 374 |
+
targetDateLabel: "Game Date",
|
| 375 |
+
targetQuestionLabel: "Bet Time",
|
| 376 |
+
advancedSettings: "Advanced",
|
| 377 |
+
restoreDefault: "Default",
|
| 378 |
+
startAnalysis: "Predict Odd/Even",
|
| 379 |
+
loading: "Calculating...",
|
| 380 |
+
reportTitle: "Report",
|
| 381 |
+
errorApiKey: "API Key required.",
|
| 382 |
+
errorInfo: "Incomplete Info.",
|
| 383 |
+
aiRole: "AI",
|
| 384 |
+
initialGreeting: (name) => `Hello ${name}, calculating your luck...`,
|
| 385 |
+
nextRoundTitle: "Next Round?",
|
| 386 |
+
nextRoundDesc: "Same person, new time",
|
| 387 |
+
predictNext: "Predict Next"
|
| 388 |
+
}
|
| 389 |
+
};
|
| 390 |
+
|
| 391 |
+
// --- System Prompts ---
|
| 392 |
+
const SYSTEM_PROMPTS = {
|
| 393 |
+
'th': `คุณคือปรมาจารย์โหราศาสตร์ (ปาจื้อและจื่อเวยโต่วซู่) หน้าที่ของคุณคือวิเคราะห์ดวงโชคลาภสำหรับเกมเสี่ยงโชค
|
| 394 |
+
|
| 395 |
+
โปรดปฏิบัติตามตรรกะนี้:
|
| 396 |
+
|
| 397 |
+
[ตรรกะการวิเคราะห์]
|
| 398 |
+
1. คำนวณธาตุให้คุณและดาวโชคลาภในเรือนทรัพย์สินจากวันเกิด
|
| 399 |
+
2. **วิเคราะห์เกม**: นี่คือเกมที่บ่อตกกุ้งลาดพร้าว กรุงเทพฯ หลัง 20:00 น. จะมีการชั่งน้ำหนักกุ้ง 9 ตัว ให้ทายเลขท้ายน้ำหนักว่า "คี่" หรือ "คู่"
|
| 400 |
+
- คี่ (Odd) = ปุ่มสีแดง
|
| 401 |
+
- คู่ (Even) = ปุ่มสีน้ำเงิน
|
| 402 |
+
3. คุณต้องคำนวณ "ดัชนีโชคลาภ" ของผู้ใช้ ณ เวลาที่ระบุ และฟันธงว่าเวลานี้ ควรแทง "คี่" หรือ "คู่"
|
| 403 |
+
|
| 404 |
+
[รูปแบบการตอบกลับ - ห้ามเยิ่นเย้อ]
|
| 405 |
+
1. **เวลา**: [เวลาที่ถาม]
|
| 406 |
+
2. **ดัชนีโชค**: (0-100%)
|
| 407 |
+
3. **ฟันธง**: 🔴 คี่ (RED) หรือ 🔵 คู่ (BLUE) (เลือก 1 อย่างเท่านั้นให้ชัดเจน)
|
| 408 |
+
4. **เคล็ดลับสั้นๆ**: ทิศที่ควรนั่ง หรือ สีเสื้อเสริมดวง`,
|
| 409 |
+
|
| 410 |
+
'zh-TW': `你是一位精通「八字」與「紫微斗數」的大師。針對曼谷 Ladprao 釣蝦場秤重遊戲進行單雙預測。
|
| 411 |
+
|
| 412 |
+
遊戲規則:晚上8點後,秤9隻蝦,猜尾數單雙。
|
| 413 |
+
請根據用戶提供的出生資料與下注時間,計算當下的偏財運。
|
| 414 |
+
|
| 415 |
+
【輸出格式 - 請簡潔】
|
| 416 |
+
1. **下注時間**: [時間]
|
| 417 |
+
2. **偏財指數**: (0-100%)
|
| 418 |
+
3. **建議選擇**: 🔴 單 (RED) 或 🔵 雙 (BLUE)
|
| 419 |
+
4. **簡短建議**: 吉祥方位或顏色`,
|
| 420 |
+
|
| 421 |
+
'en': `You are an Astrology Master. Analyze luck for the Ladprao Shrimp Weighing Game (Odd/Even betting).
|
| 422 |
+
Based on birth data and betting time, calculate the windfall luck.
|
| 423 |
+
|
| 424 |
+
[Output Format - Be Concise]
|
| 425 |
+
1. **Time**: [Target Time]
|
| 426 |
+
2. **Luck Index**: (0-100%)
|
| 427 |
+
3. **Prediction**: 🔴 ODD (RED) or 🔵 EVEN (BLUE)
|
| 428 |
+
4. **Tip**: Lucky direction or color`
|
| 429 |
+
};
|
| 430 |
+
|
| 431 |
+
// --- App State ---
|
| 432 |
+
let state = {
|
| 433 |
+
lang: 'th',
|
| 434 |
+
step: 'input',
|
| 435 |
+
gender: 'male',
|
| 436 |
+
chatHistory: [],
|
| 437 |
+
loading: false,
|
| 438 |
+
demoMode: false
|
| 439 |
+
};
|
| 440 |
+
|
| 441 |
+
// --- DOM Elements ---
|
| 442 |
+
const $ = (id) => document.getElementById(id);
|
| 443 |
+
|
| 444 |
+
// Set today's date as default
|
| 445 |
+
const todayDate = new Date().toISOString().split('T')[0];
|
| 446 |
+
$('targetDateInput').value = todayDate;
|
| 447 |
+
$('nextDateInput').value = todayDate;
|
| 448 |
+
$('systemPromptInput').value = SYSTEM_PROMPTS['th'];
|
| 449 |
+
|
| 450 |
+
// --- Update UI based on language ---
|
| 451 |
+
function updateLanguage() {
|
| 452 |
+
const t = TRANSLATIONS[state.lang];
|
| 453 |
+
|
| 454 |
+
$('headerTitle').textContent = t.title;
|
| 455 |
+
$('headerSubtitle').textContent = t.subtitle;
|
| 456 |
+
$('introTitle').textContent = t.introTitle;
|
| 457 |
+
$('introText').textContent = t.introText;
|
| 458 |
+
$('apiKeyLabel').textContent = t.apiKeyLabel;
|
| 459 |
+
$('apiKeyInput').placeholder = t.apiKeyPlaceholder;
|
| 460 |
+
$('apiKeyNote').textContent = t.apiKeyNote;
|
| 461 |
+
$('userInfoLabel').textContent = t.userInfoLabel;
|
| 462 |
+
$('nameLabelEl').textContent = t.nameLabel;
|
| 463 |
+
$('genderLabelEl').textContent = t.genderLabel;
|
| 464 |
+
$('maleBtn').textContent = t.male;
|
| 465 |
+
$('femaleBtn').textContent = t.female;
|
| 466 |
+
$('birthDateLabelEl').textContent = t.birthDateLabel;
|
| 467 |
+
$('birthTimeLabelEl').textContent = t.birthTimeLabel;
|
| 468 |
+
$('birthCityLabelEl').textContent = t.birthCityLabel;
|
| 469 |
+
$('birthCityInput').placeholder = t.birthCityPlaceholder;
|
| 470 |
+
$('targetLabel').textContent = t.targetLabel;
|
| 471 |
+
$('advancedText').textContent = t.advancedSettings;
|
| 472 |
+
$('restoreDefaultBtn').textContent = t.restoreDefault;
|
| 473 |
+
$('startBtnText').textContent = t.startAnalysis;
|
| 474 |
+
$('loadingText').textContent = t.loading;
|
| 475 |
+
$('nextRoundTitle').textContent = t.nextRoundTitle;
|
| 476 |
+
$('nextRoundDesc').textContent = t.nextRoundDesc;
|
| 477 |
+
$('predictNextText').textContent = t.predictNext;
|
| 478 |
+
|
| 479 |
+
$('systemPromptInput').value = SYSTEM_PROMPTS[state.lang];
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
// --- Render chat messages ---
|
| 483 |
+
function renderContent(text) {
|
| 484 |
+
return text.split('\n').map(line => {
|
| 485 |
+
if (line.includes('🔴') || line.includes('คี่') || line.includes('ODD') || line.includes('單')) {
|
| 486 |
+
return `<div class="bg-red-500/20 border border-red-500/50 text-red-100 p-3 rounded-xl my-2 font-bold text-lg text-center shadow-[0_0_15px_rgba(239,68,68,0.3)]">${line}</div>`;
|
| 487 |
+
}
|
| 488 |
+
if (line.includes('🔵') || line.includes('คู่') || line.includes('EVEN') || line.includes('雙')) {
|
| 489 |
+
return `<div class="bg-blue-500/20 border border-blue-500/50 text-blue-100 p-3 rounded-xl my-2 font-bold text-lg text-center shadow-[0_0_15px_rgba(59,130,246,0.3)]">${line}</div>`;
|
| 490 |
+
}
|
| 491 |
+
if (line.startsWith('**')) {
|
| 492 |
+
return `<p class="font-bold text-amber-400 mt-2">${line.replace(/\*\*/g, '')}</p>`;
|
| 493 |
+
}
|
| 494 |
+
return `<p class="mb-1">${line}</p>`;
|
| 495 |
+
}).join('');
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
function renderChat() {
|
| 499 |
+
const t = TRANSLATIONS[state.lang];
|
| 500 |
+
const container = $('chatMessages');
|
| 501 |
+
container.innerHTML = state.chatHistory.map((msg, idx) => {
|
| 502 |
+
if (msg.role === 'assistant') {
|
| 503 |
+
return `
|
| 504 |
+
<div class="flex justify-start animate-fade-slide" style="animation-delay: ${idx * 0.1}s">
|
| 505 |
+
<div class="max-w-[90%] bg-slate-800 border border-white/10 rounded-2xl rounded-tl-none p-4 shadow-md">
|
| 506 |
+
<div class="flex items-center gap-2 mb-2 border-b border-white/5 pb-2">
|
| 507 |
+
<div class="w-5 h-5 rounded-full bg-gradient-to-r from-purple-500 to-blue-500 flex items-center justify-center text-[8px] font-bold">AI</div>
|
| 508 |
+
<span class="text-xs font-bold text-purple-300">${t.reportTitle}</span>
|
| 509 |
+
</div>
|
| 510 |
+
<div class="text-sm text-slate-200 leading-relaxed">${renderContent(msg.content)}</div>
|
| 511 |
+
</div>
|
| 512 |
+
</div>
|
| 513 |
+
`;
|
| 514 |
+
} else {
|
| 515 |
+
return `
|
| 516 |
+
<div class="flex justify-end animate-fade-slide">
|
| 517 |
+
<div class="max-w-[80%] bg-orange-600 text-white rounded-2xl rounded-tr-none p-3 shadow-md text-sm">
|
| 518 |
+
${msg.content}
|
| 519 |
+
</div>
|
| 520 |
+
</div>
|
| 521 |
+
`;
|
| 522 |
+
}
|
| 523 |
+
}).join('');
|
| 524 |
+
|
| 525 |
+
// Scroll to bottom
|
| 526 |
+
setTimeout(() => {
|
| 527 |
+
$('chatEnd').scrollIntoView({ behavior: 'smooth' });
|
| 528 |
+
}, 100);
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
// --- Generate Demo Response ---
|
| 532 |
+
function generateDemoResponse(targetTime, name) {
|
| 533 |
+
const isOdd = Math.random() > 0.5;
|
| 534 |
+
const luckIndex = Math.floor(Math.random() * 40) + 55; // 55-95%
|
| 535 |
+
const directions = ['ทิศตะวันออก', 'ทิศเหนือ', 'ทิศใต้', 'ทิศตะวันตก'];
|
| 536 |
+
const colors = ['สีแดง', 'สีทอง', 'สีเขียว', 'สีขาว'];
|
| 537 |
+
const dir = directions[Math.floor(Math.random() * directions.length)];
|
| 538 |
+
const color = colors[Math.floor(Math.random() * colors.length)];
|
| 539 |
+
|
| 540 |
+
if (state.lang === 'th') {
|
| 541 |
+
return `**เวลา**: ${targetTime}
|
| 542 |
+
|
| 543 |
+
**ดัชนีโชค**: ${luckIndex}%
|
| 544 |
+
|
| 545 |
+
**ฟันธง**: ${isOdd ? '🔴 คี่ (RED)' : '🔵 คู่ (BLUE)'}
|
| 546 |
+
|
| 547 |
+
**เคล็ดลับ**: ควรนั่ง${dir} สวมเสื้อ${color}เสริมดวง
|
| 548 |
+
|
| 549 |
+
⚠️ *นี่คือโหมดทดสอบ - ผลลัพธ์สุ่มเพื่อทดสอบ UI*`;
|
| 550 |
+
} else if (state.lang === 'en') {
|
| 551 |
+
return `**Time**: ${targetTime}
|
| 552 |
+
|
| 553 |
+
**Luck Index**: ${luckIndex}%
|
| 554 |
+
|
| 555 |
+
**Prediction**: ${isOdd ? '🔴 ODD (RED)' : '🔵 EVEN (BLUE)'}
|
| 556 |
+
|
| 557 |
+
**Tip**: Face East, wear golden colors
|
| 558 |
+
|
| 559 |
+
⚠️ *Demo Mode - Random result for UI testing*`;
|
| 560 |
+
} else {
|
| 561 |
+
return `**下注時間**: ${targetTime}
|
| 562 |
+
|
| 563 |
+
**偏財指數**: ${luckIndex}%
|
| 564 |
+
|
| 565 |
+
**建議選擇**: ${isOdd ? '🔴 單 (RED)' : '🔵 雙 (BLUE)'}
|
| 566 |
+
|
| 567 |
+
**簡短建議**: 面向東方,穿戴金色
|
| 568 |
+
|
| 569 |
+
⚠️ *測試模式 - 隨機結果*`;
|
| 570 |
+
}
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
// --- API Call ---
|
| 574 |
+
async function startAnalysis(isNewRound = false) {
|
| 575 |
+
const t = TRANSLATIONS[state.lang];
|
| 576 |
+
const apiKey = $('apiKeyInput').value;
|
| 577 |
+
const demoMode = $('demoModeToggle').checked;
|
| 578 |
+
const name = $('nameInput').value;
|
| 579 |
+
const birthDate = $('birthDateInput').value;
|
| 580 |
+
const birthTime = $('birthTimeInput').value;
|
| 581 |
+
const birthCity = $('birthCityInput').value;
|
| 582 |
+
const targetDate = isNewRound ? $('nextDateInput').value : $('targetDateInput').value;
|
| 583 |
+
const targetTime = isNewRound ? $('nextTimeInput').value : $('targetTimeInput').value;
|
| 584 |
+
|
| 585 |
+
if (!demoMode && !apiKey) return alert(t.errorApiKey);
|
| 586 |
+
if (!name || !birthDate) return alert(t.errorInfo);
|
| 587 |
+
|
| 588 |
+
// Switch to chat view
|
| 589 |
+
state.step = 'chatting';
|
| 590 |
+
$('inputStep').classList.add('hidden');
|
| 591 |
+
$('chatStep').classList.remove('hidden');
|
| 592 |
+
$('resetBtn').classList.remove('hidden');
|
| 593 |
+
$('bottomBar').classList.add('hidden');
|
| 594 |
+
|
| 595 |
+
state.loading = true;
|
| 596 |
+
$('loadingIndicator').classList.remove('hidden');
|
| 597 |
+
$('loadingIndicator').classList.add('flex');
|
| 598 |
+
|
| 599 |
+
// Add greeting or user message
|
| 600 |
+
if (!isNewRound && state.chatHistory.length === 0) {
|
| 601 |
+
state.chatHistory.push({
|
| 602 |
+
role: 'assistant',
|
| 603 |
+
content: t.initialGreeting(name)
|
| 604 |
+
});
|
| 605 |
+
} else {
|
| 606 |
+
state.chatHistory.push({
|
| 607 |
+
role: 'user',
|
| 608 |
+
content: `${t.targetQuestionLabel}: ${targetTime}`
|
| 609 |
+
});
|
| 610 |
+
}
|
| 611 |
+
renderChat();
|
| 612 |
+
|
| 613 |
+
// Sync date inputs
|
| 614 |
+
$('nextDateInput').value = targetDate;
|
| 615 |
+
$('nextTimeInput').value = targetTime;
|
| 616 |
+
|
| 617 |
+
const userPrompt = `
|
| 618 |
+
[Target Request]
|
| 619 |
+
Analyze luck for Shrimp Game.
|
| 620 |
+
Target Date: ${targetDate}
|
| 621 |
+
Target Time: ${targetTime}
|
| 622 |
+
|
| 623 |
+
[User Info]
|
| 624 |
+
Name: ${name}
|
| 625 |
+
Gender: ${state.gender}
|
| 626 |
+
Birth: ${birthDate} ${birthTime} @ ${birthCity}
|
| 627 |
+
`;
|
| 628 |
+
|
| 629 |
+
const systemPrompt = $('systemPromptInput').value;
|
| 630 |
+
|
| 631 |
+
// Demo Mode - use mock response
|
| 632 |
+
if (demoMode) {
|
| 633 |
+
await new Promise(resolve => setTimeout(resolve, 1500)); // Simulate delay
|
| 634 |
+
const demoResponse = generateDemoResponse(targetTime, name);
|
| 635 |
+
state.chatHistory.push({ role: 'assistant', content: demoResponse });
|
| 636 |
+
state.loading = false;
|
| 637 |
+
$('loadingIndicator').classList.add('hidden');
|
| 638 |
+
$('loadingIndicator').classList.remove('flex');
|
| 639 |
+
$('bottomBar').classList.remove('hidden');
|
| 640 |
+
renderChat();
|
| 641 |
+
return;
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
try {
|
| 645 |
+
const controller = new AbortController();
|
| 646 |
+
const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout
|
| 647 |
+
|
| 648 |
+
const response = await fetch('https://api.deepseek.com/chat/completions', {
|
| 649 |
+
method: 'POST',
|
| 650 |
+
headers: {
|
| 651 |
+
'Content-Type': 'application/json',
|
| 652 |
+
'Authorization': `Bearer ${apiKey}`
|
| 653 |
+
},
|
| 654 |
+
body: JSON.stringify({
|
| 655 |
+
model: "deepseek-chat",
|
| 656 |
+
messages: [
|
| 657 |
+
{ role: "system", content: systemPrompt },
|
| 658 |
+
{ role: "user", content: userPrompt }
|
| 659 |
+
],
|
| 660 |
+
temperature: 1.3,
|
| 661 |
+
stream: false
|
| 662 |
+
}),
|
| 663 |
+
signal: controller.signal
|
| 664 |
+
});
|
| 665 |
+
|
| 666 |
+
clearTimeout(timeoutId);
|
| 667 |
+
|
| 668 |
+
if (!response.ok) {
|
| 669 |
+
const errorData = await response.json().catch(() => ({}));
|
| 670 |
+
throw new Error(errorData.error?.message || `HTTP ${response.status}: ${response.statusText}`);
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
const data = await response.json();
|
| 674 |
+
if (data.error) throw new Error(data.error.message);
|
| 675 |
+
|
| 676 |
+
const aiResponse = data.choices[0].message.content;
|
| 677 |
+
state.chatHistory.push({ role: 'assistant', content: aiResponse });
|
| 678 |
+
|
| 679 |
+
} catch (error) {
|
| 680 |
+
let errorMsg = error.message;
|
| 681 |
+
if (error.name === 'AbortError') {
|
| 682 |
+
errorMsg = state.lang === 'th' ? 'หมดเวลาเชื่อมต่อ กรุณาลองใหม่' : 'Connection timeout. Please try again.';
|
| 683 |
+
} else if (error.message === 'Failed to fetch' || error.message.includes('load failed')) {
|
| 684 |
+
errorMsg = state.lang === 'th'
|
| 685 |
+
? '❌ ไม่สามารถเชื่อมต่อ API ได้\n\nสาเหตุที่เป็นไปได้:\n1. API Key ไม่ถูกต้อง\n2. ปัญหาการเชื่อมต่ออินเทอร์เน็ต\n3. DeepSeek API อาจมีปัญหาชั่วคราว\n\n💡 ลองตรวจสอบ API Key หรือลองใหม่อีกครั้ง'
|
| 686 |
+
: '❌ Cannot connect to API\n\nPossible causes:\n1. Invalid API Key\n2. Network connection issue\n3. DeepSeek API temporary issue\n\n💡 Please check your API Key or try again.';
|
| 687 |
+
}
|
| 688 |
+
state.chatHistory.push({ role: 'assistant', content: errorMsg });
|
| 689 |
+
} finally {
|
| 690 |
+
state.loading = false;
|
| 691 |
+
$('loadingIndicator').classList.add('hidden');
|
| 692 |
+
$('loadingIndicator').classList.remove('flex');
|
| 693 |
+
$('bottomBar').classList.remove('hidden');
|
| 694 |
+
renderChat();
|
| 695 |
+
}
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
// --- Reset App ---
|
| 699 |
+
function resetApp() {
|
| 700 |
+
state.step = 'input';
|
| 701 |
+
state.chatHistory = [];
|
| 702 |
+
$('inputStep').classList.remove('hidden');
|
| 703 |
+
$('chatStep').classList.add('hidden');
|
| 704 |
+
$('resetBtn').classList.add('hidden');
|
| 705 |
+
$('bottomBar').classList.add('hidden');
|
| 706 |
+
$('chatMessages').innerHTML = '';
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
// --- Event Listeners ---
|
| 710 |
+
$('langBtn').addEventListener('click', () => {
|
| 711 |
+
const langs = ['th', 'en', 'zh-TW'];
|
| 712 |
+
const idx = langs.indexOf(state.lang);
|
| 713 |
+
state.lang = langs[(idx + 1) % langs.length];
|
| 714 |
+
updateLanguage();
|
| 715 |
+
});
|
| 716 |
+
|
| 717 |
+
$('maleBtn').addEventListener('click', () => {
|
| 718 |
+
state.gender = 'male';
|
| 719 |
+
$('maleBtn').className = 'flex-1 rounded-md text-xs bg-blue-600 text-white transition-colors';
|
| 720 |
+
$('femaleBtn').className = 'flex-1 rounded-md text-xs text-slate-500 transition-colors';
|
| 721 |
+
});
|
| 722 |
+
|
| 723 |
+
$('femaleBtn').addEventListener('click', () => {
|
| 724 |
+
state.gender = 'female';
|
| 725 |
+
$('femaleBtn').className = 'flex-1 rounded-md text-xs bg-pink-600 text-white transition-colors';
|
| 726 |
+
$('maleBtn').className = 'flex-1 rounded-md text-xs text-slate-500 transition-colors';
|
| 727 |
+
});
|
| 728 |
+
|
| 729 |
+
$('advancedToggle').addEventListener('click', () => {
|
| 730 |
+
const panel = $('advancedPanel');
|
| 731 |
+
const chevron = $('advancedChevron');
|
| 732 |
+
panel.classList.toggle('hidden');
|
| 733 |
+
chevron.style.transform = panel.classList.contains('hidden') ? 'rotate(0deg)' : 'rotate(180deg)';
|
| 734 |
+
});
|
| 735 |
+
|
| 736 |
+
$('restoreDefaultBtn').addEventListener('click', () => {
|
| 737 |
+
$('systemPromptInput').value = SYSTEM_PROMPTS[state.lang];
|
| 738 |
+
});
|
| 739 |
+
|
| 740 |
+
$('startBtn').addEventListener('click', () => startAnalysis(false));
|
| 741 |
+
$('predictNextBtn').addEventListener('click', () => startAnalysis(true));
|
| 742 |
+
$('resetBtn').addEventListener('click', resetApp);
|
| 743 |
+
|
| 744 |
+
// Initialize
|
| 745 |
+
updateLanguage();
|
| 746 |
+
</script>
|
| 747 |
+
</body>
|
| 748 |
+
</html>
|