Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
4c3d3fd
chore: add @ai-sdk/openai-compatible dependency and update pnpm-lock.…
Crokily Sep 26, 2025
a5ed1a8
feat: add support for 'intern' provider in chat API and integrate Ope…
Crokily Sep 26, 2025
df44a20
feat: enhance support for 'intern' provider in settings and error han…
Crokily Sep 26, 2025
d2e764a
refactor: 解耦AI模块代码,为后续拓展AI功能,复用代码提供基础
Crokily Sep 26, 2025
512cac2
style: 将本pr涉及的代码(主要是AI模块)内的注释改成中文,便于协作
Crokily Sep 27, 2025
20e3cae
feat: update default system message to support multilingual responses
Crokily Sep 27, 2025
a327e58
style: adjust sizes of AssistantModal button icons for improved UI co…
Crokily Sep 27, 2025
0afcebf
Create wangshusen_recommend_note_rank.mdx
0dysseus13 Sep 27, 2025
f13d918
Create wangshusen_recommend_crossing.mdx
0dysseus13 Sep 27, 2025
d86e0de
Create wangshusen_recommend_note_rerank.mdx
0dysseus13 Sep 27, 2025
f19c696
Create wangshusen_recommend_note_coldstart.mdx
0dysseus13 Sep 27, 2025
8fb8e57
Create wangshusen_recommend_note_improvement.mdx
0dysseus13 Sep 27, 2025
1dbb235
style: update Composer component background color for improved visibi…
Crokily Sep 27, 2025
9e69f37
Merge pull request #130 from Crokily/addInternS1
Mira190 Sep 27, 2025
dfacf0b
Create cloudflare-r2-sharex-free-image-hosting.mdx
LynPtl Sep 27, 2025
79d3c86
Create PictureCDN.mdx
RavenCaffeine Sep 27, 2025
9a4ce25
Merge pull request #138 from InvolutionHell/RavenCaffeine-doc
longsizhuo Sep 27, 2025
e9cebee
Merge pull request #137 from LynPtl/patch-1
longsizhuo Sep 27, 2025
689a103
Merge pull request #136 from H0SH123/patch-9
longsizhuo Sep 27, 2025
72af286
fix image issue
Mira190 Sep 27, 2025
4b280ed
Merge pull request #140 from Mira190/upstream-main
Mira190 Sep 27, 2025
7bc8905
Update picturecdn.mdx
RavenCaffeine Sep 27, 2025
bd76005
Merge pull request #141 from InvolutionHell/RavenCaffeine-doc-1
RavenCaffeine Sep 27, 2025
86bc959
Update wangshusen_recommend_note_improvement.mdx
Mira190 Sep 27, 2025
e326710
update image config
Mira190 Sep 27, 2025
640e61b
Merge pull request #144 from Mira190/main
Mira190 Sep 27, 2025
0d33ae4
feat: Add threadpool
duang3457 Sep 27, 2025
606e7a3
fix: change to en. foldername
duang3457 Sep 27, 2025
c2a1aa9
Merge pull request #132 from H0SH123/patch-5
RavenCaffeine Sep 27, 2025
b16952b
Merge pull request #133 from H0SH123/patch-6
RavenCaffeine Sep 27, 2025
d634b9b
Merge pull request #134 from H0SH123/patch-7
RavenCaffeine Sep 27, 2025
d769005
Merge pull request #135 from H0SH123/patch-8
RavenCaffeine Sep 27, 2025
ddfdedd
Update threadpool_cpp.mdx
longsizhuo Sep 27, 2025
72becf5
Merge pull request #147 from duang3457/patch-2
longsizhuo Sep 27, 2025
75100ff
feat: Add script to escape angle brackets in markdown files
longsizhuo Sep 27, 2025
79aa986
fix format issue
Mira190 Sep 27, 2025
24a289f
chore: Add fast-glob dependency and update pnpm-lock.yaml formatting
longsizhuo Sep 27, 2025
8633dca
Merge remote-tracking branch 'upstream/main'
Mira190 Sep 27, 2025
915b4a2
Merge pull request #148 from Mira190/main
Mira190 Sep 27, 2025
5cbffe0
feat: Add mdx (Implement simple fixed-size memory pool)
duang3457 Sep 27, 2025
ac25455
feat: Add cpp_index
duang3457 Sep 27, 2025
e300642
Merge pull request #149 from duang3457/patch-3
Crokily Sep 27, 2025
cc953a1
fix: fix filename index to pre
duang3457 Sep 28, 2025
4ce70de
fix(contrib): change default submission file extension from .mdx to .md
Sep 28, 2025
e06dd70
Create pre-interview.md
Mira190 Sep 28, 2025
0b1f07c
Merge pull request #152 from ClaireggZ/feat/use-md-by-default
Mira190 Sep 28, 2025
06a417b
Merge pull request #154 from InvolutionHell/Mira190-patch-4
Mira190 Sep 28, 2025
4af1c3b
Update pre-interview.md
Mira190 Sep 28, 2025
e22b291
feat(docs): enhance README presentation
LynPtl Sep 28, 2025
da71a5b
Merge pull request #156 from LynPtl/feat/update-readme
Mira190 Sep 28, 2025
e7ac5a1
add motion
Mira190 Sep 28, 2025
65312b1
Merge pull request #157 from Mira190/main
Mira190 Sep 28, 2025
89b1307
Create introduction_of_multi-agents_system.md
PenghaoJiang Sep 29, 2025
0a63b34
Update introduction_of_multi-agents_system.md
PenghaoJiang Sep 29, 2025
6b62097
Merge pull request #158 from PenghaoJiang/patch-2
Mira190 Sep 29, 2025
317ec86
Create preparations-to-get-an-offer-as-a-student.mdx
SiYG Sep 29, 2025
23fc11d
指引chatbot的气泡框,ui组件没有封装
Sep 29, 2025
d435682
feat(docs):add_cpp_more
duang3457 Sep 29, 2025
b76d1a2
Merge pull request #159 from SiYG/patch-1
Mira190 Sep 29, 2025
a763bd8
Update introduction_of_multi-agents_system.md
yoyofancy Sep 29, 2025
84f9fc5
feat(config): add AWS S3 domain to allowed image domains
Crokily Sep 29, 2025
6e922a0
Merge pull request #165 from Crokily/addAWStoConfig
Crokily Sep 30, 2025
6dce4c3
fix(docs): delete aws s3 img
duang3457 Sep 30, 2025
61e4ba8
fix(docs): update mdx to md(cpp_backend)
duang3457 Sep 30, 2025
719fd78
Merge branch 'InvolutionHell:main' into yoyo
yoyofancy Sep 30, 2025
ccb4d2c
chatbot绘画气泡,鼠标悬停效果,修复点击chatbot后气泡依然存在
yoyofancy Sep 30, 2025
42cbdf9
Merge pull request #166 from yoyofancy/yoyo
Crokily Sep 30, 2025
89e362a
Update 3_Make.md ** bug
Crokily Sep 30, 2025
0dfbdfb
Merge pull request #150 from duang3457/patch-4
Crokily Sep 30, 2025
daf7242
Update introduction_of_multi-agents_system.md
yoyofancy Oct 1, 2025
150a2f5
Merge branch 'InvolutionHell:main' into patch-2
yoyofancy Oct 1, 2025
cb29e4c
Merge pull request #167 from yoyofancy/patch-2
Mira190 Oct 2, 2025
3088899
加入了李宏毅深度学习笔记的一个资料
yoyofancy Oct 2, 2025
aad9d2e
Merge pull request #168 from yoyofancy/patch-1
Mira190 Oct 2, 2025
96d512b
Create unsw-student-benefit.md
Mira190 Oct 3, 2025
a136ee8
Merge pull request #170 from InvolutionHell/Mira190-patch-5
Mira190 Oct 3, 2025
264af0b
Update unsw-student-benefit.md
Mira190 Oct 3, 2025
9019ab7
Create context_engineering_intro.md
yoyofancy Oct 3, 2025
7130224
Create ppo.md
codemanQAQ Oct 3, 2025
19b8d91
Update ppo.md
codemanQAQ Oct 3, 2025
a3cab3e
Update ppo.md
codemanQAQ Oct 3, 2025
3ffdba0
Update ppo.md
codemanQAQ Oct 3, 2025
355b4b7
Update ppo.md
codemanQAQ Oct 3, 2025
41995e8
Merge pull request #172 from codemanQAQ/patch-1
Crokily Oct 3, 2025
0122851
修复了图片引用,改为md的引用方式
Crokily Oct 3, 2025
c7d856d
Update next.config.mjs: 增加了对crokily个人图床的支持
Crokily Oct 3, 2025
8fbad98
Merge pull request #173 from InvolutionHell/addImgColycc
Crokily Oct 3, 2025
a786d2d
Update context_engineering_intro.md
Crokily Oct 3, 2025
d5bba8f
Merge pull request #171 from yoyofancy/patch-3
Crokily Oct 3, 2025
a1f8b94
fix: resolve image reference issues in context_engineering_intro.md
Crokily Oct 3, 2025
43c0735
Merge pull request #174 from Crokily/amazingAItools
Crokily Oct 3, 2025
c94357e
Create math_books.md
AudreyYZY Oct 6, 2025
07290cf
Update math_books.md
AudreyYZY Oct 6, 2025
c37e464
Update math_books.md
AudreyYZY Oct 6, 2025
e4f59e0
Merge pull request #177 from AudreyYZY/patch-1
Mira190 Oct 6, 2025
880b2cf
Merge branch 'feat/contributor'
longsizhuo Oct 8, 2025
20610f9
fix: pnpm-lock error
longsizhuo Oct 8, 2025
67bdac2
chore(docs): sync doc metadata [skip ci]
longsizhuo Oct 8, 2025
3c142ea
test: 修改了计算机科学的引导,观察是否触发CICD
longsizhuo Oct 8, 2025
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
26 changes: 13 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pnpm dev

