feat: dynamic model fetching for GitHub Copilot

- Add ListModels/ListModelsWithGitHubToken to CopilotAuth for querying
  the /models endpoint at api.githubcopilot.com
- Add FetchGitHubCopilotModels in executor with static fallback on failure
- Update service.go to use dynamic fetching (15s timeout) instead of
  hardcoded GetGitHubCopilotModels()
- Add GitHubCopilotAliasesFromModels for auto-generating dot-to-hyphen
  model aliases from dynamic model lists
This commit is contained in:
yx-bot7
2026-03-04 14:29:28 +08:00
parent 26fc611f86
commit d8e3d4e2b6
4 changed files with 205 additions and 1 deletions

View File

@@ -866,7 +866,9 @@ func (s *Service) registerModelsForAuth(a *coreauth.Auth) {
models = registry.GetKimiModels()
models = applyExcludedModels(models, excluded)
case "github-copilot":
models = registry.GetGitHubCopilotModels()
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
models = executor.FetchGitHubCopilotModels(ctx, a, s.cfg)
cancel()
models = applyExcludedModels(models, excluded)
case "kiro":
models = s.fetchKiroModels(a)