Skip to content

Commit

Permalink
fix: move default voice to base settings (COR-000) (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
z4o4z committed Sep 24, 2024
1 parent 5262759 commit bfbb3db
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions packages/base-types/src/version/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface Settings<Prompt = unknown> {
session: Session<Prompt>;
defaultCanvasNodeVisibility: Nullable<Utils.CanvasNodeVisibility>;
defaultCarouselLayout?: Nullable<CarouselLayout>;
defaultVoice?: Nullable<string>;

globalNoReply?: {
prompt?: Nullable<Prompt> | undefined;
Expand All @@ -61,6 +62,7 @@ export const defaultSettings = <Prompt>({
error = null,
repeat = RepeatType.ALL,
session = { type: SessionType.RESTART },
defaultVoice = null,
defaultCanvasNodeVisibility = null,
defaultCarouselLayout = null,

Expand All @@ -72,6 +74,7 @@ export const defaultSettings = <Prompt>({
error,
repeat,
session,
defaultVoice,
defaultCanvasNodeVisibility,
defaultCarouselLayout,

Expand Down
10 changes: 6 additions & 4 deletions packages/voice-types/src/version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ import { defaultSettings } from './settings';

export * from './settings';

export interface PlatformData<Voice> extends BaseVersion.PlatformData<Prompt<Voice>> {
export interface PlatformData<Voice extends string> extends BaseVersion.PlatformData<Prompt<Voice>> {
intents: Intent<Voice>[];
settings: Settings<Voice>;
}

export interface Version<Voice, Prototype extends BaseModels.Version.Prototype = BaseModels.Version.Prototype>
extends BaseVersion.Version<Prompt<Voice>, Prototype> {
export interface Version<
Voice extends string,
Prototype extends BaseModels.Version.Prototype = BaseModels.Version.Prototype,
> extends BaseVersion.Version<Prompt<Voice>, Prototype> {
platformData: PlatformData<Voice>;
}

export const defaultPlatformData = <Voice>(
export const defaultPlatformData = <Voice extends string>(
{ intents = [], settings = {}, ...data }: DeepPartialByKey<PlatformData<Voice>, 'settings'>,
params: DefaultSettingsParams<Voice>
): PlatformData<Voice> => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/voice-types/src/version/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { prompt } from '@voice-types/utils';
import type { Nullable } from '@voiceflow/base-types';
import { BaseVersion } from '@voiceflow/base-types';

export interface Settings<Voice> extends BaseVersion.Settings<Prompt<Voice>> {
export interface Settings<Voice extends string> extends BaseVersion.Settings<Prompt<Voice>> {
session: BaseVersion.Session<Prompt<Voice>>;
defaultVoice: Nullable<Voice>;
}
Expand All @@ -12,7 +12,7 @@ export interface DefaultSettingsParams<Voice> {
defaultPromptVoice: Voice;
}

export const defaultSettings = <Voice>(
export const defaultSettings = <Voice extends string>(
{ error, defaultVoice = null, ...baseSettings }: Partial<Settings<Voice>>,
{ defaultPromptVoice }: DefaultSettingsParams<Voice>
): Settings<Voice> => ({
Expand Down
4 changes: 1 addition & 3 deletions packages/voiceflow-types/src/version/chat/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { ChatVersion } from '@voiceflow/chat-types';
import type { BaseSettings } from '../base';
import { defaultBaseSettings } from '../base';

export interface SharedChatSettings extends ChatVersion.Settings {
defaultVoice?: string;
}
export interface SharedChatSettings extends ChatVersion.Settings {}

export interface ChatSettings extends SharedChatSettings, BaseSettings {}

Expand Down

0 comments on commit bfbb3db

Please sign in to comment.