Skip to content

Commit 6e6f6f8

Browse files
authored
Move Evaluations to Document tab (#963)
* Revert "Revert "Move Evaluations to Document tab (#952)"" This reverts commit 1550ea5. * Move Evaluations to Document tab * fix styles * defend against store error
1 parent b81a307 commit 6e6f6f8

File tree

34 files changed

+308
-1387
lines changed

34 files changed

+308
-1387
lines changed

apps/web/src/actions/evaluations/create.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
EvaluationMetadataType,
55
resultConfigurationSchema,
66
} from '@latitude-data/core/browser'
7+
import { connectEvaluations } from '@latitude-data/core/services/evaluations/connect'
78
import { createEvaluation } from '@latitude-data/core/services/evaluations/create'
89
import { z } from 'zod'
910

@@ -36,11 +37,12 @@ export const createEvaluationAction = authProcedure
3637
simpleEvaluationMetadataSchema,
3738
defaultEvaluationMetadataSchema,
3839
]),
40+
documentUuid: z.string().optional(),
3941
}),
4042
{ type: 'json' },
4143
)
4244
.handler(async ({ input, ctx }) => {
43-
const result = await createEvaluation({
45+
const evaluation = await createEvaluation({
4446
workspace: ctx.workspace,
4547
user: ctx.user,
4648
name: input.name,
@@ -49,7 +51,16 @@ export const createEvaluationAction = authProcedure
4951
metadata: input.metadata,
5052
resultType: input.resultConfiguration.type,
5153
resultConfiguration: input.resultConfiguration,
52-
})
54+
}).then((r) => r.unwrap())
5355

54-
return result.unwrap()
56+
if (input.documentUuid) {
57+
await connectEvaluations({
58+
workspace: ctx.workspace,
59+
documentUuid: input.documentUuid,
60+
evaluationUuids: [evaluation.uuid],
61+
user: ctx.user,
62+
}).then((r) => r.unwrap())
63+
}
64+
65+
return evaluation
5566
})

apps/web/src/actions/evaluations/createFromPrompt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const createEvaluationFromPromptAction = withDocument
3333
{ type: 'json' },
3434
)
3535
.handler(async ({ input, ctx }) => {
36-
const result = await createEvaluation({
36+
const evaluation = await createEvaluation({
3737
workspace: ctx.workspace,
3838
name: input.name,
3939
description: 'AI-generated evaluation',
@@ -50,7 +50,7 @@ export const createEvaluationFromPromptAction = withDocument
5050
user: ctx.user,
5151
projectId: ctx.project.id,
5252
documentUuid: ctx.document.documentUuid,
53-
})
53+
}).then((r) => r.unwrap())
5454

55-
return result.unwrap()
55+
return evaluation
5656
})

apps/web/src/app/(private)/_lib/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const NAV_LINKS = [
1212

1313
export const MAIN_NAV_LINKS = [
1414
{ label: 'Projects', value: ROUTES.dashboard.root as string },
15-
{ label: 'Evaluations', value: ROUTES.evaluations.root as string },
1615
{ label: 'Datasets', value: ROUTES.datasets.root as string },
1716
{ label: 'Traces', value: ROUTES.traces.root as string },
1817
{ label: 'Settings', value: ROUTES.settings.root as string },

apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/_components/EvaluationTabs/index.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/dashboard/_components/ConnectedDocumentsTable/index.tsx

Lines changed: 0 additions & 148 deletions
This file was deleted.

apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/dashboard/_components/EvaluationStats.tsx

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)