Skip to content

Commit 02684d1

Browse files
committed
chore: remove zod dependency
1 parent 8f09ecb commit 02684d1

5 files changed

Lines changed: 61 additions & 52 deletions

File tree

apps/api/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
"stripe": "catalog:",
5151
"superjson": "catalog:",
5252
"ua-parser-js": "catalog:",
53-
"uuid": "catalog:",
54-
"zod": "catalog:"
53+
"uuid": "catalog:"
5554
},
5655
"devDependencies": {
5756
"@conar/configs": "workspace:*",

apps/api/src/orpc/routers/ai/ask__legacy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async function generateStream({
101101
'',
102102
'## Available Tools',
103103
'',
104-
'User Provided Context',
104+
'User provided context:',
105105
context,
106106
].join('\n'),
107107
},

apps/api/src/orpc/routers/ai/filters.ts

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,20 @@
11
import { google } from '@ai-sdk/google'
22
import { SQL_FILTERS_GROUPED, SQL_FILTERS_LIST } from '@conar/shared/filters/sql'
3-
import { asSchema, generateText, Output } from 'ai'
3+
import { generateText, Output } from 'ai'
44
import { type } from 'arktype'
55
import { consola } from 'consola'
66
import { withPosthog } from '~/lib/posthog'
77
import { authMiddleware, orpc } from '~/orpc'
88

9-
const sqlFilterOperatorValues = SQL_FILTERS_LIST.map(filter => filter.operator)
10-
const sqlFilterOperators = type.enumerated(...sqlFilterOperatorValues)
11-
129
export const filters = orpc
1310
.use(authMiddleware)
14-
.input(
15-
type({
16-
prompt: 'string',
17-
context: 'string',
18-
}),
19-
)
11+
.input(type({
12+
prompt: 'string',
13+
context: 'string',
14+
}))
2015
.handler(async ({ input, signal, context }) => {
2116
consola.info('[SQL FILTERS] input', input.prompt)
2217

23-
const filterSchema = type({
24-
column: 'string',
25-
operator: sqlFilterOperators,
26-
values: 'string[]',
27-
})
28-
29-
const schema = asSchema(
30-
type({
31-
'filters': filterSchema.array(),
32-
'orderBy?': type({ '[string]': `'ASC' | 'DESC'` }),
33-
}).describe(
34-
'An object with filters array and optional orderBy object; each filter has column, operator, and values; orderBy maps column names to sort direction.',
35-
),
36-
)
37-
3818
const { output: result } = await generateText({
3919
model: withPosthog(google('gemini-2.0-flash'), {
4020
prompt: input.prompt,
@@ -58,12 +38,12 @@ export const filters = orpc
5838
'- User can paste only the value, you should try to understand to which column the value belongs',
5939
'- Try to generate at least one filter unless the prompt is completely unclear',
6040
'',
61-
'Ordering:',
62-
'- If the user requests sorting or ordering (e.g., "sort by date descending", "order by name ascending"), generate an orderBy object.',
63-
'- Use the exact column names from the context for ordering.',
64-
'- The orderBy object should have the column name as the key and the direction as the value ("ASC" for ascending, "DESC" for descending).',
65-
'- If no ordering is specified in the prompt, you may omit the orderBy object.',
66-
'',
41+
// 'Ordering:',
42+
// '- If the user requests sorting or ordering (e.g., "sort by date descending", "order by name ascending"), generate an orderBy object.',
43+
// '- Use the exact column names from the context for ordering.',
44+
// '- The orderBy object should have the column name as the key and the direction as the value ("ASC" for ascending, "DESC" for descending).',
45+
// '- If no ordering is specified in the prompt, you may omit the orderBy object.',
46+
// '',
6747
`Current time: ${new Date().toISOString()}`,
6848
`Available operators: ${JSON.stringify(SQL_FILTERS_GROUPED, null, 2)}`,
6949
'',
@@ -73,9 +53,15 @@ export const filters = orpc
7353
prompt: input.prompt,
7454
abortSignal: signal,
7555
output: Output.object({
76-
schema,
77-
description:
78-
'An array of objects with the following properties: column, operator, values where the operator is one of the SQL operators available',
56+
schema: type({
57+
filters: type({
58+
column: 'string',
59+
operator: type.enumerated(...SQL_FILTERS_LIST.map(filter => filter.operator)),
60+
values: 'string[]',
61+
}).array(),
62+
// 'orderBy?': type({ '[string]': `'ASC' | 'DESC'` }),
63+
}).describe('An object with filters array and optional orderBy object; each filter has column, operator, and values; orderBy maps column names to sort direction.'),
64+
description: 'An array of objects with the following properties: column, operator, values where the operator is one of the SQL operators available',
7965
}),
8066
})
8167

pnpm-lock.yaml

Lines changed: 39 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ catalog:
162162
uuid: ^13.0.0
163163
vite: ^7.3.1
164164
vite-tsconfig-paths: ^6.0.3
165-
zod: ^4.3.5
166165

167166
ignoredBuiltDependencies:
168167
- '@firebase/util'

0 commit comments

Comments
 (0)