-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Realtime evaluation result table update #248
Realtime evaluation result table update #248
Conversation
async decrementEnqueued() { | ||
await this.redis.decr(this.getKey('enqueued')) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these 2 were not used
237a175
to
2c9350e
Compare
packages/core/src/events/handlers/createEvaluationResultJob.test.ts
Outdated
Show resolved
Hide resolved
050463f
to
b41280e
Compare
packages/core/src/services/evaluationResults/aggregations/countersQuery.test.ts
Show resolved
Hide resolved
b41280e
to
6b6097c
Compare
documentUuid, | ||
evaluationId, | ||
}) | ||
const { refetch: refetchTotals } = useEvaluationResultsCounters({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this refetch actually the mutate function? if so i wouldn't rename it it's better to expose the real name so devs understand what they can do with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew this will come out. I don't agree in this case to be honest. I think fetch express better the intention here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this function just triggers a new request to update the data, I agree with @andresgutgon here ☝️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it doesn't just do that, you can also pass it data to mutate the store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general yes, but in this use case is a refetch. We're talking semantics here
<ProgressIndicator state='running'> | ||
{`Running batch evaluation ${job.completed}/${job.total}`} | ||
</ProgressIndicator> | ||
)} | ||
{job.errors > 0 && !isDone(job) && ( | ||
{job.errors > 0 && !isEvaluationRunDone(job) && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually better to not remove this message even when it's done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How they can remove the message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
navigating away
documentUuid: string | ||
commit: Commit | ||
}): Promise<ReturnType<T>> { | ||
const aggregationTotals = await getEvaluationTotalsQuery({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these methods cached? add the suffix if so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not cached. Should they be cached? It's only called once here in the server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i always cache by default tbh, might not be necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rule of thumb is import { cache } from 'react'
is like a Rails per request singleton. Like current_user
. Only useful when is used more than once during that request.
evaluationResults={evaluationResults} | ||
evaluation={evaluation} | ||
isNumeric={isNumeric} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are already passing the evalution to the content component you don't need this derived state prop also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use to type the component with a generic
) { | ||
const { project } = useCurrentProject() | ||
const fetcher = useCallback(async () => { | ||
const [data, error] = await computeEvaluationResultsCountersAction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a pita so don't do it, but next time remember not to use server actions for fetching instead use regular api endpoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I feel like having to use regular api endpoints are more pita than server actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server actions are all post requests which doesn't allow for http caching, even react docs recommend not using server actions for fetching https://react.dev/reference/rsc/use-server#caveats
We've already implemented the first api endpoint so adding more it's trivial now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with pain in my heart
}, | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
evaluationId: evaluation.id, | ||
documentUuid: document.documentUuid, | ||
}, | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
evaluationId: evaluation.id, | ||
evaluationResultId: evaluationResult.id, | ||
row: evaluationResultWithMetadata, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are including workspaceId two times? not a big deal but weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convention I have is that what is inside data
is what is send to the browser. the workspaceId from outside is for the websocket server to know to what room has to send the info.
https://github.com/latitude-dev/latitude-llm/blob/main/apps/websockets/src/server.ts#L143
) | ||
const result = await baseQuery | ||
.where(eq(evaluationResultsScope.id, evaluationResult.id)) | ||
.limit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm weird way of building the query why didn't u use a repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseQuery
is using repositories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why not EvaluationResultsRepository(...).find(evaluationResult.id)
y ya esta?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The baseQuery brings same aggregations used in the table
9ce87a4
to
d5e5428
Compare
What?
When a evaluation is run show results in the frontend whenever they're processed
TODO