Download apps/intelligence/admin.py from Rsnarsna/Saas-Base: direct link, hf CLI and curl.
- Browser
- Download file 2.62 kB
-
https://huggingface.co/spaces/Rsnarsna/Saas-Base/resolve/main/apps/intelligence/admin.py
- Command line
-
hf download hf://spaces/Rsnarsna/Saas-Base/apps/intelligence/admin.py
-
curl -L -o admin.py https://huggingface.co/spaces/Rsnarsna/Saas-Base/resolve/main/apps/intelligence/admin.py
2.62 kB
| """ | |
| Admin configuration for the intelligence app. | |
| """ | |
| from django.contrib import admin | |
| from apps.intelligence.models import ( | |
| AIModel, | |
| AIPrompt, | |
| Anomaly, | |
| APIRequestLog, | |
| ChatMessage, | |
| ChatSession, | |
| ContentEmbedding, | |
| EventLog, | |
| FeatureUsageLog, | |
| Metric, | |
| ReadModelCache, | |
| RiskScore, | |
| ) | |
| class ChatMessageInline(admin.TabularInline): | |
| model = ChatMessage | |
| extra = 0 | |
| readonly_fields = ("created_at",) | |
| class EventLogAdmin(admin.ModelAdmin): | |
| list_display = ("event_type", "actor_user", "org", "ip_address", "created_at") | |
| list_filter = ("event_type",) | |
| search_fields = ("event_type",) | |
| readonly_fields = ("created_at",) | |
| class AIModelAdmin(admin.ModelAdmin): | |
| list_display = ("name", "provider", "is_active", "created_at") | |
| list_filter = ("provider", "is_active") | |
| class AIPromptAdmin(admin.ModelAdmin): | |
| list_display = ("slug", "version", "is_active", "created_at") | |
| list_filter = ("is_active",) | |
| search_fields = ("slug",) | |
| class ChatSessionAdmin(admin.ModelAdmin): | |
| list_display = ("title", "user", "model", "created_at") | |
| list_filter = ("model",) | |
| inlines = [ChatMessageInline] | |
| class ChatMessageAdmin(admin.ModelAdmin): | |
| list_display = ("session", "role", "tokens_used", "created_at") | |
| list_filter = ("role",) | |
| class ContentEmbeddingAdmin(admin.ModelAdmin): | |
| list_display = ("content_type", "content_id", "created_at") | |
| list_filter = ("content_type",) | |
| class RiskScoreAdmin(admin.ModelAdmin): | |
| list_display = ("user", "score", "calculated_at") | |
| class AnomalyAdmin(admin.ModelAdmin): | |
| list_display = ("user", "anomaly_type", "severity", "created_at") | |
| list_filter = ("severity", "anomaly_type") | |
| class MetricAdmin(admin.ModelAdmin): | |
| list_display = ("metric_key", "value", "recorded_at") | |
| list_filter = ("metric_key",) | |
| class ReadModelCacheAdmin(admin.ModelAdmin): | |
| list_display = ("cache_key", "org", "refreshed_at") | |
| class FeatureUsageLogAdmin(admin.ModelAdmin): | |
| list_display = ("feature_key", "user", "org", "used_at") | |
| list_filter = ("feature_key",) | |
| class APIRequestLogAdmin(admin.ModelAdmin): | |
| list_display = ("request_id", "method", "endpoint", "status_code", "duration_ms", "created_at") | |
| list_filter = ("method", "status_code") | |