<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hsi-Ming 的筆記</title><link>https://hsiming.dev/</link><description>Recent content on Hsi-Ming 的筆記</description><generator>Hugo</generator><language>zh-tw</language><atom:link href="https://hsiming.dev/index.xml" rel="self" type="application/rss+xml"/><item><title>Hello World</title><link>https://hsiming.dev/docs/hello-world/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://hsiming.dev/docs/hello-world/</guid><description>&lt;p>這是我在 &lt;code>hsiming.dev&lt;/code> 的第一篇測試文章！🎉&lt;/p>
&lt;h2 id="1-測試程式碼區塊-code-block">1. 測試程式碼區塊 (Code Block)&lt;a class="anchor" href="#1-%e6%b8%ac%e8%a9%a6%e7%a8%8b%e5%bc%8f%e7%a2%bc%e5%8d%80%e5%a1%8a-code-block">#&lt;/a>&lt;/h2>
&lt;p>這是我平時用來測試 LLM 的 Python 腳本：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> os
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">call_local_model&lt;/span>(prompt):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">f&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Sending prompt to Ollama: &lt;/span>&lt;span style="color:#e6db74">{&lt;/span>prompt&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e"># TODO: Implement connection&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="2-測試-latex-數學式">2. 測試 LaTeX 數學式&lt;a class="anchor" href="#2-%e6%b8%ac%e8%a9%a6-latex-%e6%95%b8%e5%ad%b8%e5%bc%8f">#&lt;/a>&lt;/h2>
&lt;p>來寫一段機器學習常看到的損失函數（Loss Function）：&lt;/p>
&lt;p>$$
J(\theta) = \frac{1}{2m} \sum_{i=1}^{m} (h_\theta(x^{(i)}) - y^{(i)})^2
$$&lt;/p>
&lt;p>這是一段行內公式：模型預測值 $y = wx + b$ 會隨著權重更新而改變。&lt;/p></description></item><item><title>OpenClaw 串接 Discord</title><link>https://hsiming.dev/docs/openclaw-discord/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://hsiming.dev/docs/openclaw-discord/</guid><description>&lt;p>在開始串接前，我假設你已經有了&lt;/p>
&lt;ol>
&lt;li>運行中的 OpenClaw&lt;/li>
&lt;li>已註冊的 Discord 帳號&lt;/li>
&lt;li>一個 Discord 伺服器（如果沒有，可以自己創建一個）&lt;/li>
&lt;/ol>
&lt;h2 id="快速設定">快速設定&lt;a class="anchor" href="#%e5%bf%ab%e9%80%9f%e8%a8%ad%e5%ae%9a">#&lt;/a>&lt;/h2>
&lt;h3 id="1-創建-discord-應用程式與機器人">1. 創建 Discord 應用程式與機器人&lt;a class="anchor" href="#1-%e5%89%b5%e5%bb%ba-discord-%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e8%88%87%e6%a9%9f%e5%99%a8%e4%ba%ba">#&lt;/a>&lt;/h3>
&lt;ul>
&lt;li>到 Discord developer portal &lt;a href="https://discord.com/developers/applications">https://discord.com/developers/applications&lt;/a>&lt;/li>
&lt;li>點選右上角新建應用程式，並輸入應用程式名稱，比如&lt;code>OpenClaw Bot&lt;/code>&lt;/li>
&lt;li>在左側邊欄點選&lt;code>機器人&lt;/code>，然後在使用者名稱輸入你想要的 agent 名稱，比如&lt;code>OpenClaw Agent&lt;/code>&lt;/li>
&lt;/ul>
&lt;h3 id="2-啟用特權意圖privileged-intents">2. 啟用特權意圖（Privileged Intents）&lt;a class="anchor" href="#2-%e5%95%9f%e7%94%a8%e7%89%b9%e6%ac%8a%e6%84%8f%e5%9c%96privileged-intents">#&lt;/a>&lt;/h3>
&lt;ul>
&lt;li>把這三個選項都打開：
&lt;img src="2026-04-03-14-06-07.png" alt="" />&lt;/li>
&lt;/ul>
&lt;h3 id="3-複製權杖bot-token">3. 複製權杖（Bot Token）&lt;a class="anchor" href="#3-%e8%a4%87%e8%a3%bd%e6%ac%8a%e6%9d%96bot-token">#&lt;/a>&lt;/h3>
&lt;ul>
&lt;li>回到頁面前半部分，點選重設權杖（Reset Token），並將新的權杖（Token）儲存在一個安全的地方，稍後會用到&lt;/li>
&lt;/ul>
&lt;h3 id="4-產生邀請網址並加入機器人">4. 產生邀請網址，並加入機器人&lt;a class="anchor" href="#4-%e7%94%a2%e7%94%9f%e9%82%80%e8%ab%8b%e7%b6%b2%e5%9d%80%e4%b8%a6%e5%8a%a0%e5%85%a5%e6%a9%9f%e5%99%a8%e4%ba%ba">#&lt;/a>&lt;/h3>
&lt;p>到頁面最下方選擇儲存，在左側邊欄點擊 OAuth2，我們將產生一個帶有正確權限的邀請網址，用來將機器人加入 Discord 伺服器。向下捲動到 OAuth2 URL 產生器，並啟用：&lt;/p>
&lt;ul>
&lt;li>bot&lt;/li>
&lt;li>applications.commands
&lt;img src="2026-04-03-15-10-06.png" alt="" />&lt;/li>
&lt;/ul>
&lt;p>下方會出現一個機器人權限區塊，啟用：&lt;/p>
&lt;ul>
&lt;li>檢視頻道 （View Channels）&lt;/li>
&lt;li>傳送訊息 （Send Messages）&lt;/li>
&lt;li>讀取訊息歷史紀錄 （Read Message History）&lt;/li>
&lt;li>嵌入連結 （Embed Links）&lt;/li>
&lt;li>附加檔案 （Attach Files）&lt;/li>
&lt;li>新增反應 （Add Reactions）&lt;/li>
&lt;/ul>
&lt;p>複製頁面底部產生 URL 的網址，貼到瀏覽器中，選擇您的伺服器，然後點擊 Continue 進行連接。現在您應該可以在 Discord 伺服器中看到您的機器人了。&lt;/p></description></item></channel></rss>