Commit graph

158 commits

Author SHA1 Message Date
Mish
a1f3ebfaf6
Add a tickets API (#156)
* Add a tickets API

* Add more fields to JSON response for /api/ticket and /api/tickets

* Prevent returning a massive number of tickets by default

* Add an order to the query

* Document /api/tickets
2026-02-05 02:53:13 +00:00
Mish
7a4546a917
Unbreak stats API v1! (#155) 2026-02-03 19:43:14 +00:00
Mish
311c7341a1
Add a stats v2 endpoint (#154)
* Add a stats v2 endpoint

* Make helpers_leaderboard json-friendly

* Improve naming of hang time stats

* Make new_tickets_now_closed do what it says for ranges in the past

* Add some docs!

* Split all-time hang time into unresolved/all

* Add a statistic for oldest question waiting for a helper response (#152)

* Silence type error (that was annoying me)

* Add new metric: oldest_unanswered_ticket_age_minutes

* Fix datetime subtraction exception

* Add oldest unanswered ticket info to stats v2
2026-02-03 00:53:50 +00:00
Mish
1dd26d70f4
Add a statistic for oldest question waiting for a helper response (#152)
* Silence type error (that was annoying me)

* Add new metric: oldest_unanswered_ticket_age_minutes

* Fix datetime subtraction exception
2026-01-29 14:45:45 +00:00
Mish
e77a60e1ec
Add a "resolution time" statistic (#151)
* Add a resolution time stat

* Add resolution times to API

* Return None if no resolution time can be calculated

* Optionally calculate hang time for all tickets, not just in-progress ones

* Add avg_hang_time_all_minutes to API

* Store reopenedAt timestamp
2026-01-27 11:55:07 +00:00
Mish
6afc28a27c
Make SITE_API_KEY not required (#150) 2026-01-26 18:58:22 +00:00
Mish
2415abd4b1
Fix selfhosted images being served incorrectly (#148)
* Rename HOSTNAME env var to BASE_URL (and document it)

* BASE_URL.rstrip("/")

Prevent errors if you include / in your env var

* Trailing newline
2026-01-23 00:02:50 +00:00
Amber
541d131622
selfhost images (#147)
* move to self-hosting non-daily images

* remove log
2026-01-22 15:39:11 +00:00
Mish
19422a0ac4
Fraud dept => Fraud Squad (#146) 2026-01-21 10:37:40 +00:00
Mish
f18f34e5c1
Add README to Jumpstart ticket_create msg (#145) 2026-01-17 13:27:57 +00:00
Saleh
cfbf0dc08f
Update shipcert queue command for flavortown! (#144)
* Added shipwrights macro

* fixes ig idk?

* renamed class for consistency

* reordered imports

* removed extra space

* Update README.md

* Adjust grammar in ?shipwrights response

* Remove spaces next to newlines

* Updated ?shipcertqueue to be ?shipqueue and added it to flavortown!

* fixed var type and capitalization of program now

* new line at the end of flavortown.py

* run pre-commit

* Add old macro name as an alias

* one more alias. just one more alias. okay? okay.

* Make types consistent again

* Fix the default value

---------

Co-authored-by: MMK21Hub <50421330+MMK21Hub@users.noreply.github.com>
2026-01-16 20:10:08 +00:00
Alex
2d7d0a03f0
Fixed Jumpstart Grammar & Responses (#143)
* Jumpstart transcript

* Added Jumpstart to init

* Alphabetically ordered all local imports

* Seperate lines

* Fixed grammar and responses

* Added README

* Fixed Precheck

* Fix typo: READNE => README

* Rename variable to match naming convention

* Add space after bullet point

* Remove spaces at the end of each line

---------

Co-authored-by: MMK21Hub <50421330+MMK21Hub@users.noreply.github.com>
2026-01-16 19:50:20 +00:00
Mish
620939dcb8
Add deployment instructions (#141) 2026-01-04 23:28:14 +00:00
Alex
0823715421
Added Jumpstart YSWS (#140)
* Jumpstart transcript

* Added Jumpstart to init

* Alphabetically ordered all local imports

* Seperate lines
2026-01-04 19:21:19 +00:00
Saleh
1651ad2d38
Added shipwrights macro (#139)
* Added shipwrights macro

* fixes ig idk?

* renamed class for consistency

* reordered imports

* removed extra space

* Update README.md

* Adjust grammar in ?shipwrights response

* Remove spaces next to newlines

---------

Co-authored-by: MMK21Hub <50421330+MMK21Hub@users.noreply.github.com>
2025-12-28 01:20:31 +00:00
Mish
b156145811
First iteration of "question tags" (#136)
* Rename tags to team tags

* Add a TagType enum with TEAM and QUESTION options

* Ticket#questionTag exists now

* Revert "Add a TagType enum with TEAM and QUESTION options"

This reverts commit c9a17f4003aa2ce470f82810ac031fe83325f3d6.

* Add a new QuestionTag model

* Add another dropdown to the backend msg

* create tag => create team tag

* Add creating tags (from the backend channel)

* Create a single function for sending the backend message

Previously this code was duplicated across 2 places, making it inconsistent

* Rename a bunch of files; implement upating question tags on tickets

* Add a log!

* Fix ticket tag dropdowns in old msgs

* Auto-select the current question tag when a backend msg is posted

* Update backend message with the current tag

* Allow clearing the question tag

* Dynamically get question tag list

* Document question tags

* typo

* Change some log msgs to debug

* Only make the DB call if current_question_tag_id is present

* Remove unused variable

* Add createdAt to QuestionTag

* Ensure "reopened by [user]" is preserved when backend message is edited
2025-12-21 11:57:06 +00:00
Mish
983f895737
[WIP] Working on the daily summary message (#125)
* Add a ?dailystats macro for dev

* Get rid of all the overall stats in the daily summary

* Make the daily summary pie dark themed

* Write a module for unified stats calculation

* Use the stats module for the App Home leaderboards

* Ensure datetime types are tz-aware

* Use the stats module for the daily stats message

* Use the stats module for the stats API

* Implement get_unanswered_tickets()

* Add some functions for getting message links

* Format?

* Add old tickets to the daily stats message

* Remove unused import

* Fix calculation for new_tickets_in_progress

* fix typo

* Use correct stat for daily summary
2025-12-20 09:49:09 +00:00
Mish
e9455e0d1c
Fix the alaninnovates bug (#134)
* Add a little log

* Ensure closed tickets are attributed to helpers correctly

* Add a success log when a ticket is resolved
2025-12-14 00:06:14 +00:00
Mish
43967cf289
App home improvements! (#133)
* Show an error message if the views_publish call fails

This means that if our Block Kit has a syntax error and Slack API returns en error for it, a fallback screen is shown instead of indefinite loading

* Include nav buttons in the header

* Fix header formatting error

I think this was a GH Copilot hallucination that I accepted bc it looked very similar to the OG code :(

* Show header on the loading screen

* Make clicking on a button during the loading phase work

* Delete views/home/apps.py

I don't think this view is used anywhere

* Use the new header style everywhere

* Remove buttons.py (no longer used)

* Show "dashboard" tab as selected during first load

This means that the "default" virtual view name no longer exists, but we have a DEFAULT_VIEW constant now

* Add at least some sort of return type to get_header()

* Make the helper and assigned views non-helper-friendly

* Allow non-helpers to access the app home

* Remove useless `or` statement

* Extract error_screen to a component

* Gate the tags view to only helpers

* Make the tags view non-helper-friendly

* Make the stats view non-helper-friendly

* Make the error text a bit nicer

* Fix type error

* Make the infinite loading situation less likely

This could happen if you spam-clicked one of the buttons (I tested with assigned tickets). I think the problem existed before but was made worse by the new `user_last_requested_view` logic - now it's back to normal and the issue is very hard to recreate.

* Remove "unknown user" view and transcripts

* Remove commented code block

* Remove comment the second

* Fix timezone fetching and add more logs
2025-12-08 11:54:00 +00:00
Mish
8791e3ec54
Add more log attributes from Coolify-provided metadata (#131) 2025-12-02 01:24:18 +00:00
Mish
81dd26da2b
Add support for pushing logs to an OpenTelemetry endpoint (#130)
* Allow specifying log level per-logger

* Add support for sending logs to an OpenTelemetry endpoint

* Consistently use parse_level_name() for LOG_LEVEL_* env vars
2025-12-01 14:05:32 +00:00
Mish
14784f77d1
Preparation for improving the daily summary message (#124)
* Add lastMsgAt and lastMsgBy to DB

* Keep track of the last messages in threads

* Add UserType enum to schema

* Make both of the new fields optional

* Add data/ to .gitignore

* Only include users who have resolved tickets on the overall leaderboard

Fixes #96

* Fix docstring
2025-11-29 11:25:49 +00:00
Mish
2fc6a90a4d
Improvements to macros (#123)
* Attempts at getting macro aliases to work

* Store instances of macros as well as just the classes

* Add ?unresolve and ?open aliases for ?reopen

* Add an error message for invalid macros

* Add ?close as an alias for ?resolve

* Add error message for running a macro on a closed ticket

* Allow ?thread to be run on closed tickets

* Add type annotation to macro list
2025-11-29 11:22:08 +00:00
Balogh Barnabás
be77c20a18
Added Construct YSWS (#121)
* Added Construct YSWS

* Added to Construct to the list

* Pre commit runned
2025-11-23 23:34:25 +00:00
Mish
5567cc7673
Add a /api/ticket endpoint for ticket info (#122)
* Add a /api/ticket endpoint!

* Add some validation and user-friendly error msgs
2025-11-23 19:13:36 +00:00
Mish
df7ab83cb4
Handle exceptions from reactions_remove() calls (#119)
This is because I noticed this part of the code failing in the prod logs
2025-11-20 13:06:22 +00:00
Mish
7950126903
Ensure the Prisma VSCode extension sticks with Prisma v6 (#118)
Prisma v7 is JS-only, so I assume we won't ever be migrating to it :pf:

This change only affects devs using the Prisma extension for VSCode (mee!)
2025-11-20 13:06:17 +00:00
Mish
527fafe2b4
Add Promethus histograms for some parts of the code (#114)
* Add support for exporting code block times as histograms

* Adjust perf metrics

* Aff perf metrics for message processing and title gen

* Add metric for opening app home views

* Performance metrics are now defined individually

* Remove performance metric from slack.py

* New metrics for ticket title gen and app home rendering

* Prevent .labels({}) from happening

* Make import consistent
2025-11-17 11:23:09 +00:00
Mish
2cd5ad4b09
Add OpenAI dependency (#113) 2025-11-17 00:38:01 +00:00
Mish
86eb418220
Don't also send resolved message for most macros (#112)
* Don't send resolved message for most macros

* Make the ship cert macro only apply to SoM

* Add notes to the end of the resolving macros (for FT)
2025-11-16 17:44:48 +00:00
Mish
fdb729a00b
Refactoring around macros (#111)
* Use transcripts for most macro message texts

* Write a get_user_name() util

* Remove Fraudpheus reference

* Use get_user_name() in shipcertqueue.py

* Always impersonate in reopen.py

See 182771acdfd8eca0410f8c012f24e7cd51a71925

* Add user PFP method to slack_user.py

* Handle the case of a username not being present

* Use get_user_profile() to get user PFPs when tickets are (re)opened

* Remove comment

* Fix type error in reopen.py

* Guard against ts being not present in reopen.py

* Ensure consistent handling of profile_pic_512x() being None
2025-11-16 16:41:47 +00:00
Mish
f25a27afc7
Show ticket title in tagged ticket DM (#110) 2025-11-16 13:54:37 +00:00
Mish
4c3775d7c0
Bring back AI titles! (#109)
* Rewrite ticket title gen to use the new HC AI

* Use implicit string concatenation

* Use async OpenAI

* Guard against single-letter or all-whitespace AI responses

* Add a singular space
2025-11-16 12:45:47 +00:00
Mish
c2b73dcb96
Add a perf_timer() utility for timing blocks of code (#108)
* Add a perf_timer() utility for timing blocks of code

It has replaced raw perf_counter() calls in some files.

* Use perf_timer in ticket_status_pie.py

* Use perf_timer() for app home performance logging

* Remove plt.show() call

That was never meant to be there :pf:

* Print performance logs as debug logs
2025-11-15 21:46:14 +00:00
Mish
bb0fd03907
Fix log level logic being the wrong way around (#103) 2025-11-15 15:47:21 +00:00
Mish
68b2eb1e41
Make logging level configurable with an ENV var (#102) 2025-11-15 15:32:09 +00:00
Mish
8230f8560b
That's Leo, not Mish! (#101) 2025-11-15 15:13:55 +00:00
Mish
9e20174062
Split nephthys/events/message.py into procedures (#100)
* Extract some of the message handler into functions

* Add a send_user_facing_message function

* Improve type hints

* Remove redundant if statement check

* Remove unnecessary indentation

* Declare constant outside of function

* Add docstrings to 2 functions

Credit to GH Copilot :P

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix docstrings

* Add send_ticket_message docstring

* Fix profile_pic being set to "" instead of None

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-11 03:13:38 +00:00
Mish
accd86610e
Add a Docker healthcheck (#99)
* Add a Docker healthcheck

* Fix regexp

* Add --start-period to healthcheck
2025-11-11 02:28:28 +00:00
Chase Naples
20f7e8571b
chore: fill pyproject description (#98) 2025-11-10 12:37:33 +00:00
Amber
ea871bbc5d
update midnight faq (#95) 2025-11-08 21:18:17 +00:00
MMK21
415ee8576f
Rename "i get it now" button to "Mark as resolved" (#94)
* Add resolve_ticket_button to transcript

I also set "Mark as resolved" as the default wording for all instances

* Change button text back to "i get it now" for SoM and Identity

Backwards compatibility!
I think Midnight would be fine with the new default
2025-11-04 20:41:22 +00:00
Amber
76d6fa41a1
import midnight transcript (#91) 2025-11-03 18:42:02 +00:00
Leo
e857fe5b1e
add midnight transcript (#90) 2025-11-03 18:19:46 +00:00
MMK21
b54694e62d
Add a Prometheus metrics endpoint (#84)
* Add a Prometheus metrics endpoint

* Add starlette_exporter metrics

* Add Prisma metrics  to `/metrics`
2025-10-28 23:42:32 +00:00
MMK21
1a3818e413
Ensure the bot maintainer is always an admin (#88) 2025-10-28 23:16:49 +00:00
MMK21
c2f2584101
Make the header in app home configurable (#87)
* Add an app_title env var

* Use app_title in app home

* Fix header being wrapped in a tuple
2025-10-28 22:38:30 +00:00
MMK21
8f96d64267
Add files:write scope to app manifest (#86) 2025-10-28 22:37:25 +00:00
MMK21
f4fe7c3e9e
Improve response time when a new help message is sent (#82)
* Add a bunch of performance logs to on_message

* Remove duplicate DB user lookup

* Ensure Slack user info is only fetched once

* Make AI title generation happen after the FAQ message has been sent

* Make the performance logging debug-level

* Fix some perf calculations being incorrect

* Add type hint
2025-10-27 20:45:35 +00:00
MMK21
4e68152d08
Add a transcript for Flavortown (#80)
* Write v1 of the Flavortown transcript

* Remove summer reference from bot manifest

* Mrkdwn doesn't support bullet points, are we fr?

* Actually link help channel in resolve message
2025-10-26 17:01:18 +00:00