Skip to content

Commit

Permalink
Fix llm queries (#16006)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A

---------

Co-authored-by: Marshall <[email protected]>
  • Loading branch information
maxbrunsfeld and maxdeviant authored Aug 9, 2024
1 parent 06625bf commit 240b7c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Procfile.postgrest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
app: postgrest crates/collab/postgrest_app.conf
llm: postgrest crates/collab/postgrest_llm.conf
4 changes: 4 additions & 0 deletions crates/collab/postgrest_app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
db-uri = "postgres://postgres@localhost/zed_llm"
server-port = 8082
jwt-secret = "the-postgrest-jwt-secret-for-authorization"
log-level = "info"
File renamed without changes.
4 changes: 4 additions & 0 deletions crates/collab/src/llm/db/queries/usages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,16 @@ impl LlmDatabase {

let users_in_recent_minutes = usage::Entity::find()
.filter(usage::Column::Timestamp.gte(minute_since.naive_utc()))
.select_only()
.column(usage::Column::UserId)
.group_by(usage::Column::UserId)
.count(&*tx)
.await? as usize;

let users_in_recent_days = usage::Entity::find()
.filter(usage::Column::Timestamp.gte(day_since.naive_utc()))
.select_only()
.column(usage::Column::UserId)
.group_by(usage::Column::UserId)
.count(&*tx)
.await? as usize;
Expand Down

0 comments on commit 240b7c6

Please sign in to comment.