forked from phoenix/litellm-mirror
Merge pull request #4108 from BerriAI/litellm_ui_fix_show_unique_model_names
ui - Fix Test Key dropdown
This commit is contained in:
commit
8d18583c67
1 changed files with 18 additions and 3 deletions
|
@ -120,8 +120,23 @@ const ChatUI: React.FC<ChatUIProps> = ({
|
|||
// Now, 'options' contains the list you wanted
|
||||
console.log(options); // You can log it to verify the list
|
||||
|
||||
// if options.length > 0, only store unique values
|
||||
if (options.length > 0) {
|
||||
const uniqueModels = Array.from(new Set(options));
|
||||
|
||||
console.log("Unique models:", uniqueModels);
|
||||
|
||||
// sort uniqueModels alphabetically
|
||||
uniqueModels.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
|
||||
|
||||
console.log("Model info:", modelInfo);
|
||||
|
||||
// setModelInfo(options) should be inside the if block to avoid setting it when no data is available
|
||||
setModelInfo(options);
|
||||
setModelInfo(uniqueModels);
|
||||
}
|
||||
|
||||
|
||||
setSelectedModel(fetchedAvailableModels.data[0].id);
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue