jackyanghxc commited on
Commit
c6a890c
·
verified ·
1 Parent(s): d74b750

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +19 -18
index.html CHANGED
@@ -4,7 +4,7 @@
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
 
@@ -103,12 +103,12 @@
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. ใส่คีย์สมอง (GPT-5-Nano 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"/>
@@ -289,8 +289,8 @@
289
  subtitle: "AI ทำนายผล คู่/คี่",
290
  reset: "ล้างข้อมูล",
291
  introTitle: "ระบบคำนวณดวงเกมตกกุ้ง",
292
- introText: "ระบบ AI ผสานศาสตร์ปาจื้อและจื่อเวยฯ วิเคราะห์เกมชั่งน้ำหนักกุ้งลาดพร้าว คำนวณดัชนีโชคลาภและฟันธง 'คู่' หรือ 'คี่' ตามเวลาจริง",
293
- apiKeyLabel: "1. ใส่คีย์สมอง (GPT-5-Nano API)",
294
  apiKeyPlaceholder: "sk-...",
295
  apiKeyNote: "*คีย์ใช้ส่งข้อมูลหา AI เท่านั้น ไม่มีการบันทึก",
296
  userInfoLabel: "2. ข้อมูลเจ้าชะตา (กรอกครั้งเดียว)",
@@ -320,11 +320,11 @@
320
  },
