remix-nlux
Version:
Remix IDE NLUX integration. Remix IDE is the leading IDE for building and deploying smart contracts on Ethereum. NLUX is a JavaScript and React library for building conversational AI experiences.
24 lines (19 loc) • 637 B
text/typescript
import {ParticipantRole} from '../../../../js/core/src/index';
const defaultAiName = 'Assistant';
const defaultHumanName = 'User';
export const participantNameFromRoleAndPersona = (
role: ParticipantRole,
personaOptions: {
// Only using names as PersonaOptions differs between React and Vanilla JS
assistant?: {name?: string};
user?: {name?: string}
} | undefined,
): string => {
if (role === 'assistant') {
return personaOptions?.assistant?.name ?? defaultAiName;
}
if (role === 'user') {
return personaOptions?.user?.name ?? defaultHumanName;
}
return '';
};