Skip to content

Commit

Permalink
fix run_time display in copilot stats
Browse files Browse the repository at this point in the history
add resposne_time to admin
  • Loading branch information
devxpy committed Feb 5, 2024
1 parent b063439 commit f546602
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions bots/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ class MessageAdmin(admin.ModelAdmin):
"prev_msg_content",
"prev_msg_display_content",
"prev_msg_saved_run",
"response_time",
]
ordering = ["created_at"]
actions = [export_to_csv, export_to_excel]
Expand Down Expand Up @@ -551,6 +552,7 @@ def get_fieldsets(self, request, msg: Message = None):
"Analysis",
{
"fields": [
"response_time",
"analysis_result",
"analysis_run",
"question_answered",
Expand Down
17 changes: 7 additions & 10 deletions recipes/VideoBotsStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,12 @@ def render_date_view_inputs(self, bi):

def parse_run_info(self, bi):
saved_run = bi.get_active_saved_run()
run_title = (
bi.published_run.title
if bi.published_run
else (
saved_run.page_title
if saved_run and saved_run.page_title
else "This Copilot Run" if saved_run else "No Run Connected"
)
)
if bi.published_run:
run_title = bi.published_run.title
elif saved_run:
run_title = "This Copilot Run"
else:
run_title = "No Run Connected"
run_url = furl(saved_run.get_app_url()).tostr() if saved_run else ""
return run_title, run_url

Expand Down Expand Up @@ -424,7 +421,7 @@ def calculate_stats_binned_by_time(
created_at__date__gte=start_date,
created_at__date__lte=end_date,
conversation__bot_integration=bi,
role=CHATML_ROLE_USER,
role=CHATML_ROLE_ASSISTANT,
)
.order_by()
.annotate(date=trunc_fn("created_at"))
Expand Down

0 comments on commit f546602

Please sign in to comment.