File tree Expand file tree Collapse file tree 4 files changed +10
-19
lines changed Expand file tree Collapse file tree 4 files changed +10
-19
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,7 @@ export default class AnamClient {
119119 const tokenType = decodedToken . type ?. toLowerCase ( ) ;
120120
121121 if ( tokenType === 'legacy' ) {
122- if ( ! personaConfig || ! ( 'personaId' in personaConfig ) ) {
123- return 'Both session token and client are missing a persona configuration. Please provide a persona ID of a saved persona in the personaConfig parameter.' ;
124- }
122+ return 'Legacy session tokens are no longer supported. Please define your persona when creating your session token. See https://docs.anam.ai/resources/migrating-legacy for more information.' ;
125123 } else if ( tokenType === 'ephemeral' || tokenType === 'stateful' ) {
126124 if ( personaConfig ) {
127125 return 'This session token already contains a persona configuration. Please remove the personaConfig parameter.' ;
Original file line number Diff line number Diff line change 11import AnamClient from './AnamClient' ;
22import { PersonaConfig } from './types' ;
33import { AnamPublicClientOptions } from './types/AnamPublicClientOptions' ;
4- import { SavedPersonaConfig } from './types/PersonaConfig' ;
54
65/**
76 * Create a new Anam client.
@@ -12,10 +11,9 @@ import { SavedPersonaConfig } from './types/PersonaConfig';
1211 */
1312const createClient = (
1413 sessionToken : string ,
15- personaConfig ?: SavedPersonaConfig ,
1614 options ?: AnamPublicClientOptions ,
1715) : AnamClient => {
18- return new AnamClient ( sessionToken , personaConfig , options ) ;
16+ return new AnamClient ( sessionToken , undefined , options ) ;
1917} ;
2018
2119/**
Original file line number Diff line number Diff line change 11import { CoreApiRestClientOptions } from '../types' ;
22import { VoiceDetectionOptions } from './VoiceDetectionOptions' ;
3+ import { PersonaConfig } from './PersonaConfig' ;
34
45export interface AnamPublicClientOptions {
56 api ?: CoreApiRestClientOptions ;
67 voiceDetection ?: VoiceDetectionOptions ;
78 audioDeviceId ?: string ;
89 disableInputAudio ?: boolean ;
10+ /**
11+ * The persona configuration to use.
12+ * This is the recommended way to pass persona configuration instead of using the deprecated personaConfig parameter.
13+ */
14+ personaConfig ?: PersonaConfig ;
915}
Original file line number Diff line number Diff line change 1- export type PersonaConfig = SavedPersonaConfig | CustomPersonaConfig ;
2-
3- export interface SavedPersonaConfig {
4- personaId : string ;
5- disableBrains ?: boolean ;
6- disableFillerPhrases ?: boolean ;
7- }
1+ export type PersonaConfig = CustomPersonaConfig ;
82
93export interface CustomPersonaConfig {
4+ personaId : string ;
105 name : string ;
116 avatarId : string ;
127 voiceId : string ;
@@ -16,12 +11,6 @@ export interface CustomPersonaConfig {
1611 languageCode ?: string ;
1712}
1813
19- export function isSavedPersonaConfig (
20- personaConfig : PersonaConfig ,
21- ) : personaConfig is SavedPersonaConfig {
22- return 'personaId' in personaConfig ;
23- }
24-
2514export function isCustomPersonaConfig (
2615 personaConfig : PersonaConfig ,
2716) : personaConfig is CustomPersonaConfig {
You can’t perform that action at this time.
0 commit comments