彭大姐 發表於 2025-3-12 08:44:00

TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合

<style>\3c span id="mce_marker" data-mce-type="bookmark">\3c /span>\3c span id="__caret">_\3c /span>\3c !--
#div_digg { float: right; font-size: 12px; margin: 10px; text-align: center; width: 120px; position: fixed; right: 0; bottom: 0; z-index: 10; background-color: rgba(255, 255, 255, 1); padding: 10px; border: 1px solid rgba(204, 204, 204, 1) }
#cnblogs_post_body pre code span { font-family: Consolas, monospace }
#blogTitle>h2 { font-family: Consolas, monospace }
#blog-news { font-family: Consolas, monospace }
#topics .postTitle a { font-family: Georgia, Times New Roman, Times, sans-serif, monospace; font-weight: bold }
#cnblogs_post_body p { margin: 18px auto; color: rgba(0, 0, 0, 1); font-family: Georgia, Times New Roman, Times, sans-serif, monospace; font-size: 16px; text-indent: 0 }
#cnblogs_post_body h1 { font-family: Georgia, Times New Roman, Times, sans-serif, monospace; font-size: 32px; font-weight: bold; line-height: 1.5; margin: 10px 0 }
#cnblogs_post_body h2 { font-family: Consolas, "Microsoft YaHei", monospace; font-size: 26px; font-weight: bold; line-height: 1.5; margin: 20px 0 }
#cnblogs_post_body h3 { font-family: Georgia, Times New Roman, Times, sans-serif, monospace; font-size: 20px; font-weight: bold; line-height: 1.5; margin: 10px 0 }
#cnblogs_post_body h4 { font-family: Georgia, Times New Roman, Times, sans-serif, monospace; font-size: 18px; font-weight: bold; margin: 10px 0 }
em { font-style: normal; color: rgba(0, 0, 0, 1) }
#cnblogs_post_body ul li { font-family: Georgia, Times New Roman, Times, sans-serif, monospace; color: rgba(0, 0, 0, 1); font-size: 16px; list-style-type: disc }
#cnblogs_post_body ol li { font-family: Georgia, Times New Roman, Times, sans-serif, monospace; color: rgba(0, 0, 0, 1); font-size: 16px; list-style-type: decimal }
#cnblogs_post_body a:link { text-decoration: none; color: rgba(0, 44, 153, 1) }
#topics .postBody blockquote { background: rgba(255, 243, 212, 1); border-top: none; border-right: none; border-bottom: none; border-left: 5px solid rgba(246, 183, 60, 1); margin: 0; padding-left: 10px }
.cnblogs-markdown code { font-family: Consolas, "Microsoft YaHei", monospace !important; font-size: 16px !important; line-height: 1.8; background-color: rgba(245, 245, 245, 1) !important; border: none !important; padding: 0 5px !important; border-radius: 3px !important; margin: 1px 5px; vertical-align: middle; display: inline-block }
.cnblogs-markdown .hljs { font-family: Consolas, "Microsoft YaHei", monospace !important; font-size: 16px !important; line-height: 1.5 !important; padding: 5px !important }
#cnblogs_post_body h1 code, #cnblogs_post_body h2 code { font-size: inherit !important; border: none !important }</style>
<h2>引言</h2>
<p>各位看官,您是否想过,当老祖宗的算命绝学遇上21世纪的AI黑科技,会擦出怎样的火花? 随着国产大模型 DeepSeek 的横空出世,咱这算命的行当也得跟上时代的步伐不是? 过去,算命先生掐指一算,全凭一张嘴和多年闯荡江湖的经验。如今,有了AI加持,咱这算命也能玩出新花样! 本项目的终极目标,就是让老祖宗的智慧结晶与现代科技完美融合,打造一个既有文化底蕴,又充满科技感的算命网站。</p>
<h2>项目概述</h2>
<h3>核心特点</h3>
<ul>
<li>🔮 集八字、六爻、塔罗等多种传统算命方式于一体</li>
<li>🧠 集成DeepSeek AI模型进行智能解读</li>
<li>🌐 现代化UI设计与响应式布局</li>
<li>🚀 基于TypeScript的强类型开发体验</li>
</ul>
<h3>体验部署</h3>
<p><img src="https://img2024.cnblogs.com/blog/809672/202503/809672-20250311145113193-1945370124.avif"></p>
<p>本地部署:Github地址&nbsp;欢迎Star</p>
<p>限时线上体验:https://bugua.anhejin.cn:88</p>
<h2>技术实现</h2>
<h3>计算年/月/日/时柱(天干地支)</h3>
<p>通过引入 <code>lunar-typescript</code> 库,我们能够轻松将普通日期转化为蕴含东方智慧的四柱命盘:</p>
<pre><code class="language-typescript">function calculateFourPillars(dateTime: string | Date): FourPillars {
const date = new Date(dateTime);
const lunar = Lunar.fromDate(date);

const year = lunar.getYearInGanZhi();
const month = lunar.getMonthInGanZhi();
const day = lunar.getDayInGanZhi();
const hour = lunar.getTimeInGanZhi();

return {
    year,
    month,
    day,
    hour,
};
}
</code></pre>
<h3>DeepSeek 核心提示词/内容</h3>
<p>精心设计了系统提示词,让 DeepSeek 化身为一位博学多识的命理大师:</p>
<pre><code class="language-text">你是一位经验丰富的算命师,精通八字、紫微斗数、阴阳五行学说、天干地支、八卦、历法、命理学基础等传统命理学说。</code></pre>
<pre><em id="__mceDel"><code class="language-typescript">const prompt = `作为一位精通易学、命理的专业算命师,请根据以下信息为求测者${name}进行全面周详的命运分析:

【基本信息】
姓名:${name}
性别:${gender}
${birthplace ? `出生地:${birthplace}` : ''}
今日阳历:${new Date().toLocaleDateString()}
出生阳历:${date}
出生农历:${`${lunar.getYearInChinese()}年 ${lunar.getMonthInChinese()}月 ${lunar.getDayInChinese()}`}
出生时辰:${getChineseHour(newDate)}
当前年龄:${age}岁<br>
【八字信息】
${pillars?.year ? `年柱:${pillars.year}` : ''}
${pillars?.month ? `月柱:${pillars.month}` : ''}
${pillars?.day ? `日柱:${pillars.day}` : ''}
${pillars?.hour ? `时柱:${pillars.hour}` : ''}

【分析范围】
请根据求测者年龄阶段重点分析:
${types.join('、')}
请以通俗易懂的语言进行分析,既要有传统命理的专业性,又要符合现代人的思维方式。
最后,请给予求测者积极向上、助其趋吉避凶的指导,帮助其了解自身优势与挑战,从而更好地把握人生方向。`</code></em></pre>
<p><em>注意:当前日期 和 年龄 可是关键,不然 DeepSeek 大模型可能会“跑偏”,说出些不着调的话。</em></p>
<h4>免责声明</h4>
<p>本项目提供的所有内容仅供娱乐和参考用途,不具有任何科学依据或专业建议性质。项目所涉及的算命、占卜等相关服务仅为用户提供休闲娱乐体验,不能作为决策依据或替代专业建议。</p>
<p>请注意:</p>
<ol>
<li>本项目不保证内容的准确性或可靠性,相关结果仅供参考。</li>
<li>用户需自行判断和承担使用本网站服务所产生的任何后果。</li>
<li>本项目不支持、不鼓励任何形式的迷信活动,请理性看待相关内容。</li>
</ol>
<p>隐私保护声明</p>
<p>本项目严格遵守用户隐私保护原则:</p>
<ol>
<li>本项目完全开源免费、不会收集、存储或分享任何用户的个人信息或数据。</li>
<li>用户在使用服务过程中所输入的信息均不被保存,所有操作均完全匿名。</li>
<li>本项目的服务基于即时生成,用户数据不会被记录或用于任何其他用途。</li>
</ol>
<p>如您对任何个人或专业问题有疑问,请寻求专业人士或机构的建议。</p><br><br>
来源:https://www.cnblogs.com/greywen/p/18761424
頁: [1]
查看完整版本: TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合