321
  'zh-TW': {
322
  title: "曼谷運勢智囊",
323
- subtitle: "GPT-5-Nano AI 驅動 - 釣蝦場單雙預測",
324
  reset: "重置",
325
  introTitle: "命理融合預測系統",
326
- introText: "本系統結合八字與紫微斗數,專門針對曼谷 Ladprao 釣蝦場的秤重遊戲進行分析。AI 將計算您的偏財指數與最佳下注策略(單/雙)。",
327
- apiKeyLabel: "1. API 金鑰",
328
  apiKeyPlaceholder: "sk-...",
329
  apiKeyNote: "*您的 Key 不會被儲存。",
330
  userInfoLabel: "2. 命主資料",
@@ -357,8 +357,8 @@
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. GPT-5-Nano API Key",
362
  apiKeyPlaceholder: "sk-...",
363
  apiKeyNote: "*Key is not stored.",
364
  userInfoLabel: "2. Your Details",
@@ -390,7 +390,7 @@
390
 
391
  // --- System Prompts ---
392
  const SYSTEM_PROMPTS = {
393
- 'th': `คุณคือปรมาจารย์โหราศาสตร์ (ปาจื้อและจื่อเวยโต่วซู่) หน้าที่ของคุณคือวิเคราะห์ดวงโชคลาภสำหรับเกมเสี่ยงโชค
394
 
395
  โปรดปฏิบัติตามตรรกะนี้:
396
 
@@ -407,7 +407,7 @@
407
  3. **ฟันธง**: 🔴 คี่ (RED) หรือ 🔵 คู่ (BLUE) (เลือก 1 อย่างเท่านั้นให้ชัดเจน)
408
  4. **เคล็ดลับสั้นๆ**: ทิศที่ควรนั่ง หรือ สีเสื้อเสริมดวง`,
409
 
410
- 'zh-TW': `你是一位精通「八字」與「紫微斗數」的大師。針對曼谷 Ladprao 釣蝦場秤重遊戲進行單雙預測。
411
 
412
  遊戲規則:晚上8點後,秤9隻蝦,猜尾數單雙。
413
  請根據用戶提供的出生資料與下注時間,計算當下的偏財運。
@@ -418,7 +418,7 @@
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]
@@ -616,7 +616,7 @@ Based on birth data and betting time, calculate the windfall luck.
616
 
617
  const userPrompt = `
618
  [Target Request]
619
- Analyze luck for Shrimp Game.
620
  Target Date: ${targetDate}
621
  Target Time: ${targetTime}
622
 
@@ -645,14 +645,15 @@ Based on birth data and betting time, calculate the windfall luck.
645
  const controller = new AbortController();
646
  const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout
647
 
648
- const response = await fetch('https://api.gpt-5-nano.com/v1/chat/completions', {
 
649
  method: 'POST',
650
  headers: {
651
  'Content-Type': 'application/json',
652
  'Authorization': `Bearer ${apiKey}`
653
  },
654
  body: JSON.stringify({
655
- model: "gpt-5-nano",
656
  messages: [
657
  { role: "system", content: systemPrompt },
658
  { role: "user", content: userPrompt }
@@ -682,8 +683,8 @@ Based on birth data and betting time, calculate the windfall luck.
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. GPT-5-Nano API อาจมีปัญหาชั่วคราว\n\n💡 ลองตรวจสอบ API Key หรือลองใหม่อีกครั้ง'
686
- : '❌ Cannot connect to API\n\nPossible causes:\n1. Invalid API Key\n2. Network connection issue\n3. GPT-5-Nano API temporary issue\n\n💡 Please check your API Key or try again.';
687
  }
688
  state.chatHistory.push({ role: 'assistant', content: errorMsg });
689
  } finally {
 
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.tailwindcss.com"></script>
8
  <style>
9
  @import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600;700&display=swap');
10
 
 
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. ใส่คีย์สมอง (OpenAI 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"/>
 
289
  subtitle: "AI ทำนายผล คู่/คี่",
290
  reset: "ล้างข้อมูล",
291
  introTitle: "ระบบคำนวณดวงเกมตกกุ้ง",
292
+ introText: "ระบบ AI ผสานศาสตร์ปาจื้อและชี่เหมินตุ้นเจี๋ย วิเคราะห์เกมชั่งน้ำหนักกุ้งลาดพร้าว คำนวณดัชนีโชคลาภและฟันธง 'คู่' หรือ 'คี่' ตามเวลาจริง",
293
+ apiKeyLabel: "1. ใส่คีย์สมอง (OpenAI API)",
294
  apiKeyPlaceholder: "sk-...",
295
  apiKeyNote: "*คีย์ใช้ส่งข้อมูลหา AI เท่านั้น ไม่มีการบันทึก",
296
  userInfoLabel: "2. ข้อมูลเจ้าชะตา (กรอกครั้งเดียว)",
 
320
  },
321
  'zh-TW': {
322
  title: "曼谷運勢智囊",
323
+ subtitle: "OpenAI GPT 驅動 - 釣蝦場單雙預測",
324
  reset: "重置",
325
  introTitle: "命理融合預測系統",
326
+ introText: "本系統結合八字與奇門遁甲,專門針對曼谷 Ladprao 釣蝦場的秤重遊戲進行分析。AI 將計算您的偏財指數與最佳下注策略(單/雙)。",
327
+ apiKeyLabel: "1. OpenAI API 金鑰",
328
  apiKeyPlaceholder: "sk-...",
329
  apiKeyNote: "*您的 Key 不會被儲存。",
330
  userInfoLabel: "2. 命主資料",
 
357
  subtitle: "Shrimp Game AI Prediction",
358
  reset: "Reset",
359
  introTitle: "Prediction System",
360
+ introText: "Combines BaZi and QiMen DunJia to analyze the Ladprao Shrimp weighing game. AI calculates Odd/Even strategy based on time.",
361
+ apiKeyLabel: "1. OpenAI API Key",
362
  apiKeyPlaceholder: "sk-...",
363
  apiKeyNote: "*Key is not stored.",
364
  userInfoLabel: "2. Your Details",
 
390
 
391
  // --- System Prompts ---
392
  const SYSTEM_PROMPTS = {
393
+ 'th': `คุณคือปรมาจารย์โหราศาสตร์ (ปาจื้อและชี่เหมินตุ้นเจี๋ย) หน้าที่ของคุณคือวิเคราะห์ดวงโชคลาภสำหรับเกมเสี่ยงโชค
394
 
395
  โปรดปฏิบัติตามตรรกะนี้:
396
 
 
407
  3. **ฟันธง**: 🔴 คี่ (RED) หรือ 🔵 คู่ (BLUE) (เลือก 1 อย่างเท่านั้นให้ชัดเจน)
408
  4. **เคล็ดลับสั้นๆ**: ทิศที่ควรนั่ง หรือ สีเสื้อเสริมดวง`,
409
 
410
+ 'zh-TW': `你是一位精通「八字」與「奇門遁甲」的大師。針對曼谷 Ladprao 釣蝦場秤重遊戲進行單雙預測。
411
 
412
  遊戲規則:晚上8點後,秤9隻蝦,猜尾數單雙。
413
  請根據用戶提供的出生資料與下注時間,計算當下的偏財運。
 
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) using BaZi and QiMen DunJia.
422
  Based on birth data and betting time, calculate the windfall luck.
423
 
424
  [Output Format - Be Concise]
 
616
 
617
  const userPrompt = `
618
  [Target Request]
619
+ Analyze luck for Shrimp Game using QiMen DunJia.
620
  Target Date: ${targetDate}
621
  Target Time: ${targetTime}
622
 
 
645
  const controller = new AbortController();
646
  const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout
647
 
648
+ // CHANGED TO OPENAI OFFICIAL ENDPOINT
649
+ const response = await fetch('https://api.openai.com/v1/chat/completions', {
650
  method: 'POST',
651
  headers: {
652
  'Content-Type': 'application/json',
653
  'Authorization': `Bearer ${apiKey}`
654
  },
655
  body: JSON.stringify({
656
+ model: "gpt-4o-mini", // ✅ Use a real, available OpenAI model
657
  messages: [
658
  { role: "system", content: systemPrompt },
659
  { role: "user", content: userPrompt }
 
683
  errorMsg = state.lang === 'th' ? 'หมดเวลาเชื่อมต่อ กรุณาลองใหม่' : 'Connection timeout. Please try again.';
684
  } else if (error.message === 'Failed to fetch' || error.message.includes('load failed')) {
685
  errorMsg = state.lang === 'th'
686
+ ? '❌ ไม่สามารถเชื่อมต่อ OpenAI API ได้\n\nสาเหตุที่เป็นไปได้:\n1. API Key ไม่ถูกต้องหรือไม่มีสิทธิ์ใช้งาน gpt-4o-mini\n2. ปัญหาการเชื่อมต่ออินเทอร์เน็ต\n3. OpenAI API มีปัญหาชั่วคราว\n\n💡 โปรดตรวจสอบ API Key ที่ https://platform.openai.com หรือใช้โหมดทดสอบแทน'
687
+ : '❌ Cannot connect to OpenAI API\n\nPossible causes:\n1. Invalid/insufficient-permission API Key\n2. Network issue\n3. OpenAI service down\n\n💡 Check your key at https://platform.openai.com หรือใช้โหมดทดสอบแทน';
688
  }
689
  state.chatHistory.push({ role: 'assistant', content: errorMsg });
690
  } finally {