Update default assistants to all visible (#2490)

* update default assistants to all visible

* update with catch-all

* minor update

* update
This commit is contained in:
pablodanswer
2024-09-17 19:08:11 -07:00
committed by GitHub
parent 5f25b243c5
commit 2073820e33
3 changed files with 25 additions and 5 deletions

View File

@@ -306,9 +306,11 @@ export function AssistantsList({
user?.preferences?.chosen_assistants &&
!user?.preferences?.chosen_assistants?.includes(assistant.id)
);
const allAssistantIds = assistants.map((assistant) =>
assistant.id.toString()
);
const [deletingPersona, setDeletingPersona] = useState<Persona | null>(null);
const [makePublicPersona, setMakePublicPersona] = useState<Persona | null>(
null

View File

@@ -14,15 +14,20 @@ export function orderAssistantsForUser(
])
);
assistants = assistants.filter((assistant) =>
let filteredAssistants = assistants.filter((assistant) =>
chosenAssistantsSet.has(assistant.id)
);
assistants.sort((a, b) => {
if (filteredAssistants.length == 0) {
return assistants;
}
filteredAssistants.sort((a, b) => {
const orderA = assistantOrderMap.get(a.id) ?? Number.MAX_SAFE_INTEGER;
const orderB = assistantOrderMap.get(b.id) ?? Number.MAX_SAFE_INTEGER;
return orderA - orderB;
});
return filteredAssistants;
}
return assistants;