Skip to content

Commit

Permalink
Merge branch 'main' into style/truncate-model-names
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt authored Jun 21, 2024
2 parents 7224cf5 + c36a2a9 commit fd55915
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 33 deletions.
2 changes: 1 addition & 1 deletion ops
Submodule ops updated from ab1dcd to bfbff5
24 changes: 3 additions & 21 deletions packages/backend/src/api/v1/runs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,39 +150,21 @@ runs.get("/", async (ctx: Context) => {
eu.last_seen as user_last_seen,
eu.props as user_props,
t.slug as template_slug,
rpfc.feedback as parent_feedback,
coalesce(array_agg(
jsonb_build_object(
'evaluatorName', e.name,
'evaluatorSlug', e.slug,
'evaluatorId', e.id,
'result', er.result,
'createdAt', er.created_at,
'updatedAt', er.updated_at
)
) filter (where er.run_id is not null), '{}') as evaluation_results
rpfc.feedback as parent_feedback
from
public.run r
run r
left join external_user eu on r.external_user_id = eu.id
left join run_parent_feedback_cache rpfc on r.id = rpfc.id
left join template_version tv on r.template_version_id = tv.id
left join template t on tv.template_id = t.id
left join evaluation_result_v2 er on r.id = er.run_id
left join evaluator e on er.evaluator_id = e.id
where
r.project_id = ${projectId}
${parentRunCheck}
and (${filtersQuery})
group by
r.id,
eu.id,
t.slug,
rpfc.feedback
order by
r.created_at desc
limit ${exportType ? 10000 : Number(limit)}
offset ${Number(page) * Number(limit)}
`
offset ${Number(page) * Number(limit)}`

const runs = rows.map(formatRun)

Expand Down
3 changes: 1 addition & 2 deletions packages/backend/src/checks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ export const CHECK_RUNNERS: CheckRunner[] = [
{
id: "search",
sql: ({ query }) =>
sql`(to_tsvector('simple', substring(r.input_text, 1, 948575)) @@ plainto_tsquery('simple', ${query})
or to_tsvector('simple', substring(r.output_text, 1, 948575)) @@ plainto_tsquery('simple', ${query}))`,
sql`(r.input_text ilike ${`%${query}%`} or r.output_text ilike ${`%${query}%`})`,
},
{
id: "string",
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/utils/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ function debugFn(
parameters: any[],
paramTypes: any[],
) {
// for (let i = 0; i <= parameters.length; i++) {
// let regex = new RegExp(`\\$${i + 1}`, "g")
// query = query.replace(regex, `'${parameters[i]}'`)
// }

console.log("connection:", connection)
console.log("query:", query)
console.log("parameters:", parameters)
Expand Down
2 changes: 2 additions & 0 deletions packages/db/0021.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
create index on run using gin (input_text gin_trgm_ops);
create index on run using gin (output_text gin_trgm_ops);
51 changes: 51 additions & 0 deletions packages/frontend/next.config-monolith.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
],
},
async rewrites() {
const redirects = [
{
source: '/api/:path*',
destination: 'http://localhost:3333/:path*'
},
{
source: '/api/auth/:path*',
destination: 'http://localhost:3333/auth/:path*'
}
]


return redirects
},
webpack: (config, { webpack }) => {
config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /^pg-native$|^cloudflare:sockets$/,
}),
)

return config
},
transpilePackages: ["shared"],
}

module.exports = nextConfig
7 changes: 0 additions & 7 deletions packages/frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ const nextConfig = {
},
]

if(process.env.IS_SELF_HOSTED_MONOLITHIC) {
redirects.push({
source: '/api/path:*',
destination: 'http://localhost:3333/api/path:*'
})
}

return redirects
},
webpack: (config, { webpack }) => {
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/pages/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ export default function Analytics() {
serializedChecks,
)

console.log(tokensData)
const { data: costData, isLoading: costDataLoading } = useAnalyticsChartData(
"costs",
startDate,
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/pages/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export default function AppAnalytics() {
const { data: projectUsage, isLoading: projectUsageLoading } = useSWR(
project?.id && org && `/orgs/${org.id}/usage?projectId=${project?.id}`,
)
console.log(projectUsage)

return (
<Container className="unblockable">
Expand Down

0 comments on commit fd55915

Please sign in to comment.