<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>小麦的杂货铺</title>
  <icon>https://bingowith.me/icon.png</icon>
  <subtitle>日常随笔~</subtitle>
  <link href="https://bingowith.me/atom.xml" rel="self"/>
  
  <link href="https://bingowith.me/"/>
  <updated>2026-08-05T15:21:07.956Z</updated>
  <id>https://bingowith.me/</id>
  
  <author>
    <name>abaabaqua</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>从 WordPress 到 Astro：一次静态博客迁移的过程、取舍与技巧</title>
    <link href="https://bingowith.me/2026/08/05/wordpress-to-astro-static-blog-migration/"/>
    <id>https://bingowith.me/2026/08/05/wordpress-to-astro-static-blog-migration/</id>
    <published>2026-08-04T16:00:00.000Z</published>
    <updated>2026-08-05T15:21:07.956Z</updated>
    
    
    <summary type="html">&lt;p&gt;前几天完成了一次 WordPress 博客到 Astro 静态博客的迁移。背景是博客更新没这么频繁，而且很多动态能力不需要了，开了评论，结果后台几百个各类广告的评论没有任何意义了。博客内容本身不多，就是特别要注意旧链接和旧资源要依然可靠地工作，不然SEO就全清空了。&lt;/p&gt;
&lt;p&gt;这篇文章记录迁移过程中的关键判断、实现方式和一些容易被忽略的细节。新站以 Astro 7 和 Tailwind CSS 4 为基础；使用了 Codex + GPT-5.6-terra 作为协作工具。&lt;/p&gt;</summary>
    
    
    
    
    <category term="Astro" scheme="https://bingowith.me/tags/Astro/"/>
    
    <category term="Codex" scheme="https://bingowith.me/tags/Codex/"/>
    
    <category term="WordPress" scheme="https://bingowith.me/tags/WordPress/"/>
    
    <category term="Tailwind CSS" scheme="https://bingowith.me/tags/Tailwind-CSS/"/>
    
    <category term="静态网站" scheme="https://bingowith.me/tags/%E9%9D%99%E6%80%81%E7%BD%91%E7%AB%99/"/>
    
  </entry>
  
  <entry>
    <title>Codex 通过中转使用 GPT-5.6 时 Web Search 失败的解决办法</title>
    <link href="https://bingowith.me/2026/07/22/codex-proxy-gpt-5-6-web-search-fix/"/>
    <id>https://bingowith.me/2026/07/22/codex-proxy-gpt-5-6-web-search-fix/</id>
    <published>2026-07-21T16:00:00.000Z</published>
    <updated>2026-07-22T12:48:51.166Z</updated>
    
    
      
      
        
        
    <summary type="html">&lt;p&gt;随着GPT-5.6 的发布，Codex 也为其进行了特殊的修改。&lt;/p&gt;
&lt;p&gt;使用中转&amp;#x2F;反代在 Codex 中调用 GPT-5.6 时，如果 Web Search 调用失败，常见原因并不在 Codex</summary>
        
      
    
    
    
    
    <category term="GPT" scheme="https://bingowith.me/tags/GPT/"/>
    
    <category term="Codex" scheme="https://bingowith.me/tags/Codex/"/>
    
  </entry>
  
  <entry>
    <title>Astro v6 Node Adapter后端的环境变量设置（v5 到 v6 的一个 breaking change）</title>
    <link href="https://bingowith.me/2026/06/07/astro-v6-node-adapter-environment-variables/"/>
    <id>https://bingowith.me/2026/06/07/astro-v6-node-adapter-environment-variables/</id>
    <published>2026-06-06T16:00:00.000Z</published>
    <updated>2026-06-07T09:00:54.830Z</updated>
    
    
    <summary type="html">&lt;p&gt;这其实是Astro v6的一个改动，&lt;a href=&quot;https://docs.astro.build/en/guides/upgrade-to/v6/#changed-importmetaenv-values-are-always-inlined&quot;&gt;Changed: &lt;code&gt;import.meta.env&lt;/code&gt; values are always inlined&lt;/a&gt;：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In Astro 5.13, the experimental.staticImportMetaEnv flag was introduced to update the behavior when accessing import.meta.env directly to align with Vite’s handling of environment variables and ensures that import.meta.env values are always inlined.&lt;/p&gt;
