Skip to content

Commit d21f8b9

Browse files
authored
Merge pull request #116 from anam-org/alpha
Release 3.0.0
2 parents 089b64a + 23e38d3 commit d21f8b9

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

src/AnamClient.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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.';

src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import AnamClient from './AnamClient';
22
import { PersonaConfig } from './types';
33
import { 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
*/
1312
const 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
/**
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import { CoreApiRestClientOptions } from '../types';
22
import { VoiceDetectionOptions } from './VoiceDetectionOptions';
3+
import { PersonaConfig } from './PersonaConfig';
34

45
export 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
}

src/types/PersonaConfig.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
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

93
export 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-
2514
export function isCustomPersonaConfig(
2615
personaConfig: PersonaConfig,
2716
): personaConfig is CustomPersonaConfig {

0 commit comments

Comments
 (0)