refactor: update imports to use normalizeEndpointName from @librechat/api and remove redundant definitions

This commit is contained in:
Danny Avila 2025-08-18 02:31:08 -04:00
parent 8df0ecd438
commit 5e70d518aa
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
6 changed files with 17 additions and 18 deletions

View file

@ -1,3 +1,6 @@
import { Providers } from '@librechat/agents';
import { AuthType } from 'librechat-data-provider';
/**
* Checks if the given value is truthy by being either the boolean `true` or a string
* that case-insensitively matches 'true'.
@ -31,7 +34,7 @@ export function isEnabled(value?: string | boolean | null | undefined): boolean
* @param value - The value to check.
* @returns - Returns true if the value is 'user_provided', otherwise false.
*/
export const isUserProvided = (value?: string): boolean => value === 'user_provided';
export const isUserProvided = (value?: string): boolean => value === AuthType.USER_PROVIDED;
/**
* @param values
@ -46,3 +49,11 @@ export function optionalChainWithEmptyCheck(
}
return values[values.length - 1];
}
/**
* Normalize the endpoint name to system-expected value.
* @param name
*/
export function normalizeEndpointName(name = ''): string {
return name.toLowerCase() === Providers.OLLAMA ? Providers.OLLAMA : name;
}