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
|
@ -119,9 +119,24 @@ const ChatUI: React.FC<ChatUIProps> = ({
|
||||||
|
|
||||||
// Now, 'options' contains the list you wanted
|
// Now, 'options' contains the list you wanted
|
||||||
console.log(options); // You can log it to verify the list
|
console.log(options); // You can log it to verify the list
|
||||||
|
|
||||||
// setModelInfo(options) should be inside the if block to avoid setting it when no data is available
|
// if options.length > 0, only store unique values
|
||||||
setModelInfo(options);
|
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(uniqueModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
setSelectedModel(fetchedAvailableModels.data[0].id);
|
setSelectedModel(fetchedAvailableModels.data[0].id);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue