@astro-minimax/cli 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +7 -2
- package/dist/commands/profile.js.map +1 -1
- package/dist/tools/build-fact-registry.d.ts +14 -0
- package/dist/tools/build-fact-registry.d.ts.map +1 -0
- package/dist/tools/build-fact-registry.js +545 -0
- package/dist/tools/build-fact-registry.js.map +1 -0
- package/package.json +3 -2
- package/template/.gitignore +7 -0
- package/template/datas/fact-registry.json +17 -0
- package/template/eslint.config.js +3 -0
- package/template/functions/api/chat.ts +6 -1
- package/template/package.json +8 -6
- package/template/src/config.ts +6 -2
- package/template/src/data/blog/zh/alerts-examples.md +86 -0
- package/template/src/data/blog/zh/code-examples.md +168 -0
- package/template/src/data/blog/zh/markmap-examples.md +103 -0
- package/template/src/data/blog/zh/math-examples.md +81 -0
- package/template/src/data/blog/zh/mermaid-examples.md +82 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwElE"}
|
package/dist/commands/profile.js
CHANGED
|
@@ -13,15 +13,17 @@ Usage:
|
|
|
13
13
|
astro-minimax profile <subcommand>
|
|
14
14
|
|
|
15
15
|
Subcommands:
|
|
16
|
-
build Build complete author profile (context + voice + report)
|
|
16
|
+
build Build complete author profile (context + voice + facts + report)
|
|
17
17
|
context Build author context from posts
|
|
18
18
|
voice Build writing style profile
|
|
19
|
+
facts Build fact registry for AI accuracy
|
|
19
20
|
report Generate author profile report
|
|
20
21
|
|
|
21
22
|
Description:
|
|
22
23
|
Generates author-related data for AI-powered features:
|
|
23
24
|
- Author context: Writing patterns, topics, expertise
|
|
24
25
|
- Voice profile: Style characteristics for AI responses
|
|
26
|
+
- Fact registry: Verified facts to reduce AI hallucination
|
|
25
27
|
- Profile report: Structured author profile for About page
|
|
26
28
|
|
|
27
29
|
These profiles help the AI chat feature respond in a style
|
|
@@ -31,6 +33,7 @@ Examples:
|
|
|
31
33
|
astro-minimax profile build
|
|
32
34
|
astro-minimax profile context
|
|
33
35
|
astro-minimax profile voice
|
|
36
|
+
astro-minimax profile facts
|
|
34
37
|
astro-minimax profile report
|
|
35
38
|
`);
|
|
36
39
|
return;
|
|
@@ -47,16 +50,18 @@ Examples:
|
|
|
47
50
|
build: [
|
|
48
51
|
"build-author-context.js",
|
|
49
52
|
"build-voice-profile.js",
|
|
53
|
+
"build-fact-registry.js",
|
|
50
54
|
"generate-author-profile.js",
|
|
51
55
|
],
|
|
52
56
|
context: "build-author-context.js",
|
|
53
57
|
voice: "build-voice-profile.js",
|
|
58
|
+
facts: "build-fact-registry.js",
|
|
54
59
|
report: "generate-author-profile.js",
|
|
55
60
|
};
|
|
56
61
|
const scripts = scriptMap[subcommand];
|
|
57
62
|
if (!scripts) {
|
|
58
63
|
console.error(`Unknown subcommand: ${subcommand}`);
|
|
59
|
-
console.error("Available: build, context, voice, report");
|
|
64
|
+
console.error("Available: build, context, voice, facts, report");
|
|
60
65
|
process.exit(1);
|
|
61
66
|
}
|
|
62
67
|
if (Array.isArray(scripts)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM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AAc,EAAE,IAAc,EAAE,GAAW;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE1C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE;YACvD,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAI;YACX,GAAG;SACJ,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;;gBACrB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* 构建事实注册表 (Fact Registry)
|
|
4
|
+
*
|
|
5
|
+
* 从博客内容、作者上下文、AI 摘要等数据中提取可验证的事实,
|
|
6
|
+
* 生成 fact-registry.json 供 AI 对话时注入 Prompt,减少幻觉。
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* pnpm facts:build 构建事实注册表
|
|
10
|
+
* pnpm facts:build --force 强制全量重建
|
|
11
|
+
* pnpm facts:build --verbose 显示详细输出
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=build-fact-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-fact-registry.d.ts","sourceRoot":"","sources":["../../src/tools/build-fact-registry.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* 构建事实注册表 (Fact Registry)
|
|
4
|
+
*
|
|
5
|
+
* 从博客内容、作者上下文、AI 摘要等数据中提取可验证的事实,
|
|
6
|
+
* 生成 fact-registry.json 供 AI 对话时注入 Prompt,减少幻觉。
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* pnpm facts:build 构建事实注册表
|
|
10
|
+
* pnpm facts:build --force 强制全量重建
|
|
11
|
+
* pnpm facts:build --verbose 显示详细输出
|
|
12
|
+
*/
|
|
13
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { loadEnv, readJson, writeJson, truncate, parseCliArgs, DATA_DIR, BLOG_DIR, } from "./lib/utils.js";
|
|
16
|
+
import { extractFrontmatter } from "./lib/frontmatter.js";
|
|
17
|
+
// ─── Constants ────────────────────────────────────────────────
|
|
18
|
+
const OUTPUT_FILE = join(DATA_DIR, "fact-registry.json");
|
|
19
|
+
const SCHEMA_VERSION = 1;
|
|
20
|
+
function parseArgs() {
|
|
21
|
+
return parseCliArgs({ force: false, verbose: false });
|
|
22
|
+
}
|
|
23
|
+
// ─── Fact Builders ────────────────────────────────────────────
|
|
24
|
+
function buildAuthorFacts(ctx, env) {
|
|
25
|
+
const facts = [];
|
|
26
|
+
const profile = ctx.profile;
|
|
27
|
+
const authorName = profile?.name || env.SITE_AUTHOR || "";
|
|
28
|
+
const siteUrl = profile?.siteUrl || env.SITE_URL || "";
|
|
29
|
+
if (authorName) {
|
|
30
|
+
facts.push({
|
|
31
|
+
id: "author-name",
|
|
32
|
+
category: "author",
|
|
33
|
+
statement: `博客作者名为 ${authorName}`,
|
|
34
|
+
evidence: "author-context.json → profile.name",
|
|
35
|
+
source: "explicit",
|
|
36
|
+
confidence: 1.0,
|
|
37
|
+
tags: ["作者", "名字", "author", "name", authorName.toLowerCase()],
|
|
38
|
+
lang: "zh",
|
|
39
|
+
});
|
|
40
|
+
facts.push({
|
|
41
|
+
id: "author-name-en",
|
|
42
|
+
category: "author",
|
|
43
|
+
statement: `The blog author is ${authorName}`,
|
|
44
|
+
evidence: "author-context.json → profile.name",
|
|
45
|
+
source: "explicit",
|
|
46
|
+
confidence: 1.0,
|
|
47
|
+
tags: ["author", "name", authorName.toLowerCase()],
|
|
48
|
+
lang: "en",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (siteUrl) {
|
|
52
|
+
facts.push({
|
|
53
|
+
id: "author-site",
|
|
54
|
+
category: "author",
|
|
55
|
+
statement: `博客网址为 ${siteUrl}`,
|
|
56
|
+
evidence: "author-context.json → profile.siteUrl",
|
|
57
|
+
source: "explicit",
|
|
58
|
+
confidence: 1.0,
|
|
59
|
+
tags: ["网址", "URL", "site", "url", "博客"],
|
|
60
|
+
lang: "zh",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (profile?.description) {
|
|
64
|
+
facts.push({
|
|
65
|
+
id: "author-desc",
|
|
66
|
+
category: "author",
|
|
67
|
+
statement: `博客简介:${truncate(profile.description, 200)}`,
|
|
68
|
+
evidence: "author-context.json → profile.description",
|
|
69
|
+
source: "explicit",
|
|
70
|
+
confidence: 1.0,
|
|
71
|
+
tags: ["简介", "description", "about", "关于"],
|
|
72
|
+
lang: "zh",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return facts;
|
|
76
|
+
}
|
|
77
|
+
function buildBlogStatsFacts(ctx) {
|
|
78
|
+
const facts = [];
|
|
79
|
+
const footprint = ctx.stableFacts?.contentFootprint;
|
|
80
|
+
const posts = ctx.posts ?? [];
|
|
81
|
+
if (footprint) {
|
|
82
|
+
facts.push({
|
|
83
|
+
id: "blog-total-posts",
|
|
84
|
+
category: "blog",
|
|
85
|
+
statement: `博客共有 ${footprint.posts} 篇文章(中文 ${footprint.zhPosts} 篇,英文 ${footprint.enPosts} 篇)`,
|
|
86
|
+
evidence: "author-context.json → stableFacts.contentFootprint",
|
|
87
|
+
source: "derived",
|
|
88
|
+
confidence: 1.0,
|
|
89
|
+
tags: [
|
|
90
|
+
"文章数", "总数", "统计", "多少", "数量",
|
|
91
|
+
"posts", "count", "total", "how many",
|
|
92
|
+
],
|
|
93
|
+
lang: "zh",
|
|
94
|
+
});
|
|
95
|
+
facts.push({
|
|
96
|
+
id: "blog-total-posts-en",
|
|
97
|
+
category: "blog",
|
|
98
|
+
statement: `The blog has ${footprint.posts} posts (${footprint.zhPosts} in Chinese, ${footprint.enPosts} in English)`,
|
|
99
|
+
evidence: "author-context.json → stableFacts.contentFootprint",
|
|
100
|
+
source: "derived",
|
|
101
|
+
confidence: 1.0,
|
|
102
|
+
tags: ["posts", "count", "total", "how many", "statistics"],
|
|
103
|
+
lang: "en",
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else if (posts.length) {
|
|
107
|
+
facts.push({
|
|
108
|
+
id: "blog-total-posts",
|
|
109
|
+
category: "blog",
|
|
110
|
+
statement: `博客共有 ${posts.length} 篇文章`,
|
|
111
|
+
evidence: `author-context.json → posts.length (${posts.length})`,
|
|
112
|
+
source: "derived",
|
|
113
|
+
confidence: 1.0,
|
|
114
|
+
tags: ["文章数", "总数", "统计", "多少", "数量", "posts", "count"],
|
|
115
|
+
lang: "zh",
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// Categories
|
|
119
|
+
const categories = ctx.stableFacts?.focusAreas;
|
|
120
|
+
if (categories?.length) {
|
|
121
|
+
facts.push({
|
|
122
|
+
id: "blog-categories",
|
|
123
|
+
category: "blog",
|
|
124
|
+
statement: `博客的主要分类包括:${categories.join("、")}`,
|
|
125
|
+
evidence: "author-context.json → stableFacts.focusAreas",
|
|
126
|
+
source: "derived",
|
|
127
|
+
confidence: 0.95,
|
|
128
|
+
tags: [
|
|
129
|
+
"分类", "类别", "领域", "方向",
|
|
130
|
+
"category", "area", "focus",
|
|
131
|
+
...categories.map((c) => c.toLowerCase()),
|
|
132
|
+
],
|
|
133
|
+
lang: "zh",
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// Top tags
|
|
137
|
+
const topTags = ctx.stableFacts?.topTags;
|
|
138
|
+
if (topTags?.length) {
|
|
139
|
+
facts.push({
|
|
140
|
+
id: "blog-top-tags",
|
|
141
|
+
category: "blog",
|
|
142
|
+
statement: `博客最常用的标签有:${topTags.slice(0, 10).join("、")}`,
|
|
143
|
+
evidence: "author-context.json → stableFacts.topTags",
|
|
144
|
+
source: "derived",
|
|
145
|
+
confidence: 0.9,
|
|
146
|
+
tags: [
|
|
147
|
+
"标签", "tag", "topic", "主题",
|
|
148
|
+
...topTags.slice(0, 10).map((t) => t.toLowerCase()),
|
|
149
|
+
],
|
|
150
|
+
lang: "zh",
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
// Recurring topics
|
|
154
|
+
const topics = ctx.stableFacts?.recurringTopics;
|
|
155
|
+
if (topics?.length) {
|
|
156
|
+
facts.push({
|
|
157
|
+
id: "blog-recurring-topics",
|
|
158
|
+
category: "blog",
|
|
159
|
+
statement: `博客反复讨论的技术话题包括:${topics.slice(0, 8).join("、")}`,
|
|
160
|
+
evidence: "author-context.json → stableFacts.recurringTopics",
|
|
161
|
+
source: "aggregated",
|
|
162
|
+
confidence: 0.85,
|
|
163
|
+
tags: [
|
|
164
|
+
"话题", "主题", "讨论", "topic", "recurring",
|
|
165
|
+
...topics.slice(0, 8).map((t) => t.toLowerCase()),
|
|
166
|
+
],
|
|
167
|
+
lang: "zh",
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// Date range
|
|
171
|
+
if (posts.length >= 2) {
|
|
172
|
+
const sorted = [...posts].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime());
|
|
173
|
+
const oldest = sorted[0];
|
|
174
|
+
const newest = sorted[sorted.length - 1];
|
|
175
|
+
const oldDate = new Date(oldest.date).toISOString().slice(0, 10);
|
|
176
|
+
const newDate = new Date(newest.date).toISOString().slice(0, 10);
|
|
177
|
+
facts.push({
|
|
178
|
+
id: "blog-date-range",
|
|
179
|
+
category: "blog",
|
|
180
|
+
statement: `博客的文章时间跨度从 ${oldDate} 到 ${newDate}`,
|
|
181
|
+
evidence: `earliest: ${oldest.title} (${oldDate}), latest: ${newest.title} (${newDate})`,
|
|
182
|
+
source: "derived",
|
|
183
|
+
confidence: 1.0,
|
|
184
|
+
tags: ["时间", "日期", "最早", "最新", "date", "range", "when"],
|
|
185
|
+
lang: "zh",
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// Language distribution
|
|
189
|
+
if (posts.length) {
|
|
190
|
+
const langs = new Map();
|
|
191
|
+
for (const p of posts) {
|
|
192
|
+
langs.set(p.lang, (langs.get(p.lang) || 0) + 1);
|
|
193
|
+
}
|
|
194
|
+
if (langs.size > 1) {
|
|
195
|
+
const desc = [...langs.entries()]
|
|
196
|
+
.sort((a, b) => b[1] - a[1])
|
|
197
|
+
.map(([lang, count]) => `${lang === "zh" ? "中文" : "英文"} ${count} 篇`)
|
|
198
|
+
.join(",");
|
|
199
|
+
facts.push({
|
|
200
|
+
id: "blog-lang-dist",
|
|
201
|
+
category: "blog",
|
|
202
|
+
statement: `博客文章的语言分布:${desc}`,
|
|
203
|
+
evidence: "author-context.json → posts[].lang aggregation",
|
|
204
|
+
source: "derived",
|
|
205
|
+
confidence: 1.0,
|
|
206
|
+
tags: ["语言", "中文", "英文", "language", "chinese", "english"],
|
|
207
|
+
lang: "zh",
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return facts;
|
|
212
|
+
}
|
|
213
|
+
function buildContentFacts(ctx) {
|
|
214
|
+
const facts = [];
|
|
215
|
+
const posts = ctx.posts ?? [];
|
|
216
|
+
// Category distribution with counts
|
|
217
|
+
const catCounts = new Map();
|
|
218
|
+
for (const p of posts) {
|
|
219
|
+
if (p.category) {
|
|
220
|
+
catCounts.set(p.category, (catCounts.get(p.category) || 0) + 1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (catCounts.size > 0) {
|
|
224
|
+
const desc = [...catCounts.entries()]
|
|
225
|
+
.sort((a, b) => b[1] - a[1])
|
|
226
|
+
.map(([cat, count]) => `${cat}(${count}篇)`)
|
|
227
|
+
.join("、");
|
|
228
|
+
facts.push({
|
|
229
|
+
id: "content-category-dist",
|
|
230
|
+
category: "content",
|
|
231
|
+
statement: `按分类统计:${desc}`,
|
|
232
|
+
evidence: "author-context.json → posts[].category aggregation",
|
|
233
|
+
source: "derived",
|
|
234
|
+
confidence: 1.0,
|
|
235
|
+
tags: ["分类", "统计", "category", "distribution"],
|
|
236
|
+
lang: "zh",
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
// Flagship/latest posts
|
|
240
|
+
const flagship = ctx.stableFacts?.flagshipPosts;
|
|
241
|
+
if (flagship?.length) {
|
|
242
|
+
const desc = flagship
|
|
243
|
+
.map((p) => `《${p.title}》(${new Date(p.date).toISOString().slice(0, 10)})`)
|
|
244
|
+
.join("、");
|
|
245
|
+
facts.push({
|
|
246
|
+
id: "content-flagship",
|
|
247
|
+
category: "content",
|
|
248
|
+
statement: `最新的代表性文章:${desc}`,
|
|
249
|
+
evidence: "author-context.json → stableFacts.flagshipPosts",
|
|
250
|
+
source: "derived",
|
|
251
|
+
confidence: 0.95,
|
|
252
|
+
tags: ["最新", "代表", "推荐", "latest", "recent", "flagship"],
|
|
253
|
+
lang: "zh",
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return facts;
|
|
257
|
+
}
|
|
258
|
+
async function buildTechStackFacts() {
|
|
259
|
+
const facts = [];
|
|
260
|
+
// Try to detect tech stack from config files
|
|
261
|
+
try {
|
|
262
|
+
const pkgRaw = await readFile(join(process.cwd(), "package.json"), "utf-8");
|
|
263
|
+
const pkg = JSON.parse(pkgRaw);
|
|
264
|
+
const allDeps = {
|
|
265
|
+
...(pkg.dependencies ?? {}),
|
|
266
|
+
...(pkg.devDependencies ?? {}),
|
|
267
|
+
};
|
|
268
|
+
const techStack = [];
|
|
269
|
+
const techTags = [];
|
|
270
|
+
if (allDeps.astro) {
|
|
271
|
+
techStack.push(`Astro ${allDeps.astro.replace(/[^0-9.]/g, "")}`);
|
|
272
|
+
techTags.push("astro");
|
|
273
|
+
}
|
|
274
|
+
if (allDeps.preact || allDeps.react) {
|
|
275
|
+
const framework = allDeps.preact ? "Preact" : "React";
|
|
276
|
+
techStack.push(framework);
|
|
277
|
+
techTags.push(framework.toLowerCase());
|
|
278
|
+
}
|
|
279
|
+
if (allDeps.tailwindcss || allDeps["@tailwindcss/vite"]) {
|
|
280
|
+
techStack.push("Tailwind CSS");
|
|
281
|
+
techTags.push("tailwindcss", "tailwind");
|
|
282
|
+
}
|
|
283
|
+
if (allDeps.typescript) {
|
|
284
|
+
techStack.push("TypeScript");
|
|
285
|
+
techTags.push("typescript", "ts");
|
|
286
|
+
}
|
|
287
|
+
// Check for AI-related deps
|
|
288
|
+
if (allDeps["@astro-minimax/ai"]) {
|
|
289
|
+
techTags.push("ai", "rag", "llm");
|
|
290
|
+
}
|
|
291
|
+
if (techStack.length > 0) {
|
|
292
|
+
const zhStack = allDeps["@astro-minimax/ai"]
|
|
293
|
+
? [...techStack, "AI 对话(RAG)"]
|
|
294
|
+
: techStack;
|
|
295
|
+
const enStack = allDeps["@astro-minimax/ai"]
|
|
296
|
+
? [...techStack, "AI Chat (RAG)"]
|
|
297
|
+
: techStack;
|
|
298
|
+
facts.push({
|
|
299
|
+
id: "tech-stack",
|
|
300
|
+
category: "tech",
|
|
301
|
+
statement: `博客使用的技术栈包括:${zhStack.join("、")}`,
|
|
302
|
+
evidence: "package.json → dependencies + devDependencies",
|
|
303
|
+
source: "explicit",
|
|
304
|
+
confidence: 1.0,
|
|
305
|
+
tags: [
|
|
306
|
+
"技术栈", "技术", "框架", "工具",
|
|
307
|
+
"tech", "stack", "framework",
|
|
308
|
+
...techTags,
|
|
309
|
+
],
|
|
310
|
+
lang: "zh",
|
|
311
|
+
});
|
|
312
|
+
facts.push({
|
|
313
|
+
id: "tech-stack-en",
|
|
314
|
+
category: "tech",
|
|
315
|
+
statement: `The blog is built with: ${enStack.join(", ")}`,
|
|
316
|
+
evidence: "package.json → dependencies + devDependencies",
|
|
317
|
+
source: "explicit",
|
|
318
|
+
confidence: 1.0,
|
|
319
|
+
tags: ["tech", "stack", "framework", "built with", ...techTags],
|
|
320
|
+
lang: "en",
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
// package.json not found or unreadable
|
|
326
|
+
}
|
|
327
|
+
return facts;
|
|
328
|
+
}
|
|
329
|
+
function buildSummaryDerivedFacts(summaries) {
|
|
330
|
+
const facts = [];
|
|
331
|
+
const articles = summaries.articles ?? {};
|
|
332
|
+
const entries = Object.entries(articles);
|
|
333
|
+
if (!entries.length)
|
|
334
|
+
return facts;
|
|
335
|
+
// Aggregate all tags from AI summaries
|
|
336
|
+
const tagCounts = new Map();
|
|
337
|
+
for (const [, entry] of entries) {
|
|
338
|
+
for (const tag of entry.data?.tags ?? []) {
|
|
339
|
+
tagCounts.set(tag, (tagCounts.get(tag) || 0) + 1);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (tagCounts.size > 0) {
|
|
343
|
+
const topAiTags = [...tagCounts.entries()]
|
|
344
|
+
.sort((a, b) => b[1] - a[1])
|
|
345
|
+
.slice(0, 15)
|
|
346
|
+
.map(([tag]) => tag);
|
|
347
|
+
facts.push({
|
|
348
|
+
id: "content-ai-tags",
|
|
349
|
+
category: "content",
|
|
350
|
+
statement: `AI 分析得出的高频主题标签:${topAiTags.join("、")}`,
|
|
351
|
+
evidence: `ai-summaries.json → ${entries.length} articles aggregated tags`,
|
|
352
|
+
source: "aggregated",
|
|
353
|
+
confidence: 0.85,
|
|
354
|
+
tags: [
|
|
355
|
+
"标签", "主题", "AI", "tag", "topic",
|
|
356
|
+
...topAiTags.map((t) => t.toLowerCase()),
|
|
357
|
+
],
|
|
358
|
+
lang: "zh",
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
// Extract highly recurring key points
|
|
362
|
+
const keyPointCounts = new Map();
|
|
363
|
+
for (const [, entry] of entries) {
|
|
364
|
+
for (const kp of entry.data?.keyPoints ?? []) {
|
|
365
|
+
const normalized = kp.trim().toLowerCase();
|
|
366
|
+
if (normalized.length >= 10) {
|
|
367
|
+
keyPointCounts.set(normalized, (keyPointCounts.get(normalized) || 0) + 1);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const recurringKPs = [...keyPointCounts.entries()]
|
|
372
|
+
.filter(([, count]) => count >= 2)
|
|
373
|
+
.sort((a, b) => b[1] - a[1])
|
|
374
|
+
.slice(0, 5);
|
|
375
|
+
if (recurringKPs.length) {
|
|
376
|
+
const desc = recurringKPs.map(([kp]) => truncate(kp, 60)).join(";");
|
|
377
|
+
facts.push({
|
|
378
|
+
id: "content-recurring-kp",
|
|
379
|
+
category: "content",
|
|
380
|
+
statement: `在多篇文章中反复出现的要点:${desc}`,
|
|
381
|
+
evidence: `ai-summaries.json → keyPoints cross-article aggregation`,
|
|
382
|
+
source: "aggregated",
|
|
383
|
+
confidence: 0.8,
|
|
384
|
+
tags: ["要点", "核心", "反复", "key point", "recurring"],
|
|
385
|
+
lang: "zh",
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
return facts;
|
|
389
|
+
}
|
|
390
|
+
// ─── Article-level Fact Extraction ────────────────────────────
|
|
391
|
+
async function buildArticleFacts() {
|
|
392
|
+
const facts = [];
|
|
393
|
+
try {
|
|
394
|
+
const files = await collectMarkdownFiles(BLOG_DIR);
|
|
395
|
+
// Extract facts about explicitly mentioned technologies from frontmatter tags
|
|
396
|
+
const explicitTechMentions = new Map();
|
|
397
|
+
for (const filePath of files) {
|
|
398
|
+
const raw = await readFile(filePath, "utf-8");
|
|
399
|
+
const fm = extractFrontmatter(raw);
|
|
400
|
+
if (fm.data.draft)
|
|
401
|
+
continue;
|
|
402
|
+
const tags = Array.isArray(fm.data.tags) ? fm.data.tags : [];
|
|
403
|
+
for (const tag of tags) {
|
|
404
|
+
explicitTechMentions.set(tag, (explicitTechMentions.get(tag) || 0) + 1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
// Top mentioned technologies from tags
|
|
408
|
+
const topMentions = [...explicitTechMentions.entries()]
|
|
409
|
+
.filter(([, count]) => count >= 3)
|
|
410
|
+
.sort((a, b) => b[1] - a[1])
|
|
411
|
+
.slice(0, 10);
|
|
412
|
+
if (topMentions.length) {
|
|
413
|
+
const desc = topMentions
|
|
414
|
+
.map(([tech, count]) => `${tech}(${count}次)`)
|
|
415
|
+
.join("、");
|
|
416
|
+
facts.push({
|
|
417
|
+
id: "content-tech-mentions",
|
|
418
|
+
category: "content",
|
|
419
|
+
statement: `文章中高频提及的技术/话题(按标签统计):${desc}`,
|
|
420
|
+
evidence: `${files.length} markdown files → frontmatter.tags aggregation`,
|
|
421
|
+
source: "aggregated",
|
|
422
|
+
confidence: 0.9,
|
|
423
|
+
tags: [
|
|
424
|
+
"技术", "提及", "频率", "tech", "mention",
|
|
425
|
+
...topMentions.map(([t]) => t.toLowerCase()),
|
|
426
|
+
],
|
|
427
|
+
lang: "zh",
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
catch {
|
|
432
|
+
// BLOG_DIR doesn't exist or is unreadable
|
|
433
|
+
}
|
|
434
|
+
return facts;
|
|
435
|
+
}
|
|
436
|
+
async function collectMarkdownFiles(dir) {
|
|
437
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
438
|
+
const files = [];
|
|
439
|
+
for (const entry of entries) {
|
|
440
|
+
const fullPath = join(dir, entry.name);
|
|
441
|
+
if (entry.isDirectory() && !entry.name.startsWith("_")) {
|
|
442
|
+
files.push(...(await collectMarkdownFiles(fullPath)));
|
|
443
|
+
}
|
|
444
|
+
else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
445
|
+
files.push(fullPath);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return files;
|
|
449
|
+
}
|
|
450
|
+
// ─── Stats Computation ────────────────────────────────────────
|
|
451
|
+
function computeStats(facts) {
|
|
452
|
+
const byCategory = {
|
|
453
|
+
author: 0,
|
|
454
|
+
blog: 0,
|
|
455
|
+
content: 0,
|
|
456
|
+
project: 0,
|
|
457
|
+
tech: 0,
|
|
458
|
+
};
|
|
459
|
+
let totalConfidence = 0;
|
|
460
|
+
for (const fact of facts) {
|
|
461
|
+
byCategory[fact.category]++;
|
|
462
|
+
totalConfidence += fact.confidence;
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
total: facts.length,
|
|
466
|
+
byCategory,
|
|
467
|
+
avgConfidence: facts.length > 0 ? +(totalConfidence / facts.length).toFixed(3) : 0,
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
// ─── Main ─────────────────────────────────────────────────────
|
|
471
|
+
async function main() {
|
|
472
|
+
const args = parseArgs();
|
|
473
|
+
await loadEnv();
|
|
474
|
+
console.log("📊 构建事实注册表 (Fact Registry)");
|
|
475
|
+
console.log("━".repeat(50));
|
|
476
|
+
// Load existing data sources
|
|
477
|
+
const authorContext = await readJson(join(DATA_DIR, "author-context.json"), {});
|
|
478
|
+
const aiSummaries = await readJson(join(DATA_DIR, "ai-summaries.json"), {});
|
|
479
|
+
const voiceProfile = await readJson(join(DATA_DIR, "voice-profile.json"), {});
|
|
480
|
+
const hasAuthorContext = !!authorContext.profile;
|
|
481
|
+
const hasSummaries = !!aiSummaries.articles && Object.keys(aiSummaries.articles).length > 0;
|
|
482
|
+
console.log(`\n📂 数据源检测:`);
|
|
483
|
+
console.log(` author-context.json: ${hasAuthorContext ? "✅" : "❌ (缺失)"}`);
|
|
484
|
+
console.log(` ai-summaries.json: ${hasSummaries ? `✅ (${Object.keys(aiSummaries.articles ?? {}).length} 篇)` : "❌ (缺失)"}`);
|
|
485
|
+
console.log(` voice-profile.json: ${voiceProfile.tone ? "✅" : "⚠️ (部分)"}`);
|
|
486
|
+
// Build facts from all sources
|
|
487
|
+
console.log("\n🔍 提取事实...");
|
|
488
|
+
const allFacts = [];
|
|
489
|
+
// Author facts
|
|
490
|
+
const authorFacts = buildAuthorFacts(authorContext, process.env);
|
|
491
|
+
allFacts.push(...authorFacts);
|
|
492
|
+
if (args.verbose)
|
|
493
|
+
console.log(` 作者事实: ${authorFacts.length} 条`);
|
|
494
|
+
// Blog stats facts
|
|
495
|
+
const blogFacts = buildBlogStatsFacts(authorContext);
|
|
496
|
+
allFacts.push(...blogFacts);
|
|
497
|
+
if (args.verbose)
|
|
498
|
+
console.log(` 博客统计: ${blogFacts.length} 条`);
|
|
499
|
+
// Content facts
|
|
500
|
+
const contentFacts = buildContentFacts(authorContext);
|
|
501
|
+
allFacts.push(...contentFacts);
|
|
502
|
+
if (args.verbose)
|
|
503
|
+
console.log(` 内容事实: ${contentFacts.length} 条`);
|
|
504
|
+
// Tech stack facts
|
|
505
|
+
const techFacts = await buildTechStackFacts();
|
|
506
|
+
allFacts.push(...techFacts);
|
|
507
|
+
if (args.verbose)
|
|
508
|
+
console.log(` 技术栈: ${techFacts.length} 条`);
|
|
509
|
+
// Summary-derived facts
|
|
510
|
+
const summaryFacts = buildSummaryDerivedFacts(aiSummaries);
|
|
511
|
+
allFacts.push(...summaryFacts);
|
|
512
|
+
if (args.verbose)
|
|
513
|
+
console.log(` 摘要衍生: ${summaryFacts.length} 条`);
|
|
514
|
+
// Article-level facts
|
|
515
|
+
const articleFacts = await buildArticleFacts();
|
|
516
|
+
allFacts.push(...articleFacts);
|
|
517
|
+
if (args.verbose)
|
|
518
|
+
console.log(` 文章分析: ${articleFacts.length} 条`);
|
|
519
|
+
// Compute stats
|
|
520
|
+
const stats = computeStats(allFacts);
|
|
521
|
+
// Write output
|
|
522
|
+
const output = {
|
|
523
|
+
$schema: "fact-registry-v1",
|
|
524
|
+
generatedAt: new Date().toISOString(),
|
|
525
|
+
version: SCHEMA_VERSION,
|
|
526
|
+
facts: allFacts,
|
|
527
|
+
stats,
|
|
528
|
+
};
|
|
529
|
+
await writeJson(OUTPUT_FILE, output);
|
|
530
|
+
console.log(`\n✅ 事实注册表构建完成`);
|
|
531
|
+
console.log(`📄 输出文件: ${OUTPUT_FILE}`);
|
|
532
|
+
console.log(`\n📊 统计:`);
|
|
533
|
+
console.log(` 总事实数: ${stats.total}`);
|
|
534
|
+
console.log(` 平均置信度: ${stats.avgConfidence}`);
|
|
535
|
+
console.log(` 按分类:`);
|
|
536
|
+
for (const [cat, count] of Object.entries(stats.byCategory)) {
|
|
537
|
+
if (count > 0)
|
|
538
|
+
console.log(` ${cat}: ${count}`);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
main().catch((error) => {
|
|
542
|
+
console.error("❌ 构建失败:", error.message);
|
|
543
|
+
process.exit(1);
|
|
544
|
+
});
|
|
545
|
+
//# sourceMappingURL=build-fact-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-fact-registry.js","sourceRoot":"","sources":["../../src/tools/build-fact-registry.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AA2D1D,iEAAiE;AAEjE,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AACzD,MAAM,cAAc,GAAG,CAAC,CAAC;AASzB,SAAS,SAAS;IAChB,OAAO,YAAY,CAAC,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KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astro-minimax/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool for astro-minimax blog — create blogs, manage content, and process data with AI.",
|
|
6
6
|
"author": "Souloss",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist/",
|
|
29
|
-
"template/"
|
|
29
|
+
"template/",
|
|
30
|
+
"template/.gitignore"
|
|
30
31
|
],
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"tsx": "^4.21.0",
|
|
@@ -4,6 +4,11 @@ import type { ChatHandlerEnv } from '@astro-minimax/ai/server';
|
|
|
4
4
|
import aiSummaries from '../../datas/ai-summaries.json';
|
|
5
5
|
import authorContext from '../../datas/author-context.json';
|
|
6
6
|
import voiceProfile from '../../datas/voice-profile.json';
|
|
7
|
+
import factRegistry from '../../datas/fact-registry.json';
|
|
8
|
+
|
|
9
|
+
// Optional: TF-IDF vector index for enhanced search reranking
|
|
10
|
+
let vectorIndex: unknown = null;
|
|
11
|
+
try { vectorIndex = (await import('../../src/data/vectors/index.json')).default; } catch { /* not available */ }
|
|
7
12
|
|
|
8
13
|
interface FunctionEnv extends ChatHandlerEnv {
|
|
9
14
|
CACHE_KV?: KVNamespace;
|
|
@@ -13,7 +18,7 @@ interface FunctionEnv extends ChatHandlerEnv {
|
|
|
13
18
|
|
|
14
19
|
export const onRequest: PagesFunction<FunctionEnv> = async (context) => {
|
|
15
20
|
initializeMetadata(
|
|
16
|
-
{ summaries: aiSummaries, authorContext, voiceProfile },
|
|
21
|
+
{ summaries: aiSummaries, authorContext, voiceProfile, factRegistry, vectorIndex },
|
|
17
22
|
context.env,
|
|
18
23
|
);
|
|
19
24
|
return handleChatRequest({
|
package/template/package.json
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "astro dev",
|
|
6
|
+
"dev": "concurrently -n \"astro,ai\" -c \"blue,green\" \"astro dev\" \"pnpm exec astro-ai-dev\"",
|
|
7
|
+
"dev:astro": "astro dev",
|
|
7
8
|
"dev:ai": "pnpm exec astro-ai-dev",
|
|
8
9
|
"build": "astro check && astro build && pagefind --site dist && cp -r dist/pagefind public/",
|
|
9
10
|
"preview": "wrangler pages dev dist",
|
|
@@ -27,10 +28,10 @@
|
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@ai-sdk/openai-compatible": "^2.0.35",
|
|
29
30
|
"@ai-sdk/react": "^3.0.118",
|
|
30
|
-
"@astro-minimax/ai": "^0.
|
|
31
|
-
"@astro-minimax/core": "^0.
|
|
32
|
-
"@astro-minimax/notify": "^0.
|
|
33
|
-
"@astro-minimax/viz": "^0.
|
|
31
|
+
"@astro-minimax/ai": "^0.7.2",
|
|
32
|
+
"@astro-minimax/core": "^0.7.2",
|
|
33
|
+
"@astro-minimax/notify": "^0.7.2",
|
|
34
|
+
"@astro-minimax/viz": "^0.7.2",
|
|
34
35
|
"@astrojs/mdx": "^5.0.0",
|
|
35
36
|
"@astrojs/preact": "^5.0.0",
|
|
36
37
|
"@astrojs/rss": "^4.0.17",
|
|
@@ -57,12 +58,13 @@
|
|
|
57
58
|
"tailwindcss": "^4.2.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@astro-minimax/cli": "^0.
|
|
61
|
+
"@astro-minimax/cli": "^0.7.2",
|
|
61
62
|
"@astrojs/check": "^0.9.6",
|
|
62
63
|
"@cloudflare/workers-types": "^4.20260313.1",
|
|
63
64
|
"@pagefind/default-ui": "^1.4.0",
|
|
64
65
|
"@shikijs/transformers": "^4.0.2",
|
|
65
66
|
"@types/lodash.kebabcase": "^4.1.9",
|
|
67
|
+
"concurrently": "^9.1.2",
|
|
66
68
|
"eslint": "^9.39.3",
|
|
67
69
|
"eslint-plugin-astro": "^1.6.0",
|
|
68
70
|
"globals": "^16.5.0",
|
package/template/src/config.ts
CHANGED
|
@@ -36,9 +36,9 @@ export const SITE: SiteConfig = {
|
|
|
36
36
|
{ key: "tags", enabled: true },
|
|
37
37
|
{ key: "categories", enabled: true },
|
|
38
38
|
{ key: "series", enabled: true },
|
|
39
|
-
{ key: "projects", enabled:
|
|
39
|
+
{ key: "projects", enabled: false }, // Matches features.projects
|
|
40
40
|
{ key: "about", enabled: true },
|
|
41
|
-
{ key: "friends", enabled:
|
|
41
|
+
{ key: "friends", enabled: false }, // Matches features.friends
|
|
42
42
|
{ key: "archives", enabled: true },
|
|
43
43
|
],
|
|
44
44
|
},
|
|
@@ -112,4 +112,8 @@ export const SITE: SiteConfig = {
|
|
|
112
112
|
get showArchives() {
|
|
113
113
|
return this.features?.archives ?? true;
|
|
114
114
|
},
|
|
115
|
+
|
|
116
|
+
get aiEnabled() {
|
|
117
|
+
return (this.features?.ai ?? false) && (this.ai?.enabled ?? false);
|
|
118
|
+
},
|
|
115
119
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "GitHub Alerts 示例"
|
|
3
|
+
description: "展示 GitHub 风格的提示框功能,支持多种类型"
|
|
4
|
+
pubDatetime: 2024-01-06T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 什么是 GitHub Alerts?
|
|
10
|
+
|
|
11
|
+
GitHub Alerts 是 GitHub 风格的提示框,可以用来强调重要信息、警告或提示。
|
|
12
|
+
|
|
13
|
+
## 基础用法
|
|
14
|
+
|
|
15
|
+
> [!NOTE]
|
|
16
|
+
> 这是一个普通的提示信息,用于补充说明。
|
|
17
|
+
|
|
18
|
+
> [!TIP]
|
|
19
|
+
> 这是一个小技巧,可以帮助用户更好地使用某些功能。
|
|
20
|
+
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> 这是重要信息,用户应该特别注意。
|
|
23
|
+
|
|
24
|
+
> [!WARNING]
|
|
25
|
+
> 这是警告信息,提醒用户注意潜在的风险。
|
|
26
|
+
|
|
27
|
+
> [!CAUTION]
|
|
28
|
+
> 这是危险警告,提醒用户可能造成不可逆的操作。
|
|
29
|
+
|
|
30
|
+
## 实际使用场景
|
|
31
|
+
|
|
32
|
+
### 配置说明
|
|
33
|
+
|
|
34
|
+
> [!NOTE]
|
|
35
|
+
> 请确保在运行前配置好 `.env` 文件中的环境变量。
|
|
36
|
+
|
|
37
|
+
### 性能优化
|
|
38
|
+
|
|
39
|
+
> [!TIP]
|
|
40
|
+
> 使用 `pnpm` 替代 `npm` 可以显著提高依赖安装速度并节省磁盘空间。
|
|
41
|
+
|
|
42
|
+
### 安全提醒
|
|
43
|
+
|
|
44
|
+
> [!IMPORTANT]
|
|
45
|
+
> 永远不要将 API 密钥或敏感信息提交到公开的代码仓库中。
|
|
46
|
+
|
|
47
|
+
### 废弃警告
|
|
48
|
+
|
|
49
|
+
> [!WARNING]
|
|
50
|
+
> `v1.0.0` 版本中的 `oldFunction()` 方法将在下个版本中移除,请迁移到 `newFunction()`。
|
|
51
|
+
|
|
52
|
+
### 危险操作
|
|
53
|
+
|
|
54
|
+
> [!CAUTION]
|
|
55
|
+
> 执行 `rm -rf /` 将删除所有文件,这是一个不可逆的操作,请谨慎使用!
|
|
56
|
+
|
|
57
|
+
## 组合使用
|
|
58
|
+
|
|
59
|
+
在编写文档时,可以根据信息的严重程度选择合适的提示框类型:
|
|
60
|
+
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> 本项目需要 Node.js 18+ 版本。
|
|
63
|
+
|
|
64
|
+
> [!TIP]
|
|
65
|
+
> 推荐使用 `nvm` 管理 Node.js 版本。
|
|
66
|
+
|
|
67
|
+
> [!IMPORTANT]
|
|
68
|
+
> 在生产环境中,请确保设置 `NODE_ENV=production`。
|
|
69
|
+
|
|
70
|
+
> [!WARNING]
|
|
71
|
+
> 不要在生产环境中使用开发依赖。
|
|
72
|
+
|
|
73
|
+
> [!CAUTION]
|
|
74
|
+
> 修改数据库结构前请务必备份数据!
|
|
75
|
+
|
|
76
|
+
## 与其他 Markdown 元素组合
|
|
77
|
+
|
|
78
|
+
> [!TIP]
|
|
79
|
+
> 你可以在提示框中使用 **加粗**、*斜体*、`代码` 等 Markdown 格式。
|
|
80
|
+
>
|
|
81
|
+
> 甚至可以添加列表:
|
|
82
|
+
> - 第一项
|
|
83
|
+
> - 第二项
|
|
84
|
+
> - 第三项
|
|
85
|
+
|
|
86
|
+
GitHub Alerts 让文档更加清晰易读!
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "代码高亮示例"
|
|
3
|
+
description: "展示 Shiki 代码高亮功能,支持多种编程语言和高级特性"
|
|
4
|
+
pubDatetime: 2024-01-05T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- 代码
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 基础代码块
|
|
11
|
+
|
|
12
|
+
### TypeScript
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
interface User {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
email: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function fetchUser(id: number): Promise<User> {
|
|
22
|
+
const response = await fetch(`/api/users/${id}`);
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
throw new Error('Failed to fetch user');
|
|
25
|
+
}
|
|
26
|
+
return response.json();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 使用示例
|
|
30
|
+
const user = await fetchUser(1);
|
|
31
|
+
console.log(`Hello, ${user.name}!`);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Python
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from typing import List, Optional
|
|
38
|
+
|
|
39
|
+
class Calculator:
|
|
40
|
+
"""一个简单的计算器类"""
|
|
41
|
+
|
|
42
|
+
def __init__(self, initial_value: float = 0):
|
|
43
|
+
self.value = initial_value
|
|
44
|
+
|
|
45
|
+
def add(self, x: float) -> 'Calculator':
|
|
46
|
+
self.value += x
|
|
47
|
+
return self
|
|
48
|
+
|
|
49
|
+
def multiply(self, x: float) -> 'Calculator':
|
|
50
|
+
self.value *= x
|
|
51
|
+
return self
|
|
52
|
+
|
|
53
|
+
# 链式调用
|
|
54
|
+
result = Calculator(10).add(5).multiply(2).value
|
|
55
|
+
print(f"Result: {result}") # Result: 30.0
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Rust
|
|
59
|
+
|
|
60
|
+
```rust
|
|
61
|
+
use std::collections::HashMap;
|
|
62
|
+
|
|
63
|
+
fn main() {
|
|
64
|
+
let mut scores = HashMap::new();
|
|
65
|
+
|
|
66
|
+
scores.insert("Alice", 95);
|
|
67
|
+
scores.insert("Bob", 87);
|
|
68
|
+
scores.insert("Charlie", 92);
|
|
69
|
+
|
|
70
|
+
for (name, score) in &scores {
|
|
71
|
+
println!("{}: {}", name, score);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 高级特性
|
|
77
|
+
|
|
78
|
+
### 代码标题
|
|
79
|
+
|
|
80
|
+
```typescript title="utils/date.ts"
|
|
81
|
+
export function formatDate(date: Date): string {
|
|
82
|
+
return new Intl.DateTimeFormat('zh-CN', {
|
|
83
|
+
year: 'numeric',
|
|
84
|
+
month: 'long',
|
|
85
|
+
day: 'numeric',
|
|
86
|
+
}).format(date);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 行号显示
|
|
91
|
+
|
|
92
|
+
```typescript showLineNumbers
|
|
93
|
+
function fibonacci(n: number): number {
|
|
94
|
+
if (n <= 1) return n;
|
|
95
|
+
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 计算前 10 个斐波那契数
|
|
99
|
+
for (let i = 0; i < 10; i++) {
|
|
100
|
+
console.log(fibonacci(i));
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 代码差异高亮
|
|
105
|
+
|
|
106
|
+
```diff
|
|
107
|
+
function calculateTotal(items: CartItem[]): number {
|
|
108
|
+
- return items.reduce((sum, item) => sum + item.price, 0);
|
|
109
|
+
+ return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 行高亮
|
|
114
|
+
|
|
115
|
+
```typescript {2,5-7}
|
|
116
|
+
function processUser(user: User) {
|
|
117
|
+
const validated = validateUser(user); // 高亮
|
|
118
|
+
if (!validated) {
|
|
119
|
+
throw new Error('Invalid user');
|
|
120
|
+
}
|
|
121
|
+
saveToDatabase(user); // 高亮
|
|
122
|
+
sendNotification(user); // 高亮
|
|
123
|
+
return user;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 复制按钮
|
|
128
|
+
|
|
129
|
+
所有代码块都支持一键复制功能,点击右上角的复制按钮即可。
|
|
130
|
+
|
|
131
|
+
## 更多语言示例
|
|
132
|
+
|
|
133
|
+
### Go
|
|
134
|
+
|
|
135
|
+
```go
|
|
136
|
+
package main
|
|
137
|
+
|
|
138
|
+
import "fmt"
|
|
139
|
+
|
|
140
|
+
func main() {
|
|
141
|
+
messages := make(chan string)
|
|
142
|
+
|
|
143
|
+
go func() {
|
|
144
|
+
messages <- "Hello, World!"
|
|
145
|
+
}()
|
|
146
|
+
|
|
147
|
+
msg := <-messages
|
|
148
|
+
fmt.Println(msg)
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### SQL
|
|
153
|
+
|
|
154
|
+
```sql
|
|
155
|
+
SELECT
|
|
156
|
+
u.name,
|
|
157
|
+
COUNT(o.id) as order_count,
|
|
158
|
+
SUM(o.total) as total_spent
|
|
159
|
+
FROM users u
|
|
160
|
+
LEFT JOIN orders o ON u.id = o.user_id
|
|
161
|
+
WHERE u.created_at > '2024-01-01'
|
|
162
|
+
GROUP BY u.id
|
|
163
|
+
HAVING total_spent > 1000
|
|
164
|
+
ORDER BY total_spent DESC
|
|
165
|
+
LIMIT 10;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
代码高亮使用 [Shiki](https://shiki.matsu.io/) 引擎,支持数百种编程语言!
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Markmap 思维导图示例"
|
|
3
|
+
description: "展示 Markmap 交互式思维导图功能"
|
|
4
|
+
pubDatetime: 2024-01-03T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- Markmap
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 什么是 Markmap?
|
|
11
|
+
|
|
12
|
+
Markmap 是一种将 Markdown 转换为交互式思维导图的工具,非常适合展示层次结构的内容。
|
|
13
|
+
|
|
14
|
+
## 基础用法
|
|
15
|
+
|
|
16
|
+
```markmap
|
|
17
|
+
# 中心主题
|
|
18
|
+
|
|
19
|
+
## 分支 1
|
|
20
|
+
### 子分支 1-1
|
|
21
|
+
### 子分支 1-2
|
|
22
|
+
#### 更深层级
|
|
23
|
+
|
|
24
|
+
## 分支 2
|
|
25
|
+
### 子分支 2-1
|
|
26
|
+
### 子分支 2-2
|
|
27
|
+
|
|
28
|
+
## 分支 3
|
|
29
|
+
### 子分支 3-1
|
|
30
|
+
### 子分支 3-2
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 学习路线示例
|
|
34
|
+
|
|
35
|
+
```markmap
|
|
36
|
+
# 前端学习路线
|
|
37
|
+
|
|
38
|
+
## 基础知识
|
|
39
|
+
### HTML
|
|
40
|
+
### CSS
|
|
41
|
+
- Flexbox
|
|
42
|
+
- Grid
|
|
43
|
+
- 动画
|
|
44
|
+
### JavaScript
|
|
45
|
+
- ES6+
|
|
46
|
+
- DOM 操作
|
|
47
|
+
- 异步编程
|
|
48
|
+
|
|
49
|
+
## 框架
|
|
50
|
+
### React
|
|
51
|
+
- Hooks
|
|
52
|
+
- Redux
|
|
53
|
+
- Next.js
|
|
54
|
+
### Vue
|
|
55
|
+
- Composition API
|
|
56
|
+
- Pinia
|
|
57
|
+
- Nuxt
|
|
58
|
+
|
|
59
|
+
## 工具链
|
|
60
|
+
### 构建工具
|
|
61
|
+
- Vite
|
|
62
|
+
- Webpack
|
|
63
|
+
### 代码质量
|
|
64
|
+
- ESLint
|
|
65
|
+
- Prettier
|
|
66
|
+
- TypeScript
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 项目架构示例
|
|
70
|
+
|
|
71
|
+
```markmap
|
|
72
|
+
# 项目架构
|
|
73
|
+
|
|
74
|
+
## 前端
|
|
75
|
+
### 页面组件
|
|
76
|
+
- 首页
|
|
77
|
+
- 列表页
|
|
78
|
+
- 详情页
|
|
79
|
+
### 公共组件
|
|
80
|
+
- Header
|
|
81
|
+
- Footer
|
|
82
|
+
- Modal
|
|
83
|
+
### 状态管理
|
|
84
|
+
- Store
|
|
85
|
+
- Actions
|
|
86
|
+
|
|
87
|
+
## 后端
|
|
88
|
+
### API 接口
|
|
89
|
+
- 用户相关
|
|
90
|
+
- 内容相关
|
|
91
|
+
### 数据库
|
|
92
|
+
- MySQL
|
|
93
|
+
- Redis
|
|
94
|
+
|
|
95
|
+
## 部署
|
|
96
|
+
### CI/CD
|
|
97
|
+
- GitHub Actions
|
|
98
|
+
### 服务器
|
|
99
|
+
- Nginx
|
|
100
|
+
- Docker
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
点击思维导图的节点可以展开或折叠子节点,非常适合做知识总结和项目规划!
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "数学公式示例"
|
|
3
|
+
description: "展示 KaTeX 数学公式渲染功能,支持行内公式和块级公式"
|
|
4
|
+
pubDatetime: 2024-01-04T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- 数学
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 行内公式
|
|
11
|
+
|
|
12
|
+
这是一个简单的行内公式 $E = mc^2$,爱因斯坦的质能方程。
|
|
13
|
+
|
|
14
|
+
勾股定理:直角三角形的两条直角边的平方和等于斜边的平方,即 $a^2 + b^2 = c^2$。
|
|
15
|
+
|
|
16
|
+
## 块级公式
|
|
17
|
+
|
|
18
|
+
### 二次方程求根公式
|
|
19
|
+
|
|
20
|
+
$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
|
|
21
|
+
|
|
22
|
+
### 欧拉公式
|
|
23
|
+
|
|
24
|
+
$$e^{i\pi} + 1 = 0$$
|
|
25
|
+
|
|
26
|
+
### 高斯积分
|
|
27
|
+
|
|
28
|
+
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
|
|
29
|
+
|
|
30
|
+
### 泰勒展开
|
|
31
|
+
|
|
32
|
+
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
|
|
33
|
+
|
|
34
|
+
### 矩阵
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
\begin{bmatrix}
|
|
38
|
+
1 & 2 & 3 \\
|
|
39
|
+
4 & 5 & 6 \\
|
|
40
|
+
7 & 8 & 9
|
|
41
|
+
\end{bmatrix}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
### 分段函数
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
f(x) = \begin{cases}
|
|
48
|
+
x^2, & x \geq 0 \\
|
|
49
|
+
-x^2, & x < 0
|
|
50
|
+
\end{cases}
|
|
51
|
+
$$
|
|
52
|
+
|
|
53
|
+
### 麦克斯韦方程组
|
|
54
|
+
|
|
55
|
+
$$
|
|
56
|
+
\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}
|
|
57
|
+
$$
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
\nabla \cdot \mathbf{B} = 0
|
|
61
|
+
$$
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}}{\partial t}
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
\nabla \times \mathbf{B} = \mu_0 \mathbf{J} + \mu_0 \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t}
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
## 复杂公式示例
|
|
72
|
+
|
|
73
|
+
### 傅里叶变换
|
|
74
|
+
|
|
75
|
+
$$\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} dx$$
|
|
76
|
+
|
|
77
|
+
### 薛定谔方程
|
|
78
|
+
|
|
79
|
+
$$i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \hat{H} \Psi(\mathbf{r}, t)$$
|
|
80
|
+
|
|
81
|
+
数学公式使用 [KaTeX](https://katex.org/) 渲染,支持绝大多数 LaTeX 语法。
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Mermaid 图表示例"
|
|
3
|
+
description: "展示 Mermaid 流程图、时序图、饼图等多种图表功能"
|
|
4
|
+
pubDatetime: 2024-01-02T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- Mermaid
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 流程图
|
|
11
|
+
|
|
12
|
+
```mermaid
|
|
13
|
+
graph TD
|
|
14
|
+
A[开始] --> B{是否登录?}
|
|
15
|
+
B -->|是| C[进入主页]
|
|
16
|
+
B -->|否| D[跳转登录页]
|
|
17
|
+
D --> E[输入用户名密码]
|
|
18
|
+
E --> F{验证成功?}
|
|
19
|
+
F -->|是| C
|
|
20
|
+
F -->|否| G[显示错误]
|
|
21
|
+
G --> E
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 时序图
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
sequenceDiagram
|
|
28
|
+
participant 用户
|
|
29
|
+
participant 前端
|
|
30
|
+
participant 后端
|
|
31
|
+
participant 数据库
|
|
32
|
+
|
|
33
|
+
用户->>前端: 点击登录
|
|
34
|
+
前端->>后端: POST /api/login
|
|
35
|
+
后端->>数据库: 查询用户信息
|
|
36
|
+
数据库-->>后端: 返回用户数据
|
|
37
|
+
后端-->>前端: 返回 JWT Token
|
|
38
|
+
前端-->>用户: 跳转到主页
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 饼图
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
pie showData
|
|
45
|
+
title 编程语言使用比例
|
|
46
|
+
"TypeScript" : 40
|
|
47
|
+
"Python" : 25
|
|
48
|
+
"Go" : 20
|
|
49
|
+
"Rust" : 15
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 甘特图
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
gantt
|
|
56
|
+
title 项目开发计划
|
|
57
|
+
dateFormat YYYY-MM-DD
|
|
58
|
+
section 设计阶段
|
|
59
|
+
需求分析 :a1, 2024-01-01, 7d
|
|
60
|
+
UI设计 :a2, after a1, 5d
|
|
61
|
+
section 开发阶段
|
|
62
|
+
前端开发 :b1, after a2, 14d
|
|
63
|
+
后端开发 :b2, after a2, 14d
|
|
64
|
+
section 测试阶段
|
|
65
|
+
功能测试 :c1, after b1, 7d
|
|
66
|
+
上线部署 :c2, after c1, 3d
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 状态图
|
|
70
|
+
|
|
71
|
+
```mermaid
|
|
72
|
+
stateDiagram-v2
|
|
73
|
+
[*] --> 草稿
|
|
74
|
+
草稿 --> 待审核: 提交
|
|
75
|
+
待审核 --> 已发布: 审核通过
|
|
76
|
+
待审核 --> 草稿: 审核拒绝
|
|
77
|
+
已发布 --> 已下架: 下架
|
|
78
|
+
已下架 --> 已发布: 重新发布
|
|
79
|
+
已发布 --> [*]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
更多 Mermaid 图表类型请参考 [Mermaid 官方文档](https://mermaid.js.org/)。
|