打开浏览器访问 [http://localhost:3000](http://localhost:3000)。

修改 `docs/` 下的 `.md` 或 `.mdx` 文件,会自动热更新。
修改 `docs/` 下的 `.md` 文件,会自动热更新。

---

Expand Down Expand Up @@ -155,7 +155,7 @@ pnpm postinstall # 同步必要的 Husky/Fumadocs 配置
docxA 引用了 imgA 图片, 那么他们的文档结构应该是 `docxA.assets/imgA`:

```md
docsA.mdx
docsA.md
docsA.assets/
imgA
```
Expand Down Expand Up @@ -199,35 +199,35 @@ tags:
```
📂 docs/
├── 📂 computer-science/ # 计算机科学
│ ├── 📄 index.mdx # 概述
│ ├── 📄 index.md # 概述
│ └── 📂 data-structures/ # 数据结构
│ ├── 📄 index.mdx # 概述
│ ├── 📄 index.md # 概述
│ ├── 📂 array/ # 数组
│ │ ├── 📄 index.mdx # 概述
│ │ ├── 📄 01-static-array.mdx # 静态数组
│ │ └── 📄 02-dynamic-array.mdx # 动态数组
│ │ ├── 📄 index.md # 概述
│ │ ├── 📄 01-static-array.md # 静态数组
│ │ └── 📄 02-dynamic-array.md # 动态数组
│ └── 📂 linked-list/ # 链表
│ ├── 📄 index.mdx # 概述
│ └── 📄 01-singly-linked-list.mdx # 单向链表
│ ├── 📄 index.md # 概述
│ └── 📄 01-singly-linked-list.md # 单向链表
```

### URL 生成

文件结构会自动生成简洁的 URL:

- `docs/computer-science/index.mdx` → `/computer-science`
- `docs/computer-science/data-structures/array/01-static-array.mdx` → `/computer-science/data-structures/array/static-array`
- `docs/computer-science/index.md` → `/computer-science`
- `docs/computer-science/data-structures/array/01-static-array.md` → `/computer-science/data-structures/array/static-array`

### 命名约定

**文件夹:**

- 使用 `kebab-case` 命名: `computer-science`, `data-structures`
- 每个主题文件夹应该有一个 `index.mdx` 文件作为概述
- 每个主题文件夹应该有一个 `index.md` 文件作为概述

**文件:**

- 使用 `kebab-case` 命名: `static-array.mdx`
- 使用 `kebab-case` 命名: `static-array.md`
- 使用数字前缀排序: `01-`, `02-`
- 前缀会自动从最终 URL 中移除

Expand Down
21 changes: 20 additions & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@
<a href="./README.md">简体中文</a> | <a href="./README.en.md">English</a>
</p>

# Involution Hell Knowledge Base
<p align="center">
<a href="https://involutionhell.github.io">
<img src="./public/mascot.svg" width="150">
</a>
</p>
<p align="center"><a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com/?font=Fira+Code&weight=700&size=32&pause=1000&color=f6671b&center=true&vCenter=true&width=280&lines=Involution+Hell&duration=3000" alt="Typing SVG" /></a></p>

<p align="center">
<img alt="Next.js" src="https://img.shields.io/badge/Next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white" />
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white" />
<img alt="Tailwind CSS" src="https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwindcss&logoColor=white" />
<img alt="Vercel" src="https://img.shields.io/badge/Vercel-000000?style=for-the-badge&logo=vercel&logoColor=white" />
<a href="https://github.com/InvolutionHell/involutionhell.github.io/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/InvolutionHell/involutionhell.github.io?style=for-the-badge&color=blue">
</a>
</p>



## 📋 About

Expand Down Expand Up @@ -64,6 +81,8 @@ Community contributions are always welcome:

For the full workflow, PR checklist, and UI collaboration guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).

[![Contributors](https://contrib.rocks/image?repo=InvolutionHell/involutionhell.github.io)](https://github.com/InvolutionHell/involutionhell.github.io/graphs/contributors)

## 🖼️ Documentation & Assets

The repo ships with automated image migration and linting. Learn how to place assets, reference images, and structure frontmatter in:
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
<a href="./README.md">简体中文</a> | <a href="./README.en.md">English</a>
</p>

# 内卷地狱知识库
<p align="center">
<a href="https://involutionhell.github.io">
<img src="./public/mascot.svg" width="150">
</a>
</p>

<p align="center"><a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com/?font=Noto+Sans+SC&weight=700&size=32&pause=1000&color=f6671b&center=true&vCenter=true&width=420&lines=%E5%86%85%E5%8D%B7%E5%9C%B0%E7%8B%B1%E7%9F%A5%E8%AF%86%E5%BA%93&duration=3000" alt="Typing SVG" /></a></p>

<p align="center">
<img alt="Next.js" src="https://img.shields.io/badge/Next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white" />
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white" />
<img alt="Tailwind CSS" src="https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwindcss&logoColor=white" />
<img alt="Vercel" src="https://img.shields.io/badge/Vercel-000000?style=for-the-badge&logo=vercel&logoColor=white" />
<a href="https://github.com/InvolutionHell/involutionhell.github.io/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/InvolutionHell/involutionhell.github.io?style=for-the-badge&color=blue">
</a>
</p>

## 📋 关于

Expand Down Expand Up @@ -74,6 +90,8 @@ pnpm dev

完整流程、PR 检查与 UI 协作约定请参考 [CONTRIBUTING.md](CONTRIBUTING.md)。

[![Contributors](https://contrib.rocks/image?repo=InvolutionHell/involutionhell.github.io)](https://github.com/InvolutionHell/involutionhell.github.io/graphs/contributors)

## 🖼️ 文档与资产

仓库提供自动化图片迁移与 Lint 规则。如何放置图片、引用资产、撰写 Frontmatter 等细节已在贡献指南中整理:
Expand Down
113 changes: 45 additions & 68 deletions app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -1,81 +1,52 @@
import { createOpenAI } from "@ai-sdk/openai";
import { createGoogleGenerativeAI } from "@ai-sdk/google";
import { streamText, UIMessage, convertToModelMessages } from "ai";
import { getModel, requiresApiKey, type AIProvider } from "@/lib/ai/models";
import { buildSystemMessage } from "@/lib/ai/prompt";

// Allow streaming responses up to 30 seconds
// 流式响应最长30秒
export const maxDuration = 30;

export async function POST(req: Request) {
const {
messages,
system,
pageContext,
provider,
apiKey,
}: {
messages: UIMessage[];
system?: string; // System message forwarded from AssistantChatTransport
tools?: unknown; // Frontend tools forwarded from AssistantChatTransport
pageContext?: {
title?: string;
description?: string;
content?: string;
slug?: string;
};
provider?: "openai" | "gemini";
apiKey?: string;
} = await req.json();

// Check if API key is provided
if (!apiKey || apiKey.trim() === "") {
return Response.json(
{
error:
"API key is required. Please configure your API key in the settings.",
},
{ status: 400 },
);
}
interface ChatRequest {
messages: UIMessage[];
system?: string;
tools?: unknown;
pageContext?: {
title?: string;
description?: string;
content?: string;
slug?: string;
};
provider?: AIProvider;
apiKey?: string;
}

export async function POST(req: Request) {
try {
// Build system message with page context
let systemMessage =
system ||
`You are a helpful AI assistant for a documentation website.
You can help users understand the documentation, answer questions about the content,
and provide guidance on the topics covered in the docs. Be concise and helpful.`;
const {
messages,
system,
pageContext,
provider = "intern", // 默认使用书生模型
apiKey,
}: ChatRequest = await req.json();

// Add current page context if available
if (pageContext?.content) {
systemMessage += `\n\n--- CURRENT PAGE CONTEXT ---\n`;
if (pageContext.title) {
systemMessage += `Page Title: ${pageContext.title}\n`;
}
if (pageContext.description) {
systemMessage += `Page Description: ${pageContext.description}\n`;
}
if (pageContext.slug) {
systemMessage += `Page URL: /docs/${pageContext.slug}\n`;
}
systemMessage += `Page Content:\n${pageContext.content}`;
systemMessage += `\n--- END OF CONTEXT ---\n\nWhen users ask about "this page", "current page", or refer to the content they're reading, use the above context to provide accurate answers. You can summarize, explain, or answer specific questions about the current page content.`;
// 对指定Provider验证key是否存在
if (requiresApiKey(provider) && (!apiKey || apiKey.trim() === "")) {
return Response.json(
{
error:
"API key is required. Please configure your API key in the settings.",
},
{ status: 400 },
);
}

// Select model based on provider
let model;
if (provider === "gemini") {
const customGoogle = createGoogleGenerativeAI({
apiKey: apiKey,
});
model = customGoogle("models/gemini-2.0-flash");
} else {
// Default to OpenAI
const customOpenAI = createOpenAI({
apiKey: apiKey,
});
model = customOpenAI("gpt-4.1-nano");
}
// 构建系统消息,包含页面上下文
const systemMessage = buildSystemMessage(system, pageContext);

// 根据Provider获取 AI 模型实例
const model = getModel(provider, apiKey);

// 生成流式响应
const result = streamText({
model: model,
system: systemMessage,
Expand All @@ -85,6 +56,12 @@ export async function POST(req: Request) {
return result.toUIMessageStreamResponse();
} catch (error) {
console.error("Chat API error:", error);

// 处理特定模型创建错误
if (error instanceof Error && error.message.includes("API key")) {
return Response.json({ error: error.message }, { status: 400 });
}

return Response.json(
{ error: "Failed to process chat request" },
{ status: 500 },
Expand Down
2 changes: 1 addition & 1 deletion app/components/Contribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const FILENAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]+$/;

// 统一调用工具函数生成 GitHub 新建链接,路径规则与 Edit 按钮一致
function buildGithubNewUrl(dirPath: string, filename: string, title: string) {
const file = filename.endsWith(".mdx") ? filename : `${filename}.mdx`;
const file = filename.endsWith(".md") ? filename : `${filename}.md`;
const frontMatter = `---
title: '${title || "New Article"}'
description: ""
Expand Down
29 changes: 19 additions & 10 deletions app/components/DocsAssistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function DocsAssistantInner({ pageContext }: DocsAssistantProps) {
const currentApiKey =
currentProvider === "openai"
? openaiApiKeyRef.current
: geminiApiKeyRef.current;
: currentProvider === "gemini"
? geminiApiKeyRef.current
: ""; // intern provider doesn't need API key

console.log("[DocsAssistant] useChat body function called with:", {
provider: currentProvider,
Expand Down Expand Up @@ -118,9 +120,14 @@ interface AssistantErrorState {

function deriveAssistantError(
err: unknown,
provider: "openai" | "gemini",
provider: "openai" | "gemini" | "intern",
): AssistantErrorState {
const providerLabel = provider === "gemini" ? "Google Gemini" : "OpenAI";
const providerLabel =
provider === "gemini"
? "Google Gemini"
: provider === "intern"
? "Intern-AI"
: "OpenAI";
const fallback: AssistantErrorState = {
message:
"The assistant couldn't complete that request. Please try again later.",
Expand Down Expand Up @@ -176,14 +183,16 @@ function deriveAssistantError(

let showSettingsCTA = false;

// For intern provider, don't show settings CTA for API key related errors
if (
statusCode === 400 ||
statusCode === 401 ||
statusCode === 403 ||
normalized.includes("api key") ||
normalized.includes("apikey") ||
normalized.includes("missing key") ||
normalized.includes("unauthorized")
provider !== "intern" &&
(statusCode === 400 ||
statusCode === 401 ||
statusCode === 403 ||
normalized.includes("api key") ||
normalized.includes("apikey") ||
normalized.includes("missing key") ||
normalized.includes("unauthorized"))
) {
showSettingsCTA = true;
}
Expand Down
15 changes: 14 additions & 1 deletion app/components/assistant-ui/SettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ export const SettingsDialog = ({
<RadioGroup
value={provider}
onValueChange={(value) =>
setProvider(value as "openai" | "gemini")
setProvider(value as "openai" | "gemini" | "intern")
}
>
<div className="flex items-center space-x-2">
<RadioGroupItem value="intern" id="intern" />
<Label htmlFor="intern">InternS1 (Free)</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="openai" id="openai" />
<Label htmlFor="openai">OpenAI</Label>
Expand Down Expand Up @@ -90,6 +94,15 @@ export const SettingsDialog = ({
/>
</div>
)}

{provider === "intern" && (
<div className="space-y-2">
<div className="text-sm text-muted-foreground">
感谢上海AILab的书生大模型对本项目的算力支持,Intern-AI
模型已预配置,无需提供 API Key。
</div>
</div>
)}
</div>

<DialogFooter>
Expand Down
Loading