mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 09:15:33 +08:00
feat(cursor): cli 接入本地模型路由与配置
- feat(服务配置): 本地响应配置并禁用 HTTP/2 传输 - feat(模型目录): 提供默认模型接口及本地路由凭据 - fix(待办状态): 基于检查点合并增量待办并保留未变更项 - fix(模型参数): 忽略未知参数以兼容新版 Cursor 请求 - test(本地路由): 覆盖模型元数据路由与凭据行为
This commit is contained in:
1 parent
543f618fee
commit
924b5e5926
10 files changed
+489
-11
No files matched your search
@@ -152,9 +152,15 @@ fn is_local_path(path: &str) -> bool {
|
||||
path,
|
||||
"/agent.v1.AgentService/RunSSE"
|
||||
| "/aiserver.v1.BidiService/BidiAppend"
|
||||
| "/aiserver.v1.AiService/GetServerConfig"
|
||||
| "/aiserver.v1.ServerConfigService/GetServerConfig"
|
||||
| "/aiserver.v1.AiService/AvailableModels"
|
||||
| "/agent.v1.AgentService/GetUsableModels"
|
||||
| "/aiserver.v1.AiService/GetUsableModels"
|
||||
| "/agent.v1.AgentService/GetDefaultModelForCli"
|
||||
| "/aiserver.v1.AiService/GetDefaultModelForCli"
|
||||
| "/aiserver.v1.AiService/GetDefaultModel"
|
||||
| "/aiserver.v1.AiService/GetDefaultModelNudgeData"
|
||||
| "/aiserver.v1.AuthService/GetEmail"
|
||||
| "/aiserver.v1.DashboardService/GetMe"
|
||||
| "/aiserver.v1.DashboardService/GetTeams"
|
||||
@@ -175,3 +181,22 @@ fn is_local_path(path: &str) -> bool {
|
||||
fn should_route_locally(path: &str, tab_mode: TabMode) -> bool {
|
||||
is_local_path(path) || (is_tab_path(path) && tab_mode != TabMode::Direct)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn cursor_cli_transport_and_model_metadata_routes_stay_local() {
|
||||
for path in [
|
||||
"/aiserver.v1.AiService/GetServerConfig",
|
||||
"/aiserver.v1.ServerConfigService/GetServerConfig",
|
||||
"/agent.v1.AgentService/GetDefaultModelForCli",
|
||||
"/aiserver.v1.AiService/GetDefaultModelForCli",
|
||||
"/aiserver.v1.AiService/GetDefaultModel",
|
||||
"/aiserver.v1.AiService/GetDefaultModelNudgeData",
|
||||
] {
|
||||
assert!(is_local_path(path), "{path} must not reach Cursor upstream");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user