mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
fix: derive semantic state correctly from null semantic values
This commit is contained in:
parent
38369930bd
commit
5abd7d469e
2 changed files with 10 additions and 2 deletions
|
|
@ -77,6 +77,14 @@ describe("CacheSettings", () => {
|
|||
expect(await screen.findByText("Similarity Threshold")).toBeInTheDocument();
|
||||
expect(screen.getByText("Embedding Model")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should NOT reveal the semantic fields when similarity_threshold is null", async () => {
|
||||
getCacheSettingsCall.mockResolvedValue({ current_values: { similarity_threshold: null } });
|
||||
renderSettings();
|
||||
expect(await screen.findByText("Connection Settings")).toBeInTheDocument();
|
||||
expect(screen.queryByText("Similarity Threshold")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Embedding Model")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when a field fails inline validation", () => {
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ const CacheSettings: React.FC<CacheSettingsProps> = ({ accessToken }) => {
|
|||
// Detect if existing config uses semantic caching
|
||||
if (
|
||||
currentValues.redis_type === "semantic" ||
|
||||
currentValues.similarity_threshold !== undefined ||
|
||||
currentValues.redis_semantic_cache_embedding_model !== undefined
|
||||
currentValues.similarity_threshold != null ||
|
||||
currentValues.redis_semantic_cache_embedding_model != null
|
||||
) {
|
||||
setSemanticEnabled(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue