feat(integrations): add dynamic OpenRouter model loading

- Remove hardcoded OPENROUTER_MODEL_CHOICES from openrouter.py
- Add API endpoint /integrations/openrouter/models/ to fetch models dynamically
- Models loaded from OpenRouter API with free models (':free') at top
- Update OpenRouterIntegration model_name field (remove choices, blank=True)
- Add async buildForm() with dynamic_choices support
- Show asterisks (********) for saved API keys with helpful placeholder

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 18:16:12 +03:00
parent 3aac83474b
commit 5ec5ee48d4
5 changed files with 173 additions and 57 deletions

View File

@@ -6,6 +6,7 @@ from .views import (
get_integration_form_data,
test_integration_connection,
RecommerceBatchSyncView,
get_openrouter_models,
)
app_name = 'integrations'
@@ -22,4 +23,7 @@ urlpatterns = [
# Синхронизация
path("recommerce/sync/", RecommerceBatchSyncView.as_view(), name="recommerce_sync"),
# OpenRouter модели
path("openrouter/models/", get_openrouter_models, name="openrouter_models"),
]