🏷️ fix: Ensure modelLabel Field Usage for ModelSpecs pt. 2 (#4225)

* fix: ensure modelSpec presets have endpointType defined, add `modelLabel` to openAISchema

* chore: bump rollup due to CVE-2024-47068
This commit is contained in:
Danny Avila 2024-09-24 09:52:22 -04:00 committed by GitHub
parent 6f498eee0f
commit ba1014a038
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 97 additions and 99 deletions

View file

@ -23,7 +23,7 @@ export default function useSelectMention({
}: {
presets?: TPreset[];
modelSpecs: TModelSpec[];
assistantMap: TAssistantsMap;
assistantMap?: TAssistantsMap;
newConversation: ConvoGenerator;
endpointsConfig: TEndpointsConfig;
}) {
@ -40,7 +40,8 @@ export default function useSelectMention({
const { preset } = spec;
preset.iconURL = getModelSpecIconURL(spec);
preset.spec = spec.name;
const { endpoint: newEndpoint } = preset;
const { endpoint } = preset;
const newEndpoint = endpoint ?? '';
if (!newEndpoint) {
return;
}
@ -59,6 +60,10 @@ export default function useSelectMention({
endpointsConfig,
});
if (newEndpointType) {
preset.endpointType = newEndpointType;
}
const isModular = isCurrentModular && isNewModular && shouldSwitch;
if (isExistingConversation && isModular) {
template.endpointType = newEndpointType as EModelEndpoint | undefined;
@ -94,7 +99,8 @@ export default function useSelectMention({
};
const onSelectEndpoint = useCallback(
(newEndpoint?: EModelEndpoint | string | null, kwargs: Kwargs = {}) => {
(_newEndpoint?: EModelEndpoint | string | null, kwargs: Kwargs = {}) => {
const newEndpoint = _newEndpoint ?? '';
if (!newEndpoint) {
return;
}
@ -113,12 +119,14 @@ export default function useSelectMention({
endpointsConfig,
});
if (kwargs.model) {
template.model = kwargs.model;
const model = kwargs.model ?? '';
if (model) {
template.model = model;
}
if (kwargs.assistant_id) {
template.assistant_id = kwargs.assistant_id;
const assistant_id = kwargs.assistant_id ?? '';
if (assistant_id) {
template.assistant_id = assistant_id;
}
if (isExistingConversation && isCurrentModular && isNewModular && shouldSwitch) {