Skip to content

feat(llm): scheduled model catalog refresh + dynamic Anthropic catalog - #393

Merged
ModerRAS merged 1 commit into
masterfrom
feat/llm-catalog-refresh
Sep 17, 2026
Merged

ModerRAS merged 1 commit into
masterfrom
feat/llm-catalog-refresh

Conversation

@ModerRAS

Copy link
Copy Markdown
Owner

Why

Channel model lists were only refreshed when an admin ran 刷新所有渠道 by hand, and AnthropicModelApi returned a hardcoded Claude snapshot forever. Preset seeds therefore went stale and nobody noticed.

What

  • ModelCatalogRefreshTask (IScheduledTask, every 6 hours, heartbeat-managed) reuses RefreshAllChannel; manual 刷新所有渠道 stays as-is.
  • Startup refresh: GeneralBootstrap fires one refresh 30 s after host start, so a fresh deployment gets current provider models without waiting for the cron.
  • Dynamic Anthropic catalog: GET {gateway}/v1/models with x-api-key + anthropic-version, endpoint normalized to exactly one /v1 (works for api.anthropic.com and compatible gateways like opencode.ai/zen/v1); HTTP error, empty list or invalid JSON falls back to the static snapshot. GetAllModelsWithCapabilities now covers the discovered list.

Validation

  • dotnet build TelegramSearchBot.sln -c Release → 0 errors
  • TelegramSearchBot.LLM.Test → 278/278 (11 new Anthropic discovery tests)
  • TelegramSearchBot.Test → 448 passed, 1 skipped (3 new task tests)

Notes

  • Cost: one catalog request per channel every 6 hours; failures keep the previous rows (existing soft-delete/Manual-row rules untouched).
  • Preset data itself is still a static seed — Step 3 of the backlog makes it data-driven.

Channel model lists only refreshed when an admin ran 刷新所有渠道 manually, so
preset seeds went stale and Anthropic kept a hardcoded Claude snapshot forever.

- ModelCatalogRefreshTask (IScheduledTask): refreshes all channel catalogs
  every 6 hours with heartbeat tracking, reusing RefreshAllChannel
- GeneralBootstrap: fire one refresh 30s after startup so fresh deployments
  pick up current provider models without waiting for the cron
- AnthropicModelApi.GetAllModels: GET {gateway}/v1/models (x-api-key +
  anthropic-version headers, endpoint normalized to a single /v1), falling
  back to the static snapshot on any failure; capabilities now cover the
  discovered model list
- Tests: AnthropicModelDiscoveryTests (11) + ModelCatalogRefreshTaskTests (3)
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8b2cd5a5-8192-4779-8bda-26d46e86ed9d


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

PR Check Report

Summary

Test Results

Platform Status Details
Ubuntu Passed Tests passed, artifacts uploaded
Windows Passed Tests passed, artifacts uploaded

Code Quality

  • Code formatting check
  • Security vulnerability scan
  • Dependency analysis
  • Code coverage collection

Test Artifacts

  • Test results artifacts count: 2
  • Code coverage uploaded to Codecov

Links


This report is auto-generated by GitHub Actions

@ModerRAS
ModerRAS merged commit 6cf1ee3 into master Sep 17, 2026
6 checks passed
@ModerRAS
ModerRAS deleted the feat/llm-catalog-refresh branch September 17, 2026 02:19
ModerRAS added a commit that referenced this pull request Sep 17, 2026
Resolve #395 conflicts after #393/#394 were squash-merged:
- LlmProviderCatalog / IEditLLMConfHelper / EditLLMConfHelper / EditLLMConfTest:
  keep the branch side (step 2 + step 3/4 content is the superset)
- GeneralBootstrap: keep master's startup catalog refresh (#393) and re-add the
  providers.json source log from step 3

Validated after merge: build 0 errors; LLM.Test 310/310; main tests 455 passed / 1 skipped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant