🔀 fix: Correct Expected Behavior for Modular Chat Feature (#1871)

This commit is contained in:
Danny Avila 2024-02-23 12:14:58 -05:00 committed by GitHub
parent 5445d55af2
commit f431c8fb00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,16 +65,18 @@ const MenuItem: FC<MenuItemProps> = ({
getEndpointField(endpointsConfig, currentEndpoint, 'type') ?? currentEndpoint; getEndpointField(endpointsConfig, currentEndpoint, 'type') ?? currentEndpoint;
const newEndpointType = getEndpointField(endpointsConfig, newEndpoint, 'type') ?? newEndpoint; const newEndpointType = getEndpointField(endpointsConfig, newEndpoint, 'type') ?? newEndpoint;
if ( const hasEndpoint = modularEndpoints.has(currentEndpoint ?? '');
isExistingConversation && const hasCurrentEndpointType = modularEndpoints.has(currentEndpointType ?? '');
(modularEndpoints.has(endpoint ?? '') || const isCurrentModular = hasEndpoint || hasCurrentEndpointType || isAssistantSwitch;
modularEndpoints.has(currentEndpointType ?? '') ||
isAssistantSwitch) && const hasNewEndpoint = modularEndpoints.has(newEndpoint ?? '');
(modularEndpoints.has(newEndpoint ?? '') || const hasNewEndpointType = modularEndpoints.has(newEndpointType ?? '');
modularEndpoints.has(newEndpointType ?? '') || const isNewModular = hasNewEndpoint || hasNewEndpointType || isAssistantSwitch;
isAssistantSwitch) &&
(endpoint === newEndpoint || modularChat || isAssistantSwitch) const endpointsMatch = currentEndpoint === newEndpoint;
) { const shouldSwitch = endpointsMatch || modularChat || isAssistantSwitch;
if (isExistingConversation && isCurrentModular && isNewModular && shouldSwitch) {
template.endpointType = newEndpointType; template.endpointType = newEndpointType;
const currentConvo = getDefaultConversation({ const currentConvo = getDefaultConversation({