&lt;p&gt;In Astro 5.x, non-public environment variables were replaced by a reference to process.env. Additionally, Astro could also convert the value type of your environment variables used through import.meta.env, which could prevent access to some values such as the strings “true” (which was converted to a boolean value), and “1” (which was converted to a number).&lt;/p&gt;
&lt;p&gt;Astro 6 removes this experimental flag and makes this the new default behavior in Astro: import.meta.env values are always inlined and never coerced.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;所以下面这篇文章讨论的前提，都是Astro v6。&lt;/p&gt;
&lt;p&gt;Astro官方文档里有关于环境变量的章节，&lt;a href=&quot;https://docs.astro.build/en/guides/environment-variables/&quot;&gt;Using environment variables&lt;/a&gt;，里面有个例子：&lt;/p&gt;
&lt;figure class=&quot;highlight typescript&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;4&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;5&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;comment&quot;&gt;// When import.meta.env.SSR === true&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;const&lt;/span&gt; data = &lt;span class=&quot;keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;title function_&quot;&gt;db&lt;/span&gt;(&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;meta&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;env&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;DB_PASSWORD&lt;/span&gt;);&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;comment&quot;&gt;// When import.meta.env.SSR === false&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;const&lt;/span&gt; data = &lt;span class=&quot;title function_&quot;&gt;fetch&lt;/span&gt;(&lt;span class=&quot;string&quot;&gt;`&lt;span class=&quot;subst&quot;&gt;$&amp;#123;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;.meta.env.PUBLIC_POKEAPI&amp;#125;&lt;/span&gt;/pokemon/squirtle`&lt;/span&gt;);&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;p&gt;它主要使用Vite的环境变量，&lt;a href=&quot;https://vite.dev/guide/env-and-mode.html&quot;&gt;Env Variables and Modes&lt;/a&gt;，但这里其实就有个坑点，那就是这种方式的值会在build的时候被替换成实际的值，而不是在运行时动态获取，这意味着：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在build的时候就需要提供这个环境变量，不然无法替换；&lt;/li&gt;
&lt;li&gt;在运行时无法改变这个变量，因为他已经被写入了构造物里。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;假设你在代码里写了：&lt;/p&gt;
&lt;figure class=&quot;highlight typescript&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;const&lt;/span&gt; db = &lt;span class=&quot;title function_&quot;&gt;drizzle&lt;/span&gt;(&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;meta&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;env&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;DATABASE_URL&lt;/span&gt;);&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;p&gt;那么在build时提供了系统环境变量或者&lt;code&gt;.env&lt;/code&gt;的时候，且值是 &lt;code&gt;mysql://user:password@localhost:3306/db&lt;/code&gt;，它最终的dist会变成（也就是直接inline替换了）：&lt;/p&gt;
&lt;figure class=&quot;highlight typescript&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;const&lt;/span&gt; db = &lt;span class=&quot;title function_&quot;&gt;drizzle&lt;/span&gt;(&lt;span class=&quot;string&quot;&gt;&amp;quot;mysql://user:password@localhost:3306/db&amp;quot;&lt;/span&gt;);&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;</summary>
    
    
    
    
    <category term="Astro" scheme="https://bingowith.me/tags/Astro/"/>
    
    <category term="SSR" scheme="https://bingowith.me/tags/SSR/"/>
    
  </entry>
  
  <entry>
    <title>谷歌GenAI Java SDK tts示例 (gemini-3.1-flash-tts-preview)</title>
    <link href="https://bingowith.me/2026/05/09/google-genai-java-sdk-tts-example/"/>
    <id>https://bingowith.me/2026/05/09/google-genai-java-sdk-tts-example/</id>
    <published>2026-05-08T16:16:11.000Z</published>
    <updated>2026-05-08T16:16:11.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;谷歌官方文档是: &lt;a href=&quot;https://ai.google.dev/gemini-api/docs/speech-generation&quot;&gt;https://ai.google.dev/gemini-api/docs/speech-generation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;但是很尴尬,他没有java sdk的示例,而且java sdk的example里也没有对应的例子,&lt;a href=&quot;https://github.com/googleapis/java-genai/tree/main/examples&quot;&gt;https://github.com/googleapis/java-genai/tree/main/examples&lt;/a&gt;.&lt;br&gt;这两个和文档不一致&lt;a href=&quot;https://github.com/googleapis/java-genai/blob/1e1f20c96a729c8030015c2d3812fac79715ba24/examples/src/main/java/com/google/genai/examples/InteractionMultimodalResponseAudio.java#L63&quot;&gt;examples&amp;#x2F;src&amp;#x2F;main&amp;#x2F;java&amp;#x2F;com&amp;#x2F;google&amp;#x2F;genai&amp;#x2F;examples&amp;#x2F;InteractionMultimodalResponseAudio.java&lt;/a&gt;, &lt;a href=&quot;https://github.com/googleapis/java-genai/blob/1e1f20c96a729c8030015c2d3812fac79715ba24/examples/src/main/java/com/google/genai/examples/InteractionMultimodalResponseAudioWithGenerateContent.java#L79&quot;&gt;examples&amp;#x2F;src&amp;#x2F;main&amp;#x2F;java&amp;#x2F;com&amp;#x2F;google&amp;#x2F;genai&amp;#x2F;examples&amp;#x2F;InteractionMultimodalResponseAudioWithGenerateContent.java&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;但其实只需要用他统一的generateContent方法就可以了.&lt;/p&gt;
&lt;p&gt;调用方式其实和文档里的python一样,只要知道对应的类即可.&lt;/p&gt;</summary>
    
    
    
    
    <category term="AIGC" scheme="https://bingowith.me/tags/AIGC/"/>
    
    <category term="gemini" scheme="https://bingowith.me/tags/gemini/"/>
    
  </entry>
  
  <entry>
    <title>Windows 下 Codex 执行 bash 中文乱码问题排查与解决</title>
    <link href="https://bingowith.me/2026/02/06/windows-codex-bash-wrong-encoding/"/>
    <id>https://bingowith.me/2026/02/06/windows-codex-bash-wrong-encoding/</id>
    <published>2026-02-05T16:00:00.000Z</published>
    <updated>2026-02-06T08:51:51.068Z</updated>
    
    
    <summary type="html">&lt;p&gt;最近在 Windows 上使用 Codex CLI 时，遇到了一个很诡异的问题：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;直接在终端执行 &lt;code&gt;bash -lc &amp;quot;echo 你好&amp;quot;&lt;/code&gt;，输出正常。&lt;/li&gt;
&lt;li&gt;让 Claude Code 帮我执行 bash，输出也正常。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;只有 Codex 执行 bash 会出现中文乱码&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;先放结论：这个问题最后不是靠 PowerShell 编码设置解决的，而是要给 Codex 设置 &lt;code&gt;WSL_UTF8=1&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/windows-codex-bash-wrong-encoding/wrong.png&quot;&gt;&lt;/p&gt;</summary>
    
    
    
    
    <category term="编码" scheme="https://bingowith.me/tags/%E7%BC%96%E7%A0%81/"/>
    
    <category term="Codex" scheme="https://bingowith.me/tags/Codex/"/>
    
    <category term="AI" scheme="https://bingowith.me/tags/AI/"/>
    
    <category term="Windows" scheme="https://bingowith.me/tags/Windows/"/>
    
    <category term="OpenAI" scheme="https://bingowith.me/tags/OpenAI/"/>
    
    <category term="WSL" scheme="https://bingowith.me/tags/WSL/"/>
    
  </entry>
  
  <entry>
    <title>Vercel AI SDK 的工具审批（Approval）流程详解</title>
    <link href="https://bingowith.me/2026/01/12/vercel-ai-sdk-tool-approval-flow/"/>
    <id>https://bingowith.me/2026/01/12/vercel-ai-sdk-tool-approval-flow/</id>
    <published>2026-01-11T16:00:00.000Z</published>
    <updated>2026-01-12T08:23:43.677Z</updated>
    
    
    <summary type="html">&lt;h2 id=&quot;概述&quot;&gt;&lt;a href=&quot;#概述&quot; class=&quot;headerlink&quot; title=&quot;概述&quot;&gt;&lt;/a&gt;概述&lt;/h2&gt;&lt;p&gt;在 AI 应用中，当 AI 助手需要调用本地文件系统或其他敏感工具时，出于安全考虑，需要在执行前获得用户的明确批准。Vercel AI SDK（文中使用 v6 版本，这狗东西 API 一直变来变去的）提供了工具审批（Tool Approval）机制，允许开发者在 AI 执行工具前拦截并请求用户确认。&lt;/p&gt;
&lt;p&gt;注意这个参数主要是为了配合&lt;code&gt;stopWhen&lt;/code&gt;（也就是工具自动调用），也就是:&lt;/p&gt;
&lt;figure class=&quot;highlight typescript&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;4&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;5&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;6&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;const&lt;/span&gt; result = &lt;span class=&quot;title function_&quot;&gt;streamText&lt;/span&gt;(&amp;#123;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;  &lt;span class=&quot;attr&quot;&gt;model&lt;/span&gt;: newapi.&lt;span class=&quot;title function_&quot;&gt;chat&lt;/span&gt;(config.&lt;span class=&quot;property&quot;&gt;model&lt;/span&gt;.&lt;span class=&quot;property&quot;&gt;model&lt;/span&gt;),&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;  messages,&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;  tools,&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;  &lt;span class=&quot;attr&quot;&gt;stopWhen&lt;/span&gt;: &lt;span class=&quot;title function_&quot;&gt;stepCountIs&lt;/span&gt;(&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;), &lt;span class=&quot;comment&quot;&gt;// 这里 自动工具调用&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&amp;#125;);&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;p&gt;同时也注意这东西的调用方式灵活的很，毕竟他不是应用级别的封装，不用这套自己也可以搓一个出来。&lt;/p&gt;
&lt;p&gt;同时在 AI SDK UI 中的调用流程是完全不一样的，这里只针对 Core 的 API。（但是其实也八九不离十了）&lt;/p&gt;</summary>
    
    
    
    
    <category term="AI" scheme="https://bingowith.me/tags/AI/"/>
    
    <category term="Vercel AI SDK" scheme="https://bingowith.me/tags/Vercel-AI-SDK/"/>
    
    <category term="Tool Approval" scheme="https://bingowith.me/tags/Tool-Approval/"/>
    
    <category term="TypeScript" scheme="https://bingowith.me/tags/TypeScript/"/>
    
  </entry>
  
  <entry>
    <title>Astro 项目集成 Better Auth 指南(使用drizzle+PG)</title>
    <link href="https://bingowith.me/2026/01/09/astro-better-auth-integration/"/>
    <id>https://bingowith.me/2026/01/09/astro-better-auth-integration/</id>
    <published>2026-01-08T16:00:00.000Z</published>
    <updated>2026-01-08T17:38:55.234Z</updated>
    
    
    <summary type="html">&lt;p&gt;本文档说明如何在 Astro 项目中集成 Better Auth，使用 Drizzle 作为数据库适配器，PostgreSQL 作为数据库。&lt;/p&gt;
&lt;p&gt;emmmm,文档是在实践完之后写的，不是边实践边写的，可能会有所遗漏，但是扫了几遍源码，应该八九不离十。&lt;/p&gt;
&lt;p&gt;注意这个需要 server 支持，所以需要 server adapter，比如 node 的&lt;a href=&quot;https://docs.astro.build/en/guides/integrations-guide/node/&quot;&gt;@astrojs&amp;#x2F;node&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;我使用的是默认 static，需要后端运行时渲染的地方用&lt;code&gt;export const prerender = false;&lt;/code&gt;，如果你的 output 设置为了 server，那么就不需要 prerender&amp;#x3D;false。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;官方文档参考&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.better-auth.com/docs/installation&quot;&gt;Better Auth 安装指南&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.better-auth.com/docs/adapters/drizzle&quot;&gt;Better Auth Drizzle 适配器&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.better-auth.com/docs/integrations/astro&quot;&gt;Better Auth Astro 集成&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2 id=&quot;步骤-1：安装依赖&quot;&gt;&lt;a href=&quot;#步骤-1：安装依赖&quot; class=&quot;headerlink&quot; title=&quot;步骤 1：安装依赖&quot;&gt;&lt;/a&gt;步骤 1：安装依赖&lt;/h2&gt;&lt;p&gt;首先，安装 Better Auth 及相关依赖：&lt;/p&gt;
&lt;figure class=&quot;highlight bash&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;4&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;5&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;comment&quot;&gt;# 安装核心依赖&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;pnpm add better-auth drizzle-orm pg dotenv&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;comment&quot;&gt;# 安装开发依赖&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;pnpm add -D drizzle-kit tsx @types/pg&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;依赖说明&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;better-auth&lt;/code&gt;: 认证核心库&lt;/li&gt;
&lt;li&gt;&lt;code&gt;drizzle-orm&lt;/code&gt;: ORM 库，用于数据库操作&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pg&lt;/code&gt;: PostgreSQL 驱动&lt;/li&gt;
&lt;li&gt;&lt;code&gt;drizzle-kit&lt;/code&gt;: Drizzle 开发工具（用于数据库迁移）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotenv&lt;/code&gt;: 环境变量加载（&lt;strong&gt;drizzle.config.ts 需要&lt;/strong&gt;）&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;</summary>
    
    
    
    
    <category term="Astro" scheme="https://bingowith.me/tags/Astro/"/>
    
    <category term="Better Auth" scheme="https://bingowith.me/tags/Better-Auth/"/>
    
    <category term="React" scheme="https://bingowith.me/tags/React/"/>
    
    <category term="PostgreSQL" scheme="https://bingowith.me/tags/PostgreSQL/"/>
    
    <category term="Drizzle" scheme="https://bingowith.me/tags/Drizzle/"/>
    
  </entry>
  
  <entry>
    <title>字符编码详解：UTF-8、Unicode、GBK 等</title>
    <link href="https://bingowith.me/2025/12/10/character-encoding-explained/"/>
    <id>https://bingowith.me/2025/12/10/character-encoding-explained/</id>
    <published>2025-12-10T07:30:00.000Z</published>
    <updated>2025-12-10T17:24:34.356Z</updated>
    
    
    <summary type="html">通俗易懂地讲解 UTF-8、Unicode、GBK 等字符编码的区别与应用，用快递系统类比帮助理解核心概念</summary>
    
    
    
    <category term="技术" scheme="https://bingowith.me/categories/%E6%8A%80%E6%9C%AF/"/>
    
    <category term="计算机基础" scheme="https://bingowith.me/categories/%E6%8A%80%E6%9C%AF/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/"/>
    
    
    <category term="UTF-8" scheme="https://bingowith.me/tags/UTF-8/"/>
    
    <category term="Unicode" scheme="https://bingowith.me/tags/Unicode/"/>
    
    <category term="编码" scheme="https://bingowith.me/tags/%E7%BC%96%E7%A0%81/"/>
    
    <category term="GBK" scheme="https://bingowith.me/tags/GBK/"/>
    
    <category term="字符集" scheme="https://bingowith.me/tags/%E5%AD%97%E7%AC%A6%E9%9B%86/"/>
    
  </entry>
  
  <entry>
    <title>深入理解 SSR/CSR 与 SPA/MPA：现代前端渲染模式详解</title>
    <link href="https://bingowith.me/2025/12/09/understanding-ssr-csr-spa-mpa/"/>
    <id>https://bingowith.me/2025/12/09/understanding-ssr-csr-spa-mpa/</id>
    <published>2025-12-09T14:22:00.000Z</published>
    <updated>2025-12-09T15:20:27.622Z</updated>
    
    
    <summary type="html">深入理解 SSR/CSR 与 SPA/MPA 的概念关系，以及现代前端框架（Next.js、Nuxt、Remix）的 SSR 与传统后端 SSR 的本质区别</summary>
    
    
    
    <category term="前端开发" scheme="https://bingowith.me/categories/%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91/"/>
    
    <category term="架构设计" scheme="https://bingowith.me/categories/%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91/%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1/"/>
    
    
    <category term="SSR" scheme="https://bingowith.me/tags/SSR/"/>
    
    <category term="Next.js" scheme="https://bingowith.me/tags/Next-js/"/>
    
    <category term="SPA" scheme="https://bingowith.me/tags/SPA/"/>
    
    <category term="CSR" scheme="https://bingowith.me/tags/CSR/"/>
    
    <category term="MPA" scheme="https://bingowith.me/tags/MPA/"/>
    
    <category term="前端架构" scheme="https://bingowith.me/tags/%E5%89%8D%E7%AB%AF%E6%9E%B6%E6%9E%84/"/>
    
  </entry>
  
  <entry>
    <title>6GB显存跑Z-Image-Turbo完全指南</title>
    <link href="https://bingowith.me/2025/11/28/z-image-turbo-low-vram-setup/"/>
    <id>https://bingowith.me/2025/11/28/z-image-turbo-low-vram-setup/</id>
    <published>2025-11-27T16:00:00.000Z</published>
    <updated>2025-11-28T13:12:54.645Z</updated>
    
    
    <summary type="html">手把手教你用6GB显存跑通阿里的Z-Image-Turbo，拖拉机启动！</summary>
    
    
    
    <category term="AI" scheme="https://bingowith.me/categories/AI/"/>
    
    <category term="教程" scheme="https://bingowith.me/categories/AI/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="ComfyUI" scheme="https://bingowith.me/tags/ComfyUI/"/>
    
    <category term="Z-Image" scheme="https://bingowith.me/tags/Z-Image/"/>
    
    <category term="低显存" scheme="https://bingowith.me/tags/%E4%BD%8E%E6%98%BE%E5%AD%98/"/>
    
    <category term="量化" scheme="https://bingowith.me/tags/%E9%87%8F%E5%8C%96/"/>
    
  </entry>
  
  <entry>
    <title>自行部署 Next.js Docker 的挑战：臃肿、平台绑定与隐藏的“坑”</title>
    <link href="https://bingowith.me/2025/11/16/nextjs-docker-deploy-pitfalls/"/>
    <id>https://bingowith.me/2025/11/16/nextjs-docker-deploy-pitfalls/</id>
    <published>2025-11-16T12:30:00.000Z</published>
    <updated>2025-11-16T12:30:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;Next.js 作为目前最受欢迎的 React 全栈框架之一，凭借其强大的功能和“开箱即用”的体验赢得了大量开发者。然而，这种便利性很大程度上依赖于其创造者 Vercel 提供的原生托管平台。但是一旦开发者选择通过 Docker 自行部署，便会发现这条路并非坦途，充满了各种不易察觉的“坑”，并且会逐渐感受到框架本身的臃肿与对特定平台的深度绑定。&lt;/p&gt;
&lt;p&gt;这里就总结了一下我这一年实践遇到的问题，建议没有 SEO 需求还是不要碰他了。&lt;/p&gt;
&lt;h2 id=&quot;路由与请求类型的“黑盒”&quot;&gt;&lt;a href=&quot;#路由与请求类型的“黑盒”&quot; class=&quot;headerlink&quot; title=&quot;路由与请求类型的“黑盒”&quot;&gt;&lt;/a&gt;路由与请求类型的“黑盒”&lt;/h2&gt;&lt;p&gt;在自行部署的环境中，Next.js 的一些内部机制会变得异常棘手。以 React Server Components (RSC) 的请求为例，它与页面的请求路径一致，但会附加一个 &lt;code&gt;?_rsc=...&lt;/code&gt; 参数以区分（也会增加一些 header）。问题在于，这个参数（以及额外的 header）在到达我们自己的应用逻辑之前，往往已被 Next.js 框架内部“消化”。这意味着，&lt;strong&gt;在&lt;code&gt;proxy.ts&lt;/code&gt;（16 之前的&lt;code&gt;middleware.ts&lt;/code&gt;），无法捕获到 &lt;code&gt;_rsc&lt;/code&gt; 这个参数&lt;/strong&gt;。因此，从代码层面来看，开发者无法轻易判断一个传入的请求究竟是完整的页面加载请求，还是一个用于更新部分 UI 的 RSC 请求。&lt;/p&gt;
&lt;p&gt;这在一些重定向场景中会造成一些问题。&lt;/p&gt;</summary>
    
    
    
    
    <category term="Next.js" scheme="https://bingowith.me/tags/Next-js/"/>
    
  </entry>
  
  <entry>
    <title>Next.js 16 Cache Components 完全指南</title>
    <link href="https://bingowith.me/2025/11/01/nextjs-16-cache-components-complete-guide/"/>
    <id>https://bingowith.me/2025/11/01/nextjs-16-cache-components-complete-guide/</id>
    <published>2025-11-01T08:58:02.000Z</published>
    <updated>2025-11-01T08:58:02.000Z</updated>
    
    
    <summary type="html">&lt;blockquote&gt;
&lt;p&gt;基于 Next.js 16.0.1 官方文档整理&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;目录&quot;&gt;&lt;a href=&quot;#目录&quot; class=&quot;headerlink&quot; title=&quot;目录&quot;&gt;&lt;/a&gt;目录&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BB%80%E4%B9%88%E6%98%AF-cache-components&quot;&gt;什么是 Cache Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%A0%B8%E5%BF%83%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86&quot;&gt;核心工作原理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BD%BF%E7%94%A8-suspense-%E8%BE%B9%E7%95%8C&quot;&gt;使用 Suspense 边界&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BD%BF%E7%94%A8-use-cache&quot;&gt;使用 use cache&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%90%AF%E7%94%A8-cache-components&quot;&gt;启用 Cache Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E4%BB%8E%E6%97%A7%E7%89%88%E6%9C%AC%E8%BF%81%E7%A7%BB&quot;&gt;从旧版本迁移&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%AE%9E%E6%88%98%E7%A4%BA%E4%BE%8B&quot;&gt;实战示例&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5&quot;&gt;最佳实践&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%92%8C-Next-intl-%E7%BB%93%E5%90%88&quot;&gt;和 Next-intl 结合&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%B8%B8%E8%A7%81%E9%94%99%E8%AF%AF%E4%B8%8E%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88&quot;&gt;常见错误与解决方案&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#faq&quot;&gt;FAQ&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99&quot;&gt;参考资料&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;这边文档主要是 AI 总结+我补充实际遇到的问题，大部分是 AI 写的。&lt;/p&gt;
&lt;p&gt;注意，文档里不包含&lt;code&gt;use cache: private&lt;/code&gt;的内容，在写的时候本来官方文档里说依赖&lt;code&gt;unstable_prefetch&lt;/code&gt;，但是后来一看这个内容又被移除了，不知道后续会不会再改，先不写了，以官方文档为准。&lt;a href=&quot;https://nextjs.org/docs/app/api-reference/directives/use-cache-private&quot;&gt;API Reference &amp;gt; Directives &amp;gt; use cache: private&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;注意，现在的 16.0 还在不断变化中，还是等 16.1，16.2 再用吧。这东西太不稳了。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Cache components&lt;/code&gt;除了方便的 PPR+显式缓存，另外一个就是在框架层面（主要是 dev 和构建的时候），防止用户写出动态内容卡住整个页面加载的事，这在之前很容易写出来，网上也有很多批评的文章和视频，一看连&lt;code&gt;loading.tsx&lt;/code&gt;和&lt;code&gt;Suspense&lt;/code&gt;都不会用。😂&lt;br&gt;现在官方强制了，也是件好事吧。&lt;/p&gt;
&lt;h2 id=&quot;什么是-Cache-Components&quot;&gt;&lt;a href=&quot;#什么是-Cache-Components&quot; class=&quot;headerlink&quot; title=&quot;什么是 Cache Components&quot;&gt;&lt;/a&gt;什么是 Cache Components&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Cache Components&lt;/strong&gt; 是 Next.js 16 中一种新的渲染和缓存方法，通过 &lt;strong&gt;Partial Prerendering (PPR)&lt;/strong&gt; 提供细粒度的缓存控制，同时确保出色的用户体验。&lt;/p&gt;
&lt;h3 id=&quot;核心关系&quot;&gt;&lt;a href=&quot;#核心关系&quot; class=&quot;headerlink&quot; title=&quot;核心关系&quot;&gt;&lt;/a&gt;核心关系&lt;/h3&gt;&lt;figure class=&quot;highlight plaintext&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;Cache Components = PPR + use cache&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PPR&lt;/strong&gt; 提供静态外壳和流式传输基础设施&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;use cache&lt;/code&gt;&lt;/strong&gt; 让你在外壳中包含优化的动态输出&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;解决的问题&quot;&gt;&lt;a href=&quot;#解决的问题&quot; class=&quot;headerlink&quot; title=&quot;解决的问题&quot;&gt;&lt;/a&gt;解决的问题&lt;/h3&gt;&lt;p&gt;在开发动态应用时，你需要在两种方式之间权衡：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;❌ &lt;strong&gt;完全静态页面&lt;/strong&gt;：加载快，但无法显示个性化或实时数据&lt;/li&gt;
&lt;li&gt;❌ &lt;strong&gt;完全动态页面&lt;/strong&gt;：可显示最新数据，但每次请求都需要渲染所有内容，导致初始加载慢&lt;/li&gt;
&lt;/ul&gt;</summary>
    
    
    
    
    <category term="React" scheme="https://bingowith.me/tags/React/"/>
    
    <category term="Next.js" scheme="https://bingowith.me/tags/Next-js/"/>
    
    <category term="Cache Components" scheme="https://bingowith.me/tags/Cache-Components/"/>
    
    <category term="Next.js 16" scheme="https://bingowith.me/tags/Next-js-16/"/>
    
    <category term="Web Development" scheme="https://bingowith.me/tags/Web-Development/"/>
    
  </entry>
  
  <entry>
    <title>在容器中运行的mysql数据库定时备份脚本</title>
    <link href="https://bingowith.me/2025/09/29/mysql-docker-mysqldump-backup-script/"/>
    <id>https://bingowith.me/2025/09/29/mysql-docker-mysqldump-backup-script/</id>
    <published>2025-09-28T16:13:00.000Z</published>
    <updated>2025-09-28T16:13:00.000Z</updated>
    
    
      
      
        
        
    <summary type="html">&lt;p&gt;单次备份直接跑:&lt;/p&gt;
&lt;figure class=&quot;highlight bash&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td</summary>
        
      
    
    
    
    
    <category term="mysql" scheme="https://bingowith.me/tags/mysql/"/>
    
    <category term="docker" scheme="https://bingowith.me/tags/docker/"/>
    
    <category term="mysqldump" scheme="https://bingowith.me/tags/mysqldump/"/>
    
    <category term="linux" scheme="https://bingowith.me/tags/linux/"/>
    
    <category term="shell" scheme="https://bingowith.me/tags/shell/"/>
    
  </entry>
  
  <entry>
    <title>timestamp存取差几小时? mysql timestamp的timezone问题以及如何在mysql2设置</title>
    <link href="https://bingowith.me/2025/08/14/nodejs-mysql-timezone-problem/"/>
    <id>https://bingowith.me/2025/08/14/nodejs-mysql-timezone-problem/</id>
    <published>2025-08-13T20:45:00.000Z</published>
    <updated>2025-08-13T20:45:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;在 Node.js 应用中使用 MySQL 时，时间戳（TIMESTAMP）字段出现的“8 小时差异”是一个经典难题。这个问题的根源并非单一因素，而是由 MySQL 自身的时区机制、mysql2 驱动的特定行为，以及一个极具迷惑性的默认配置共同造成的。&lt;/p&gt;
&lt;p&gt;本文将澄清 MySQL TIMESTAMP 的存储与转换原理，并深入剖析 mysql2 驱动中 timezone 配置项的真正含义及其默认值&lt;code&gt;&amp;#39;local&amp;#39;&lt;/code&gt;所带来的陷阱，最终提供两套清晰的最佳实践方案。&lt;/p&gt;</summary>
    
    
    
    
    <category term="javascript" scheme="https://bingowith.me/tags/javascript/"/>
    
    <category term="mysql" scheme="https://bingowith.me/tags/mysql/"/>
    
    <category term="nodejs" scheme="https://bingowith.me/tags/nodejs/"/>
    
    <category term="timestamp" scheme="https://bingowith.me/tags/timestamp/"/>
    
    <category term="timezone" scheme="https://bingowith.me/tags/timezone/"/>
    
  </entry>
  
  <entry>
    <title>drizzle如何处理mysql的bit类型</title>
    <link href="https://bingowith.me/2025/08/02/drizzle-mysql-bit-type/"/>
    <id>https://bingowith.me/2025/08/02/drizzle-mysql-bit-type/</id>
    <published>2025-08-02T12:25:00.000Z</published>
    <updated>2025-08-02T12:25:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;mysql 的 boolean 类型其实是 tinyint(1)的别名，一些 ORM 工具无法识别把他识别到对应语言的 boolean 类型，日常实践有时候会选择用&lt;code&gt;bit(1)&lt;/code&gt;这个类型，比如&lt;code&gt;java&lt;/code&gt;的&lt;code&gt;JOOQ&lt;/code&gt;，boolean 类型会变为 java 的&lt;code&gt;Byte&lt;/code&gt;，而&lt;code&gt;bit(1)&lt;/code&gt;则是 java 的&lt;code&gt;Boolean&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;但是 drizzle 的 mysql 内置类型中没有&lt;code&gt;bit(1)&lt;/code&gt;。你用他的&lt;code&gt;drizzle-kit pull&lt;/code&gt;之后会返回这个结果：&lt;/p&gt;
&lt;figure class=&quot;highlight plaintext&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;2&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;// Warning: Can&amp;#x27;t parse bit(1) from database&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;// bit(1)Type: bit(1)(&amp;quot;deleted&amp;quot;).notNull(),&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;p&gt;但是如果是已经建好的表，其他逻辑在用的话，把&lt;code&gt;bit(1)&lt;/code&gt;改成&lt;code&gt;boolean&lt;/code&gt;并不方便。&lt;/p&gt;
&lt;p&gt;需要我们自己定义一个类型。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;bit(1)&lt;/code&gt;这个类型不同驱动返回不同，有些可能是作为整数，有些可能是作为 Buffer。所以扩展一下就行：&lt;/p&gt;</summary>
    
    
    
    
    <category term="drizzle" scheme="https://bingowith.me/tags/drizzle/"/>
    
    <category term="javascript" scheme="https://bingowith.me/tags/javascript/"/>
    
    <category term="mysql" scheme="https://bingowith.me/tags/mysql/"/>
    
  </entry>
  
  <entry>
    <title>Next.js 如何在客户端导航时获取上一页(referer)</title>
    <link href="https://bingowith.me/2025/07/17/nextjs-client-navigation-get-previous-page/"/>
    <id>https://bingowith.me/2025/07/17/nextjs-client-navigation-get-previous-page/</id>
    <published>2025-07-16T16:00:00.000Z</published>
    <updated>2025-07-16T16:00:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;想给之前上线的工具站做个博客数据统计: &lt;a href=&quot;https://merchmindai.net/blog/zh/1&quot;&gt;blogs&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;理所当然用到了&lt;code&gt;document.referer&lt;/code&gt;，最方便的获取上一个页面的方式，结果发现获取到的都是第一次 load 的页面，而不是导航前的那个页面。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;为什么会这样？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Next.js 在生产环境中默认采用前端导航（&lt;code&gt;Client-side Navigation&lt;/code&gt;）的方式。这意味着页面加载完之后，在网站内部点击链接时，浏览器并不会执行一次完整的页面刷新。相反，Next.js 会在客户端通过 JavaScript 异步加载新页面的数据和组件，然后更新 DOM。&lt;/p&gt;
&lt;p&gt;这种类似 &lt;strong&gt;单页应用（SPA）&lt;/strong&gt; 的行为导致了一个关键问题：&lt;br&gt;&lt;code&gt;document.referrer&lt;/code&gt; 的值在页面首次加载后保持不变。当通过内部链接从&lt;code&gt;blog/zh/1&lt;/code&gt;导航到 &lt;code&gt;blog/zh/post/[slug]&lt;/code&gt; 时，由于没有发生完整的页面重载，&lt;code&gt;document.referrer&lt;/code&gt; 的值仍然会是最初访问网站的那个值，而不是&lt;code&gt;blog/zh/1&lt;/code&gt;。&lt;/p&gt;</summary>
    
    
    
    
    <category term="nextjs" scheme="https://bingowith.me/tags/nextjs/"/>
    
    <category term="SPA" scheme="https://bingowith.me/tags/SPA/"/>
    
  </entry>
  
  <entry>
    <title>Next.js RSC _rsc参数丢失的那些坑以及解决方案</title>
    <link href="https://bingowith.me/2025/06/25/nextjs-lose-rsc-params-and-head/"/>
    <id>https://bingowith.me/2025/06/25/nextjs-lose-rsc-params-and-head/</id>
    <published>2025-06-24T17:35:00.000Z</published>
    <updated>2025-06-24T17:35:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;最近在用 Next.js 的 RSC（React Server Component）时遇到了一个比较隐晦的问题，记录一下踩坑过程和应对方案。&lt;/p&gt;
&lt;p&gt;如果你在项目里既使用了 CDN（并且缓存了 html），又使用了&lt;code&gt;middleware&lt;/code&gt;的重定向（middleware 会处理 rsc 请求），又用了 RSC 特性（开启了 prefetch 等情况），如果你发现部分页面 html 变成了一大串“乱码”（其实是 rsc 请求的返回结果），可以仔细看看。&lt;/p&gt;
&lt;h2 id=&quot;RSC-请求是怎么工作的？&quot;&gt;&lt;a href=&quot;#RSC-请求是怎么工作的？&quot; class=&quot;headerlink&quot; title=&quot;RSC 请求是怎么工作的？&quot;&gt;&lt;/a&gt;RSC 请求是怎么工作的？&lt;/h2&gt;&lt;p&gt;Next.js 在请求 RSC 和 HTML 页面时，路径和方法其实是一样的，唯一的区别在于它会带上一个 &lt;code&gt;_rsc&lt;/code&gt; 的参数和一些特定 header。&lt;/p&gt;
&lt;p&gt;比如你访问页面 &lt;code&gt;/about&lt;/code&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;HTML 请求&lt;/strong&gt;：&lt;br&gt;&lt;code&gt;GET /about&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RSC 请求&lt;/strong&gt;：&lt;br&gt;&lt;code&gt;GET /about?_rsc=&amp;lt;随机字符串&amp;gt;&lt;/code&gt; 以及特定的 header&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这里的 &lt;code&gt;_rsc&lt;/code&gt; 参数是 Next.js 内部用来标识“这是一次 RSC 请求”，header 里也有类似 &lt;code&gt;Next-Router-State-Tree&lt;/code&gt;, &lt;code&gt;rsc&lt;/code&gt; 等用于数据请求和分割的内容。&lt;/p&gt;</summary>
    
    
    
    
    <category term="nextjs" scheme="https://bingowith.me/tags/nextjs/"/>
    
    <category term="nginx" scheme="https://bingowith.me/tags/nginx/"/>
    
    <category term="CDN" scheme="https://bingowith.me/tags/CDN/"/>
    
    <category term="RSC" scheme="https://bingowith.me/tags/RSC/"/>
    
  </entry>
  
  <entry>
    <title>[翻译]我如何使用 Claude Code</title>
    <link href="https://bingowith.me/2025/06/17/how-i-use-claude-code/"/>
    <id>https://bingowith.me/2025/06/17/how-i-use-claude-code/</id>
    <published>2025-06-16T16:54:00.000Z</published>
    <updated>2025-06-16T16:54:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;&lt;strong&gt;原文出处:&lt;/strong&gt; &lt;a href=&quot;https://spiess.dev/blog/how-i-use-claude-code&quot;&gt;https://spiess.dev/blog/how-i-use-claude-code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;一个月前，我订阅了 Claude Max。在此之前，我已经使用包括 Claude Code 在内的 AI 代理一段时间了，但随着统一价格的推出，我的使用量猛增，它已成为我许多任务的日常驱动力。我发现自己现在去 VS Code 的次数少了很多。&lt;/p&gt;
&lt;p&gt;由于 AI 代理目前对每个人来说都是新事物，我想分享一些我最近注意到模式可能会很有趣。以下是我如何使用 Claude code。&lt;/p&gt;
&lt;h2 id=&quot;开始新对话-Start-New-Threads&quot;&gt;&lt;a href=&quot;#开始新对话-Start-New-Threads&quot; class=&quot;headerlink&quot; title=&quot;开始新对话 (Start New Threads)&quot;&gt;&lt;/a&gt;开始新对话 (Start New Threads)&lt;/h2&gt;&lt;p&gt;如果说我希望你从这篇文章中学到一件事，那就是你应该更频繁地调用 &lt;code&gt;/clear&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;AI 代理往往随着对话时间的延长而变得更不可预测。当你提出不同问题时尤其如此。我发现即使这意味着重复一些指令，创建一个新的提示通常会更有效。&lt;/p&gt;
&lt;p&gt;一旦我开始更积极地这样做，我的结果就显著改善了。而且我绝对不是唯一一个提出这个建议的人。&lt;/p&gt;</summary>
    
    
    
    
    <category term="llm" scheme="https://bingowith.me/tags/llm/"/>
    
    <category term="claude" scheme="https://bingowith.me/tags/claude/"/>
    
  </entry>
  
  <entry>
    <title>Next.js使用filerobot-image-editor</title>
    <link href="https://bingowith.me/2025/05/18/nextjs-filerobot-image-editor/"/>
    <id>https://bingowith.me/2025/05/18/nextjs-filerobot-image-editor/</id>
    <published>2025-05-18T09:44:00.000Z</published>
    <updated>2025-05-18T09:44:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;想在工具站里集成一下图片编辑工具，找了一圈发现&lt;a href=&quot;https://github.com/scaleflex/filerobot-image-editor&quot;&gt;filerobot-image-editor&lt;/a&gt;相当不错。&lt;/p&gt;
&lt;p&gt;按照&lt;code&gt;nextjs&lt;/code&gt;的官方文档来的，什么 lazy, dymanic 都用上了，还是嗝屁了，最后还是直接用 cdn js+浏览器端 js 解决不把模块引入了, 记录一下解法。&lt;/p&gt;
&lt;p&gt;最后的效果见: &lt;a href=&quot;https://merchmindai.net/tools/image-editor?from=dev-blog&quot;&gt;Image Editor | merchmindai&lt;/a&gt;&lt;/p&gt;</summary>
    
    
    
    
    <category term="nextjs" scheme="https://bingowith.me/tags/nextjs/"/>
    
    <category term="filerobot-image-editor" scheme="https://bingowith.me/tags/filerobot-image-editor/"/>
    
    <category term="CSR" scheme="https://bingowith.me/tags/CSR/"/>
    
  </entry>
  
  <entry>
    <title>Next.js使用auth.js+dirzzle+postgresql报错分析</title>
    <link href="https://bingowith.me/2025/03/20/nextjs-auth-dirzzle-postgresql-error/"/>
    <id>https://bingowith.me/2025/03/20/nextjs-auth-dirzzle-postgresql-error/</id>
    <published>2025-03-20T02:23:00.000Z</published>
    <updated>2025-03-20T02:23:00.000Z</updated>
    
    
    <summary type="html">&lt;p&gt;在自己的测试项目里想着做登录功能，看到&lt;code&gt;authjs&lt;/code&gt;就接到项目里去，本身就使用的&lt;code&gt;drizzle&lt;/code&gt;，在不配置 db adapter 的情况下运行正常，但只要配置就会报错:&lt;/p&gt;
&lt;figure class=&quot;highlight shell&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;4&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;5&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;6&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;7&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;8&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;⨯ Error [TypeError]: Cannot read properties of undefined (reading &amp;#x27;reduce&amp;#x27;)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at &amp;lt;unknown&amp;gt; (.next&#92;server&#92;edge&#92;chunks&#92;edge-wrapper_c7ecd8c0.js:709:27)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at runModuleExecutionHooks (.next&#92;server&#92;edge&#92;chunks&#92;edge-wrapper_c7ecd8c0.js:755:9)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at instantiateModule (.next&#92;server&#92;edge&#92;chunks&#92;edge-wrapper_c7ecd8c0.js:707:9)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at getOrInstantiateModuleFromParent (.next&#92;server&#92;edge&#92;chunks&#92;edge-wrapper_c7ecd8c0.js:640:12)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at esmImport (.next&#92;server&#92;edge&#92;chunks&#92;edge-wrapper_c7ecd8c0.js:143:20)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at [project]/src/db/db.ts [middleware-edge] (ecmascript) (.next&#92;server&#92;edge&#92;chunks&#92;[root of the server]__a687996d._.js:28:218)&lt;/span&gt;&lt;br&gt;&lt;span class=&quot;line&quot;&gt;   at &amp;lt;unknown&amp;gt; (.next&#92;server&#92;edge&#92;chunks&#92;edge-wrapper_c7ecd8c0.js:709:27)&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;

&lt;p&gt;无法启动&lt;/p&gt;</summary>
    
    
    
    
    <category term="drizzle" scheme="https://bingowith.me/tags/drizzle/"/>
    
    <category term="nextjs" scheme="https://bingowith.me/tags/nextjs/"/>
    
    <category term="js" scheme="https://bingowith.me/tags/js/"/>
    
    <category term="auth.js" scheme="https://bingowith.me/tags/auth-js/"/>
    
  </entry>
  
</feed>
