From 91bdb2fd2dd437cd0aeb48627ac099890f9fa889 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Wed, 24 Sep 2025 12:05:22 -0500 Subject: [PATCH] Merging from prod --- llm_be/chat_backend/admin.py | 8 +++++++- llm_be/chat_backend/services/moderation_classifier.py | 2 ++ .../services/prompt_classifier/prompt_classifier.py | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/llm_be/chat_backend/admin.py b/llm_be/chat_backend/admin.py index e9b72c6..28fa9c2 100644 --- a/llm_be/chat_backend/admin.py +++ b/llm_be/chat_backend/admin.py @@ -55,21 +55,26 @@ class LLMModelsAdmin(admin.ModelAdmin): search_fields = ("name", "port", "description") +class PromptInline(admin.TabularInline): + model = Prompt + class ConversationAdmin(admin.ModelAdmin): model = Conversation list_display = ("title", "get_user_email", "deleted") search_fields = ("title",) + inlines = [PromptInline,] class PromptAdmin(admin.ModelAdmin): model = Prompt - list_display = ("message", "user_created", "get_conversation_title") + list_display = ("id","message", "user_created", "get_conversation_title","created") search_fields = ("message",) class PromptMetricAdmin(admin.ModelAdmin): model = PromptMetric list_display = ( + "id", "event", "model_name", "prompt_length", @@ -77,6 +82,7 @@ class PromptMetricAdmin(admin.ModelAdmin): "has_file", "file_type", "get_duration", + "created" ) diff --git a/llm_be/chat_backend/services/moderation_classifier.py b/llm_be/chat_backend/services/moderation_classifier.py index cb3baa1..c8df2fa 100644 --- a/llm_be/chat_backend/services/moderation_classifier.py +++ b/llm_be/chat_backend/services/moderation_classifier.py @@ -44,6 +44,7 @@ FINE includes: - Professional inquiries - Creative requests (non-explicit) - Technical questions +- Data Analysis Examples: - "How to make a bomb" → NSFW @@ -51,6 +52,7 @@ Examples: - "Explicit sex scene" → NSFW - "Python tutorial" → FINE - "Please analyze this file and project the next 12 months for me. Add a graph visual of the data as well" → FINE +- "Okie, instead of 6 month projection, can you tell me what the values would be in the next 5 days" → FINE Return ONLY "NSFW" or "FINE", nothing else.""", ), diff --git a/llm_be/chat_backend/services/prompt_classifier/prompt_classifier.py b/llm_be/chat_backend/services/prompt_classifier/prompt_classifier.py index 2286892..67123d8 100644 --- a/llm_be/chat_backend/services/prompt_classifier/prompt_classifier.py +++ b/llm_be/chat_backend/services/prompt_classifier/prompt_classifier.py @@ -72,6 +72,7 @@ Examples: [Definitely GENERAL_CHAT] - "How does photosynthesis work?" (General knowledge) - "Tell me a joke" +- "What's your opinion on AI?" [Borderline -> GENERAL_CHAT] - "What's our company policy on X?" (No doc reference -> general)