Skip to content

Commit bc15441

Browse files
committed
lint
1 parent e4818ea commit bc15441

File tree

44 files changed

+1190
-1068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1190
-1068
lines changed

apps/api/src/agent/core/ai-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ export class AIService {
6565
throw error;
6666
}
6767
}
68-
}
68+
}

apps/api/src/agent/core/response-processor.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { StreamingUpdate } from '@databuddy/shared';
12
import type { z } from 'zod';
23
import { handleChartResponse } from '../handlers/chart-handler';
34
import { handleMetricResponse } from '../handlers/metric-handler';
45
import type { AIResponseJsonSchema } from '../prompts/agent';
5-
import type { StreamingUpdate } from '@databuddy/shared';
66
import { generateThinkingSteps } from '../utils/stream-utils';
77
import type { AssistantSession } from './assistant-session';
88

@@ -45,11 +45,17 @@ export class ResponseProcessor {
4545

4646
switch (response.response_type) {
4747
case 'text': {
48-
if (!response.text_response || response.text_response.trim().length === 0) {
49-
session.log('Warning: AI returned text response with empty text_response field');
48+
if (
49+
!response.text_response ||
50+
response.text_response.trim().length === 0
51+
) {
52+
session.log(
53+
'Warning: AI returned text response with empty text_response field'
54+
);
5055
result = {
5156
type: 'error',
52-
content: 'I had trouble generating a response. Could you try rephrasing your question?',
57+
content:
58+
'I had trouble generating a response. Could you try rephrasing your question?',
5359
};
5460
} else {
5561
result = {

apps/api/src/agent/prompts/agent.ts

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,58 @@
11
import { z } from 'zod';
22
import type { AssistantRequestType } from '../../schemas/assistant-schemas';
33

4-
export const AIResponseJsonSchema = z.object({
5-
sql: z.string().optional(),
6-
chart_type: z
7-
.enum([
8-
'bar',
9-
'horizontal_bar',
10-
'line',
11-
'sparkline',
12-
'pie',
13-
'donut',
14-
'area',
15-
'unstacked_area',
16-
'stacked_bar',
17-
'multi_line',
18-
'scatter',
19-
'bubble',
20-
'radar',
21-
'funnel',
22-
'grouped_bar',
23-
'histogram',
24-
'treemap',
25-
'gauge',
26-
])
27-
.optional(),
28-
response_type: z.enum(['chart', 'text', 'metric']),
29-
text_response: z.string().min(1, "text_response cannot be empty").optional(),
30-
metric_value: z.string().optional(),
31-
metric_label: z.string().optional(),
32-
thinking_steps: z.array(z.string()).optional(),
33-
}).refine((data) => {
34-
if (data.response_type === 'text') {
35-
return data.text_response && data.text_response.trim().length > 0;
36-
}
37-
if (data.response_type === 'metric') {
38-
return data.metric_value && data.metric_label;
39-
}
40-
if (data.response_type === 'chart') {
41-
return data.sql && data.chart_type;
42-
}
43-
return true;
44-
}, {
45-
message: "Response must have required fields populated based on response_type",
46-
});
4+
export const AIResponseJsonSchema = z
5+
.object({
6+
sql: z.string().optional(),
7+
chart_type: z
8+
.enum([
9+
'bar',
10+
'horizontal_bar',
11+
'line',
12+
'sparkline',
13+
'pie',
14+
'donut',
15+
'area',
16+
'unstacked_area',
17+
'stacked_bar',
18+
'multi_line',
19+
'scatter',
20+
'bubble',
21+
'radar',
22+
'funnel',
23+
'grouped_bar',
24+
'histogram',
25+
'treemap',
26+
'gauge',
27+
])
28+
.optional(),
29+
response_type: z.enum(['chart', 'text', 'metric']),
30+
text_response: z
31+
.string()
32+
.min(1, 'text_response cannot be empty')
33+
.optional(),
34+
metric_value: z.string().optional(),
35+
metric_label: z.string().optional(),
36+
thinking_steps: z.array(z.string()).optional(),
37+
})
38+
.refine(
39+
(data) => {
40+
if (data.response_type === 'text') {
41+
return data.text_response && data.text_response.trim().length > 0;
42+
}
43+
if (data.response_type === 'metric') {
44+
return data.metric_value && data.metric_label;
45+
}
46+
if (data.response_type === 'chart') {
47+
return data.sql && data.chart_type;
48+
}
49+
return true;
50+
},
51+
{
52+
message:
53+
'Response must have required fields populated based on response_type',
54+
}
55+
);
4756

4857
export type AIResponse = z.infer<typeof AIResponseJsonSchema>;
4958

apps/dashboard/app/(auth)/login/page.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
'use client';
22

33
import { signIn } from '@databuddy/auth/client';
4-
import { EyeIcon, EyeSlashIcon, GithubLogoIcon, SpinnerIcon, SparkleIcon, GoogleLogoIcon } from '@phosphor-icons/react';
4+
import {
5+
EyeIcon,
6+
EyeSlashIcon,
7+
GithubLogoIcon,
8+
GoogleLogoIcon,
9+
SparkleIcon,
10+
SpinnerIcon,
11+
} from '@phosphor-icons/react';
512
import Link from 'next/link';
613
import { useRouter } from 'next/navigation';
714
import { Suspense, useEffect, useState } from 'react';
@@ -100,7 +107,7 @@ function LoginPage() {
100107

101108
return (
102109
<>
103-
<div className="mb-8 text-center -mt-8">
110+
<div className="-mt-8 mb-8 text-center">
104111
<h1 className="font-bold text-2xl text-foreground">Welcome back</h1>
105112
<p className="mt-2 text-muted-foreground">
106113
Sign in to your account to continue your journey with Databuddy
@@ -111,7 +118,7 @@ function LoginPage() {
111118
<div className="-bottom-40 -left-40 pointer-events-none absolute h-80 w-80 rounded-full blur-3xl" />
112119
<div className="relative z-10">
113120
<div className="space-y-6">
114-
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 -mt-2">
121+
<div className="-mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2">
115122
<Button
116123
className="relative flex h-11 w-full cursor-pointer items-center justify-center transition-all duration-200 hover:bg-primary/5"
117124
disabled={isLoading}
@@ -122,7 +129,7 @@ function LoginPage() {
122129
<GithubLogoIcon className="mr-2 h-5 w-5" />
123130
<span>Sign in with GitHub</span>
124131
{lastUsed === 'github' && (
125-
<span className="absolute -top-4 -right-0.5 inline-flex items-center rounded-full border border-primary/20 bg-primary/10 px-1.5 py-0.5 font-medium text-primary text-xs">
132+
<span className="-top-4 -right-0.5 absolute inline-flex items-center rounded-full border border-primary/20 bg-primary/10 px-1.5 py-0.5 font-medium text-primary text-xs">
126133
Last used
127134
</span>
128135
)}
@@ -137,7 +144,7 @@ function LoginPage() {
137144
<GoogleLogoIcon className="mr-2 h-5 w-5" />
138145
<span>Sign in with Google</span>
139146
{lastUsed === 'google' && (
140-
<span className="absolute -top-4 -right-0.5 inline-flex items-center rounded-full border border-primary/20 bg-primary/10 px-1.5 py-0.5 font-medium text-primary text-xs">
147+
<span className="-top-4 -right-0.5 absolute inline-flex items-center rounded-full border border-primary/20 bg-primary/10 px-1.5 py-0.5 font-medium text-primary text-xs">
141148
Last used
142149
</span>
143150
)}
@@ -161,7 +168,7 @@ function LoginPage() {
161168
<div className="relative">
162169
<Input
163170
autoComplete="email"
164-
className="h-11 border-none text-foreground bg-input transition-all duration-200 focus:ring-2 focus:ring-primary/20 placeholder:text-muted-foreground/50"
171+
className="h-11 border-none bg-input text-foreground transition-all duration-200 placeholder:text-muted-foreground/50 focus:ring-2 focus:ring-primary/20"
165172
id="email"
166173
name="email"
167174
onChange={(e) => setEmail(e.target.value)}
@@ -197,7 +204,7 @@ function LoginPage() {
197204
<div className="relative">
198205
<Input
199206
autoComplete="current-password"
200-
className="h-11 pr-10 bg-input border-none transition-all duration-200 focus:ring-2 focus:ring-primary/20 placeholder:text-muted-foreground/50"
207+
className="h-11 border-none bg-input pr-10 transition-all duration-200 placeholder:text-muted-foreground/50 focus:ring-2 focus:ring-primary/20"
201208
id="password"
202209
name="password"
203210
onChange={(e) => setPassword(e.target.value)}
@@ -207,7 +214,9 @@ function LoginPage() {
207214
value={password}
208215
/>
209216
<Button
210-
aria-label={showPassword ? 'Hide password' : 'Show password'}
217+
aria-label={
218+
showPassword ? 'Hide password' : 'Show password'
219+
}
211220
className="absolute top-0 right-0 h-full px-3 text-muted-foreground hover:text-foreground"
212221
onClick={() => setShowPassword(!showPassword)}
213222
size="sm"

apps/dashboard/app/(main)/observability/layout.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export default function ObservabilityLayout({
44
children: React.ReactNode;
55
}) {
66
return (
7-
<div className="mx-auto max-w-[1600px] space-y-6 p-4 sm:p-6 lg:p-8">{children}</div>
7+
<div className="mx-auto max-w-[1600px] space-y-6 p-4 sm:p-6 lg:p-8">
8+
{children}
9+
</div>
810
);
9-
}
11+
}

apps/dashboard/app/(main)/revenue/_components/onboarding/steps/overview-step.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ export function OverviewStep({ onNext }: OverviewStepProps) {
1111
return (
1212
<div className="space-y-4">
1313
<div className="rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-950/20">
14-
<h3 className="mb-2 font-medium text-foreground">
15-
What you'll get:
16-
</h3>
14+
<h3 className="mb-2 font-medium text-foreground">What you'll get:</h3>
1715
<ul className="space-y-2 text-muted-foreground text-sm">
1816
<li className="flex items-center gap-2">
1917
<CheckCircleIcon

0 commit comments

Comments
 (0)