PageSourceSearch

https://bbcc.ai/build/assets/chardivination-DVGTeJn5.js

js bbcc.ai collected 2026-10-05 12:13:14 UTC 18,070 bytes, 17 lines download raw bytes

1import{r as u,j as e}from"./app-DP13319Q.js";/* empty css            */const z=[{id:"finance",label:"💰 今日財運",value:"今日財運"},{id:"travel",label:"🗺️ 出行計畫",value:"出行計畫"},{id:"career",label:"🏢 職場適應",value:"職場適應"},{id:"family",label:"🏡 家庭和諧",value:"家庭和諧"},{id:"direction",label:"🌟 努力方向",value:"努力方向"}],P=[{id:"openai",label:"OpenAI",icon:"💠"},{id:"deepseek",label:"DeepSeek",icon:"🌀"},{id:"gemini",label:"Gemini 3 Flash",icon:"⭐"},{id:"perplexity",label:"Perplexity",icon:"🌊"}],A={openai:{input:.15,output:.6,label:"GPT-4o mini · $0.15/$0.60 per 1M"},deepseek:{input:.14,output:.28,label:"DeepSeek Chat · $0.14/$0.28 per 1M"},gemini:{input:.075,output:.3,label:"Gemini 3 Flash Preview · $0.075/$0.30 per 1M"},perplexity:{input:1,output:5,label:"Sonar Pro · $1/$5 per 1M"}},k={openai:"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",deepseek:"sk-afe92e6a35f044df91c343fd8598147d",gemini:"AIzaSyDo9uPn9NdXq3xVkTS7IAgIiVwPDVESYt0",perplexity:"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"},w=r=>r===0?"$0.00000":r<1e-6?"$"+r.toExponential(4):r<1e-4?"$"+r.toFixed(7):r<.01?"$"+r.toFixed(6):"$"+r.toFixed(5),v=(r,o)=>`你是一位精通中國漢字拆字占卜的智慧占卜師,融合傳統拆字術、字形學與五行哲學。
2今日日期:${new Date().toLocaleDateString("zh-TW",{year:"numeric",month:"long",day:"numeric",weekday:"long"})}
3占問主題:${o}
4用戶輸入的字:${r}
5
6請以繁體中文回答,只回傳以下JSON格式,不含任何JSON以外的文字或markdown:
7{
8  "analysis": "對「${r}」拆字解析,分析部首、筆畫、字形結構及字義,約100字",
9  "luck": "針對「${o}」主題,給出正面指引與吉象,約80字",
10  "caution": "針對「${o}」主題,給出需留意或避免的事項,約80字",
11  "tip": "一句精簡有力的今日錦言,30字以內"
12}`,O=r=>{let o=r.replace(/```json\s*/gi,"").replace(/```\s*/g,"").trim();if(!o.startsWith("{")){const n=o.indexOf("{");n!==-1&&(o=o.substring(n))}if(!o.endsWith("}")){const n=o.lastIndexOf("}");n!==-1&&(o=o.substring(0,n+1))}try{return JSON.parse(o)}catch{const c=o.replace(new RegExp('(?<=: ")(.*?)(?=",|"})',"gs"),i=>i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r"));try{return JSON.parse(c)}catch{const s=a=>{const l=new RegExp(`"${a}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`,"s"),p=o.match(l);
12return p?p[1].replace(/\\n/g,`
13`).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):""};return{analysis:s("analysis")||"字形解析無法取得,請重新占卜。",luck:s("luck")||"暫無指引。",caution:s("caution")||"請留意內在平衡。",tip:s("tip")||"靜心觀照。"}}}},B=async(r,o)=>{var a;const n=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${k.openai}`},body:JSON.stringify({model:"gpt-4o-mini",messages:[{role:"user",content:v(r,o)}],response_format:{type:"json_object"},temperature:.8,max_tokens:800})});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(((a=l==null?void 0:l.error)==null?void 0:a.message)||`OpenAI HTTP ${n.status}`)}const c=await n.json(),i=JSON.parse(c.choices[0].message.content),s=c.usage||{prompt_tokens:80,completion_tokens:200};return{analysis:i.analysis,luck:i.luck,caution:i.caution,tip:i.tip,inp:s.prompt_tokens,out:s.completion_tokens}},W=async(r,o)=>{var a;const n=await fetch("https://api.deepseek.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${k.deepseek}`},body:JSON.stringify({model:"deepseek-chat",messages:[{role:"user",content:v(r,o)}],response_format:{type:"json_object"},temperature:.8,max_tokens:800})});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(((a=l==null?void 0:l.error)==null?void 0:a.message)||`DeepSeek HTTP ${n.status}`)}const c=await n.json(),i=JSON.parse(c.choices[0].message.content),s=c.usage||{prompt_tokens:80,completion_tokens:200};return{analysis:i.analysis,luck:i.luck,caution:i.caution,tip:i.tip,inp:s.prompt_tokens,out:s.completion_tokens}},E=async(r,o)=>{var p,m,g,x,b,f;const n=`https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent?key=${k.gemini}`,c=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{parts:[{text:v(r,o)}]}],generationConfig:{temperature:.7,maxOutputTokens:1e3,responseMimeType:"application/json"}})});if(!c.ok){let h=`Gemini API HTTP ${c.status}`;try{h=((p=(await c.json()).error)==null?void 0:p.message)||h}catch{}throw new Error(`Gemini 錯誤: ${h}`)}const i=await c.json(),s=((f=(b=(x=(g=(m=i.candidates)==null?void 0:m[0])==null?void 0:g.content)==null?void 0:x.parts)==null?void 0:b[0])==null?void 0:f.text)||"";if(!s)throw new Error("Gemini 未回覆有效內容");const a=O(s),l=i.usageMetadata||{};return{analysis:a.analysis||`「${r}」字形蘊含深厚底蘊,待你靜心感悟。`,luck:a.luck||"順勢而為,心誠則靈。",caution:a.caution||"避免急躁,傾聽內在聲音。",tip:a.tip||"一念之間,萬般自在。",inp:l.promptTokenCount??150,out:l.candidatesTokenCount??280}},I=async(r,o)=>{var p;const n=await fetch("https://api.perplexity.ai/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${k.perplexity}`},body:JSON.stringify({model:"sonar-pro",messages:[{role:"user",content:v(r,o)+" 只回傳JSON,不含任何其他文字。"}],max_tokens:800,temperature:.7})});if(!n.ok){const m=await n.json().catch(()=>({}));throw new Error(((p=m==null?void 0:m.error)==null?void 0:p.message)||`Perplexity HTTP ${n.status}`)}const c=await n.json(),s=c.choices[0].message.content.match(/\{[\s\S]*\}/);if(!s)throw new Error("Perplexity JSON 解析失敗");const a=JSON.parse(s[0]),l=c.usage||{prompt_tokens:80,completion_tokens:200};return{analysis:a.analysis,luck:a.luck,caution:a.caution,tip:a.tip,inp:l.prompt_tokens,out:l.completion_tokens}};function _(){const[r,o]=u.useState(""),[n,c]=u.useState(z[0].value),[i,s]=u.useState("openai"),[a,l]=u.useState(!1),[p,m]=u.useState(null),[g,x]=u.useState(null),[b,f]=u.useState(null),h=(t,d,y)=>{const S=A[t],T=d/1e6*S.input,C=y/1e6*S.output;return{inputTokens:d,outputTokens:y,inputCost:T,outputCost:C,totalCost:T+C}},j=async()=>{if(!r.trim()){f("請先輸入一個中文字");return}if(!/[\u4e00-\u9fff]/.test(r)){f("請輸入一個有效的中文漢字");return}l(!0),f(null),m(null),x(null);try{let t;switch(i){case"openai":t=await B(r,n);break;case"deepseek":t=await W(r,n);break;case"gemini":t=await E(r,n);break;case"perplexity":t=await I(r,n);break;default:throw new Error("未知的 AI 引擎")}m(t),x(h(i,t.inp,t.out))}catch(t){console.error("占卜錯誤:",t),f(t instanceof Error?t.message:"連線異常,請稍後再試")}finally{l(!1)}},R=t=>{t.key==="Enter"&&j()},$=t=>{const y=t.target.value.split("").filter(S=>/[\u4e00-\u9fff]/.test(S));y.length>0?o(y[0]):o("")};return e.jsxs("div",{style:{minHeight:"100vh",background:"radial-gradient(circle at 15% 20%, #0d0718, #02010c 70%)",fontFamily:"'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif",padding:"1.5rem"},children:[e.jsxs("div",{style:{maxWidth:880,width:"100%",margin:"0 auto",background:"rgba(12, 9, 28, 0.88)",backdropFilter:"blur(16px)",borderRadius:"2.5rem",border:"1px solid rgba(200, 160, 255, 0.4)",padding:"2rem 1.8rem",boxShadow:"0 25px 50px -10px #000"},children:[e.jsx("h1",{style:{fontSize:"2rem",textAlign:"center",letterSpacing:"4px",background:"linear-gradient(120deg, #f5eaff, #d4aaff, #b47eff)",WebkitBackgroun
13dClip:"text",backgroundClip:"text",color:"transparent"},children:"🔮 拆字占卜"}),e.jsx("div",{style:{textAlign:"center",color:"#bbaee6",fontSize:"0.78rem",margin:"0.4rem 0 1.6rem",letterSpacing:"2px"},children:"以字問天・以形解命・多元AI智慧解讀"}),e.jsx("div",{style:{textAlign:"center",fontSize:"0.7rem",letterSpacing:"2px",color:"#a092d8",marginBottom:"0.8rem"},children:"✦ 選擇占問主題 ✦"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",justifyContent:"center",marginBottom:"1.4rem"},children:z.map(t=>e.jsxs("button",{onClick:()=>c(t.value),style:{width:108,height:96,borderRadius:"1.2rem",border:n===t.value?"1.5px solid #c49eff":"1.5px solid #5a48a0",background:n===t.value?"linear-gradient(145deg, #4a35a0, #7555ea)":"linear-gradient(145deg, #1a1538, #0e0c24)",color:n===t.value?"#fff":"#cdbcff",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s",fontFamily:"inherit",boxShadow:n===t.value?"0 0 20px rgba(180, 126, 255, 0.6)":"none"},onMouseEnter:d=>{n!==t.value&&(d.currentTarget.style.transform="translateY(-4px) scale(1.04)",d.currentTarget.style.boxShadow="0 8px 20px rgba(160, 100, 255, 0.35)")},onMouseLeave:d=>{d.currentTarget.style.transform="none",n!==t.value&&(d.currentTarget.style.boxShadow="none")},children:[e.jsx("div",{style:{fontSize:"1.5rem",marginBottom:"4px"},children:t.label.split(" ")[0]}),e.jsx("div",{style:{fontSize:"0.82rem",fontWeight:700,letterSpacing:"2px"},children:t.label.split(" ")[1]})]},t.id))}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"1.2rem",color:"#6a5898",fontSize:"0.8rem"},children:[e.jsx("div",{style:{flex:1,height:"1px",background:"rgba(100, 80, 160, 0.4)"}}),e.jsx("span",{children:"— 輸入你心中浮現的一個中文字 —"}),e.jsx("div",{style:{flex:1,height:"1px",background:"rgba(100, 80, 160, 0.4)"}})]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"1.2rem"},children:[e.jsx("input",{type:"text",value:r,onChange:$,onKeyPress:R,placeholder:"字",maxLength:1,style:{flex:2,padding:"0.9rem 1.2rem",borderRadius:"60px",border:r?"1.5px solid #c49eff":"1px solid #6a4fbf",background:"#0e0c24",color:"#fff",fontSize:"1.8rem",textAlign:"center",fontFamily:"inherit",outline:"none",letterSpacing:"6px",transition:"all 0.2s",boxShadow:r?"0 0 14px rgba(180, 126, 255, 0.4)":"none"}}),e.jsx("button",{onClick:j,disabled:a||!r,style:{background:"linear-gradient(95deg, #755aea, #a47eff)",border:"none",padding:"0 1.6rem",borderRadius:"60px",fontWeight:700,color:"#fff",cursor:a||!r?"not-allowed":"pointer",fontSize:"1rem",fontFamily:"inherit",transition:"transform 0.1s, opacity 0.2s",letterSpacing:"2px",opacity:a||!r?.5:1},children:"✨ 開始占卜"})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",marginBottom:"1.5rem",justifyContent:"center"},children:P.map(t=>e.jsxs("button",{onClick:()=>s(t.id),style:{background:i===t.id?"linear-gradient(95deg, #755aea, #a47eff)":"#1a1538",border:i===t.id?"1px solid #c49eff":"1px solid #5a48a0",padding:"0.45rem 1rem",borderRadius:"40px",color:i===t.id?"#fff":"#cdbcff",cursor:"pointer",fontWeight:600,fontSize:"0.83rem",transition:"0.2s",fontFamily:"inherit",boxShadow:i===t.id?"0 0 8px #a47eff":"none"},onMouseEnter:d=>{i!==t.id&&(d.currentTarget.style.background="#3a2e6e",d.currentTarget.style.transform="scale(0.97)")},onMouseLeave:d=>{i!==t.id&&(d.currentTarget.style.background="#1a1538",d.currentTarget.style.transform="none")},children:[t.icon," ",t.label]},t.id))}),a&&e.jsxs("div",{style:{background:"rgba(0, 0, 0, 0.45)",borderRadius:"1.5rem",padding:"2rem",textAlign:"center"},children:[e.jsx("div",{style:{display:"inline-block",width:"40px",height:"40px",border:"3px solid rgba(180, 140, 255, 0.3)",borderTopColor:"#b47eff",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsxs("p",{style:{color:"#bbaee6",marginTop:"1rem"},children:["🔮 正在解析「",r,"」的字形結構..."]}),e.jsx("p",{style:{color:"#8a6ebb",fontSize:"0.85rem",marginTop:"0.5rem"}
13,children:i==="gemini"?"✨ Gemini 正在閱讀字中玄機…":i==="perplexity"?"🌊 Perplexity 正在解讀天地之間的訊息…":i==="deepseek"?"🌀 DeepSeek 正在洞悉字形奧秘…":"💠 OpenAI 正在分析字形結構…"})]}),b&&e.jsxs("div",{style:{background:"rgba(255, 107, 107, 0.15)",border:"1px solid #ff6b6b",borderRadius:"1rem",padding:"1rem",color:"#ff8a8a",fontSize:"0.85rem",marginBottom:"1rem"},children:[e.jsx("strong",{children:"⚠️ 錯誤:"})," ",b]}),p&&!a&&e.jsxs("div",{style:{background:"rgba(0, 0, 0, 0.45)",borderRadius:"1.5rem",marginTop:"1.5rem",padding:"1.2rem",borderLeft:"6px solid #b87eff"},children:[e.jsxs("div",{style:{borderRadius:"1.2rem",padding:"0.9rem 1rem",marginBottom:"0.8rem",background:"rgba(180, 126, 255, 0.1)"},children:[e.jsx("div",{style:{fontSize:"0.68rem",textTransform:"uppercase",letterSpacing:"2px",fontWeight:700,color:"#ddccff",marginBottom:"6px"},children:"📖 字形解析"}),e.jsxs("div",{style:{color:"#f5edff",lineHeight:1.65,fontSize:"0.92rem"},children:[e.jsxs("strong",{children:["「",r,"」字形解析"]}),e.jsx("br",{}),p.analysis]})]}),e.jsxs("div",{style:{borderRadius:"1.2rem",padding:"0.9rem 1rem",marginBottom:"0.8rem",background:"rgba(100, 200, 130, 0.08)"},children:[e.jsx("div",{style:{fontSize:"0.68rem",textTransform:"uppercase",letterSpacing:"2px",fontWeight:700,color:"#ddccff",marginBottom:"6px"},children:"✨ 吉象指引"}),e.jsx("div",{style:{color:"#f5edff",lineHeight:1.65,fontSize:"0.92rem"},children:p.luck})]}),e.jsxs("div",{style:{borderRadius:"1.2rem",padding:"0.9rem 1rem",marginBottom:"0.8rem",background:"rgba(255, 110, 110, 0.1)"},children:[e.jsx("div",{style:{fontSize:"0.68rem",textTransform:"uppercase",letterSpacing:"2px",fontWeight:700,color:"#ddccff",marginBottom:"6px"},children:"⚠️ 留意事項"}),e.jsx("div",{style:{color:"#f5edff",lineHeight:1.65,fontSize:"0.92rem"},children:p.caution})]}),e.jsxs("div",{style:{borderRadius:"1.2rem",padding:"0.9rem 1rem",marginBottom:"0.8rem",background:"rgba(210, 180, 255, 0.08)",fontStyle:"italic"},children:[e.jsx("div",{style:{fontSize:"0.68rem",textTransform:"uppercase",letterSpacing:"2px",fontWeight:700,color:"#ddccff",marginBottom:"6px"},children:"💫 今日錦言"}),e.jsxs("div",{style:{color:"#f5edff",lineHeight:1.65,fontSize:"0.92rem"},children:["💫 ",p.tip]})]}),g&&e.jsxs("div",{style:{background:"rgba(0, 0, 0, 0.65)",borderRadius:"1rem",padding:"1rem",marginTop:"1rem",border:"1px solid rgba(120, 80, 200, 0.4)",fontFamily:"'SF Mono', 'Fira Code', monospace"},children:[e.jsx("div",{style:{fontSize:"0.72rem",letterSpacing:"1px",color:"#cbbaff",marginBottom:"0.75rem",borderLeft:"3px solid #b87eff",paddingLeft:"8px"},children:"💰 詞元耗用與費用明細(即時 API 回傳)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(155px, 1fr))",gap:"0.6rem"},children:[e.jsxs("div",{style:{background:"rgba(30, 20, 55, 0.6)",padding:"0.5rem 0.7rem",borderRadius:"0.8rem",display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.78rem"},children:[e.jsx("span",{style:{color:"#b7a5f0",fontWeight:500},children:"📥 輸入詞元"}),e.jsx("span",{style:{color:"#e2d9ff",fontWeight:600},children:g.inputTokens.toLocaleString()})]}),e.jsxs("div",{style:{background:"rgba(30, 20, 55, 0.6)",padding:"0.5rem 0.7rem",borderRadius:"0.8rem",display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.78rem"},children:[e.jsx("span",{style:{color:"#b7a5f0",fontWeight:500},children:"📤 輸出詞元"}),e.jsx("span",{style:{color:"#e2d9ff",fontWeight:600},children:g.outputTokens.toLocaleString()})]}),e.jsxs("div",{style:{background:"rgba(30, 20, 55, 0.6)",padding:"0.5rem 0.7rem",borderRadius:"0.8rem",display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.78rem"},children:[e.jsx("span",{style:{color:"#b7a5f0",fontWeight:500},children:"⚡ 輸入費用"}),e.jsx("span",{style:{color:"#e2d9ff",fontWeight:600},children:w(g.inputCost)})]}),e.jsxs("div",{style:{background:"rgba(30, 20, 55, 0.6)",padding:"0.5rem 0.7rem",borderRadius:"0.8rem",display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.78rem"},children:[e.jsx("span",{style:{color:"#b7a5f0",fontWeight:500},children:"✨ 輸出費用"}),e.jsx("span",{style:{color:"#e2d9ff",fontWeight:600},children:w(g.outputCost)})]})]}),e.jsxs("div",{style:{background:"linear-gradient(95deg, #3a2d6e, #2a1f55)",padding:"0.5rem 0.7rem",borderRadius:"0.8rem",marginTop:"6px",borderLeft:"3px solid #ffdf8c",display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.78rem"},children:[e.jsx("span",{style:{color:"#b7a5f0",fontWeight:500},children:"💎 本次總費用 (USD)"}),e.jsx("span",{style:{color:"#e2d9ff",fontWeight:600},children:w(g.totalCost)})]}),e.jsxs("div",{style:{background:"rgba(255, 220, 100, 0.1)",borderRadius:"12px",padding:"5px 12px",fontSize:"0.7rem",textAlign:"center",marginTop:"8px",color:"#ffe1a0"},children:["🤖 AI引擎:",e.jsx("strong",{children:A[i].label})," · 費率依每百萬詞元計算"]})]})]}),e.jsx("hr",{style:{margin:"1rem 0",borderColor:"#2a2350"}}),e.jsxs("div",{style:{marginTop:"1.8rem",padding:"1rem 1.2rem",background:"rgba(255, 200, 80, 0.07)",border:"1px solid rgba(255, 200, 80, 0.25)",borderRadius:"1rem",fontSize:"0.72rem",color:"#c8b880",lineHeight:1.8,textAlign:"center",letterSpacing:"0.5px"},children:[e.jsx("strong",{children:"⚠️ 娛樂性質聲明"}),e.jsx("br",{}),"本占卜工具純屬娛樂參考,所有解讀均由人工智慧依據漢字結構與文化意涵生成,",e.jsx("br",{}),e.jsx("strong",{children:"不構成任何財務、醫療、法律或人生決策之建議。"}),e.jsx("br",{}
13),"請以理性判斷為主,切勿因占卜結果影響重大決定。如有心理困擾,請尋求專業協助。"]}),e.jsx("div",{style:{textAlign:"center",fontSize:"0.68rem",color:"#6a5898",marginTop:"0.8rem",letterSpacing:"1px"},children:"✦ 拆字問天 · 字字有緣 · 僅供娛樂 ✦"})]}),e.jsx("style",{children:`
14        @keyframes spin {
15          to { transform: rotate(360deg); }
16        }
17      `})]})}export{_ as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.