🗣️ fix: get speechTab config; feature: not overriding variables selected by user (#3282)

* fix(Speech): speechTab settings update

* fix: get speech config; refactor: moved everything to types and removed file types; feature: not overriding variables selected by user
This commit is contained in:
Marco Beretta 2024-07-10 22:38:36 +02:00 committed by GitHub
parent cd00df69bb
commit f959ee302c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 16 deletions

View file

@ -355,7 +355,7 @@ export const getVoices = (): Promise<f.VoiceResponse> => {
return request.get(endpoints.textToSpeechVoices());
};
export const getCustomConfigSpeech = (): Promise<f.getCustomConfigSpeechResponse[]> => {
export const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse> => {
return request.get(endpoints.getCustomConfigSpeech());
};

View file

@ -422,3 +422,18 @@ export const useGetStartupConfig = (
},
);
};
export const useGetCustomConfigSpeechQuery = (
config?: UseQueryOptions<t.TCustomConfigSpeechResponse>,
): QueryObserverResult<t.TCustomConfigSpeechResponse> => {
return useQuery<t.TCustomConfigSpeechResponse>(
[QueryKeys.customConfigSpeech],
() => dataService.getCustomConfigSpeech(),
{
refetchOnWindowFocus: false,
refetchOnReconnect: false,
refetchOnMount: false,
...config,
},
);
};

View file

@ -463,3 +463,5 @@ export type TGetRandomPromptsRequest = {
limit: number;
skip: number;
};
export type TCustomConfigSpeechResponse = { [key: string]: string };

View file

@ -83,8 +83,6 @@ export type SpeechToTextResponse = {
export type VoiceResponse = string[];
export type getCustomConfigSpeechResponse = { [key: string]: string };
export type UploadMutationOptions = {
onSuccess?: (data: TFileUpload, variables: FormData, context?: unknown) => void;
onMutate?: (variables: FormData) => void | Promise<unknown>;
@ -115,12 +113,6 @@ export type VoiceOptions = {
onError?: (error: unknown, variables: unknown, context?: unknown) => void;
};
export type getCustomConfigSpeechOptions = {
onSuccess?: (data: getCustomConfigSpeechResponse, variables: unknown, context?: unknown) => void;
onMutate?: () => void | Promise<unknown>;
onError?: (error: unknown, variables: unknown, context?: unknown) => void;
};
export type DeleteFilesResponse = {
message: string;
result: Record<string, unknown>;