mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
Merge 2de065929c into e52f05566d
This commit is contained in:
commit
b08eae138f
2 changed files with 23 additions and 7 deletions
|
|
@ -302,7 +302,28 @@ describe("ModelInfoView", () => {
|
|||
await user.click(testButton);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockToast.error).toHaveBeenCalled();
|
||||
expect(mockToast.fromError).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("should not truncate the connection test error message", async () => {
|
||||
// Regression test: the error toast used to cut the message to 100 chars
|
||||
// via truncateString, hiding the actual provider error from the user.
|
||||
const user = userEvent.setup();
|
||||
const longMessage = "Bedrock_mantleException - " + "x".repeat(150);
|
||||
mockTestConnectionRequest.mockRejectedValue(new Error(longMessage));
|
||||
|
||||
render(<ModelInfoView {...DEFAULT_ADMIN_PROPS} />, { wrapper });
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Model Settings")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const testButton = screen.getByRole("button", { name: /test connection/i });
|
||||
await user.click(testButton);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockToast.fromError).toHaveBeenCalledWith(expect.stringContaining(longMessage));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import { ArrowLeft, CheckIcon, CopyIcon, Info } from "lucide-react";
|
|||
import { useEffect, useMemo, useState } from "react";
|
||||
import { copyToClipboard as utilCopyToClipboard } from "../utils/dataUtils";
|
||||
import { stripMaskedSecrets } from "../utils/maskedSecretUtils";
|
||||
import { truncateString } from "../utils/textUtils";
|
||||
import AutoRouterConnectionTest from "./add_model/auto_router_connection_test";
|
||||
import { AutoRouterTestTarget, buildAutoRouterTestTargets } from "./add_model/build_auto_router_test_targets";
|
||||
import { normalizeTierModels, resolveComplexityDefaultModel } from "./add_model/complexity_router_tiers";
|
||||
|
|
@ -530,11 +529,7 @@ export default function ModelInfoView({
|
|||
throw new Error(response?.result?.error || response?.message || "Unknown error");
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
toast.error("Error testing connection: " + truncateString(error.message, 100));
|
||||
} else {
|
||||
toast.error("Error testing connection: " + String(error));
|
||||
}
|
||||
toast.fromError("Error testing connection: " + (error instanceof Error ? error.message : String(error)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue