Repository navigation
总表接口加上关键词、类型和是否截止的筛选 - #145
Merged
Merged
Conversation
MCP 的 search_programs 一次拿一整届,2027 届现在就有 52KB,项目多了 Agent 读不完。接口加上可选的筛选,让服务端先筛;不带时和原来一样,网页照旧在浏览器里筛。 - GET /programs 加 q、kind、closed,关键词和网页的搜索用同一个函数 - 访客只在预览的 5 条里筛,筛选拿不到预览以外的项目 - 带筛选的响应不带 ETag:是否截止随时间变,网页也不用 - 布尔的查询参数用 BoolParam,OpenAPI 里是 boolean,MCP 工具照样生成
- ETag 的中间件在路由校验之前跑:只给单独、只带一次 cohort 的请求打标签,参数重复的不再错拿 304 - statusOf 挪到 programs/time.ts,网页和接口的「已截止」用同一个判断 - 空关键词直接算匹配,网页每次筛选不多花时间 - 400 的说明写上筛选,测试补上靠活动结束算截止的项目和 MCP 公布的布尔参数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联
路线图 #2 里的 Agent 接入(MCP 是 #144),没有单独的 Issue。
改了什么
MCP 的
search_programs对应GET /programs,一次返回一整届。2027 届现在 92 个项目就有约 52KB,项目多了 Agent 读不完。所以给接口加上可选的服务端筛选;不带时和原来一样,网页还是在浏览器里筛(总体设计 §14)。GET /programs加上q(学校名、简称、学院名或项目名里有它,不分大小写)、kind、closed(是否已截止)。关键词用programs/search.ts里的同一个函数,「已截止」用statusOf(从app/time.ts挪到programs/time.ts);网页和接口的规则只有一份。cohort的请求才带 ETag。带筛选的结果会随时间变(closed);中间件又在路由校验之前运行,参数重复的请求原来会错拿 304。BoolParam,OpenAPI 里是boolean,MCP 工具的参数照样从文档生成。怎么验证的
pnpm check(162 个测试)、pnpm build都通过;pnpm openapi重新生成后openapi/crawler.json没有变化。search_programs公布的closed是布尔值,传true能被接口认出来。影响
GET /programs多了三个可选参数,不带时响应和原来一样;400 的说明改成「届或筛选的格式有误」。search_programs多了这三个参数,说明里写着可以先筛。已有的调用不受影响。