Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tags:
docId: l6eepr5ctjgrhdgupy3twr1t
---

# <https://arxiv.org/pdf/2512.14982>
<https://arxiv.org/pdf/2512.14982>

When not using reasoning, repeating the input prompt improves performance for popular models (Gemini, GPT, Claude, and Deepseek) without increasing the number of generated tokens or latency.

Expand Down
38 changes: 37 additions & 1 deletion lib/source.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
import { docs } from "@/.source";
import { loader } from "fumadocs-core/source";
import { loader, getSlugs } from "fumadocs-core/source";
import { pinyin } from "pinyin-pro";

// 拼音转换工具,仅针对中文部分转换,保留原本的标点和数字
function convertSlugToPinyin(text: string) {
// 核心修复点:Fumadocs 内部生成的 slugs 可能是被 encode 处理过的(%E6%BC...),需要先解码再判断汉字
const decodedText = decodeURIComponent(text);

if (!/[\u4e00-\u9fa5]/.test(decodedText)) return text;

return pinyin(decodedText, {
toneType: "none",
type: "array",
nonZh: "consecutive",
})
.map((t) => t.toLowerCase().replace(/[^a-z0-9]/g, "")) // 进一步清理非字母数字字符
.filter(Boolean)
.join("-");
}

export const source = loader({
baseUrl: "/docs",
source: docs.toFumadocsSource(),
transformers: [
({ storage }) => {
for (const path of storage.getFiles()) {
const file = storage.read(path);
if (
file &&
file.format === "page" &&
path.startsWith("CommunityShare/Leetcode/")
) {
const defaultSlugs = getSlugs(path);
const newSlugs = defaultSlugs.map(convertSlugToPinyin);

// 强制覆盖 Fumadocs-MDX 预生成的 slugs
file.slugs = newSlugs;
}
}
},
],
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"next-auth": "5.0.0-beta.30",
"next-intl": "^4.3.9",
"pg": "^8.18.0",
"pinyin-pro": "^3.28.0",
"react": "19.2.3",
"react-dom": "19.2.3",
"rehype-autolink-headings": "^7.1.0",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading