mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-14 04:09:09 +00:00
fix(lens): refresh canonical conversation content
# Conflicts: # ui/litellm-dashboard/src/components/lens/traces/detail/conversation/useConversationDetails.ts
This commit is contained in:
commit
a0a32f6898
2 changed files with 33 additions and 1 deletions
|
|
@ -56,6 +56,27 @@ describe("TraceConversation", () => {
|
|||
.mockImplementation(async (_token, _trace, id) => (id === "root" ? rootDetail : { ...toolDetail, span_id: id }));
|
||||
});
|
||||
|
||||
it.each([false, true])("refreshes unchanged spans without hiding loaded content on failure (%s)", async (failed) => {
|
||||
const user = userEvent.setup();
|
||||
renderWithProviders(
|
||||
<RoutedRunView traceId={trace.summary.trace_id} accessToken="test" onBack={vi.fn()} embedded />,
|
||||
);
|
||||
await user.click(await screen.findByRole("tab", { name: "Conversation" }));
|
||||
expect(await screen.findByText("The release is ready")).toBeVisible();
|
||||
vi.mocked(agentTraceSpanCall).mockImplementation(async (_token, _trace, id) => {
|
||||
if (failed) throw new Error("content refresh failed");
|
||||
return id === "root" ? { ...rootDetail, output: "Updated final answer" } : toolDetail;
|
||||
});
|
||||
await user.click(screen.getByRole("button", { name: "Refresh run" }));
|
||||
if (failed) {
|
||||
expect(await screen.findByRole("button", { name: "Retry batch" })).toBeVisible();
|
||||
expect(screen.getByText("The release is ready")).toBeVisible();
|
||||
} else {
|
||||
expect(await screen.findByText("Updated final answer")).toBeVisible();
|
||||
expect(screen.queryByText("The release is ready")).not.toBeInTheDocument();
|
||||
}
|
||||
});
|
||||
|
||||
it("switches to a readable transcript and opens the exact tool step from it", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderWithProviders(
|
||||
|
|
|
|||
|
|
@ -114,7 +114,18 @@ function LoadedRun({
|
|||
setManualRead(true);
|
||||
void read().finally(() => setManualRead(false));
|
||||
};
|
||||
const refreshRun = () => readManually(() => traceQuery.refetch());
|
||||
const refreshRun = () =>
|
||||
readManually(async () => {
|
||||
await traceQuery.refetch();
|
||||
await Promise.all(
|
||||
["agentTraceSpan", "agentTraceContents"].map((kind) =>
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [kind, traceId, traceRef],
|
||||
predicate: (query) => query.queryKey.at(-1) === accessToken,
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
const toggleLive = () => {
|
||||
if (live && !manualRead && !traceQuery.isFetchingNextPage) {
|
||||
void queryClient.cancelQueries({ queryKey, exact: true });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue