Skip to content

Commit 0cd3292

Browse files
committed
fix middleware
1 parent cc053e8 commit 0cd3292

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

dashboard/ai-analytics/src/middleware.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export default clerkMiddleware(async (auth) => {
4848
type: "PIPES:READ",
4949
resource: "llm_usage",
5050
fixed_params: { organization: orgName }
51+
},
52+
{
53+
type: "PIPES:READ",
54+
resource: "llm_dimensions",
55+
fixed_params: { organization: orgName }
5156
}
5257
],
5358
limits: {

tinybird/endpoints/llm_dimensions.pipe

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@ TOKEN read_pipes READ
22

33
NODE llm_dimensions_node
44
SQL >
5+
%
56
SELECT
6-
groupUniqArray(organization) as organization,
7+
groupUniqArray(organization) as organizations,
78
groupUniqArray(project) as project,
89
groupUniqArray(environment) as environment,
910
groupUniqArray(model) as model,
1011
groupUniqArray(provider) as provider
11-
FROM llm_events WHERE timestamp > now() - interval '1 month'
12+
FROM
13+
(
14+
SELECT organization, project, environment, model, provider
15+
FROM
16+
llm_events WHERE timestamp > now() - interval '1 month'
17+
{% if defined(organization) and organization != '' %}
18+
AND organization = {{String(organization, '')}}
19+
{% end %}
20+
)
21+
1222

1323
TYPE endpoint

0 commit comments

Comments
 (0)