mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-17 23:26:02 +00:00
fix tts inference polling
This commit is contained in:
1 parent
754020029e
commit
3444f81925
3 files changed
+12
-43
No files matched your search
+5
-36
@@ -104,10 +104,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
logoutSession = () => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
const api = new ApiConfig();
|
||||
const endpointUrl = api.logout();
|
||||
|
||||
@@ -125,9 +121,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
enqueueTtsJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
const newJob = new TtsInferenceJob(jobToken);
|
||||
let inferenceJobs = this.state.ttsInferenceJobs.concat([newJob]);
|
||||
|
||||
@@ -137,10 +130,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
checkTtsJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
const api = new ApiConfig();
|
||||
const endpointUrl = api.getTtsInferenceJobState(jobToken);
|
||||
|
||||
@@ -160,10 +149,11 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
let updatedJobs : Array<TtsInferenceJob> = [];
|
||||
this.state.ttsInferenceJobs.forEach(job => {
|
||||
if (job.jobToken !== jobResponse.state!.job_token ||
|
||||
jobResponse.state!.maybe_result_token === undefined) { // NB: Already done querying, no need to update again.
|
||||
updatedJobs.push(job);
|
||||
|
||||
this.state.ttsInferenceJobs.forEach(existingJob => {
|
||||
if (existingJob.jobToken !== jobResponse.state!.job_token ||
|
||||
!jobResponse.state!.maybe_result_token) { // NB: Don't replace until we're done.
|
||||
updatedJobs.push(existingJob);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -179,9 +169,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
enqueueTtsModelUploadJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
const newJob = new TtsModelUploadJob(jobToken);
|
||||
let modelUploadJobs = this.state.ttsModelUploadJobs.concat([newJob]);
|
||||
|
||||
@@ -191,10 +178,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
checkTtsModelUploadJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
const api = new ApiConfig();
|
||||
const endpointUrl = api.getTtsModelUploadJobState(jobToken);
|
||||
|
||||
@@ -234,9 +217,6 @@ class App extends React.Component<Props, State> {
|
||||
|
||||
|
||||
enqueueW2lJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
const newJob = new W2lInferenceJob(jobToken);
|
||||
let inferenceJobs = this.state.w2lInferenceJobs.concat([newJob]);
|
||||
|
||||
@@ -246,10 +226,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
checkW2lJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
const api = new ApiConfig();
|
||||
const endpointUrl = api.getW2lInferenceJobState(jobToken);
|
||||
|
||||
@@ -288,9 +264,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
enqueueW2lTemplateUploadJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
const newJob = new W2lTemplateUploadJob(jobToken);
|
||||
let inferenceJobs = this.state.w2lTemplateUploadJobs.concat([newJob]);
|
||||
|
||||
@@ -300,10 +273,6 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
checkW2lTemplateUploadJob = (jobToken: string) => {
|
||||
if (!this.state.enableAlpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
const api = new ApiConfig();
|
||||
const endpointUrl = api.getW2lTemplateUploadJobState(jobToken);
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@ export class TtsInferenceJob {
|
||||
modelToken?: string;
|
||||
status: string;
|
||||
title?: string;
|
||||
maybeResultToken?: string;
|
||||
maybePublicBucketWavAudioPath?: string;
|
||||
maybeResultToken: string | undefined | null;
|
||||
maybePublicBucketWavAudioPath: string | undefined | null;
|
||||
|
||||
constructor(
|
||||
jobToken: string,
|
||||
status: string = 'unknown',
|
||||
modelToken: string | undefined = undefined,
|
||||
title: string | undefined = undefined,
|
||||
maybeResulToken: string | undefined = undefined,
|
||||
maybePublicBucketWavAudioPath: string | undefined = undefined,
|
||||
maybeResulToken: string | undefined | null = null,
|
||||
maybePublicBucketWavAudioPath: string | undefined | null = null,
|
||||
) {
|
||||
this.status = status;
|
||||
this.jobToken = jobToken;
|
||||
@@ -44,8 +44,8 @@ export interface TtsInferenceJobStateResponsePayload {
|
||||
export interface TtsInferenceJobState {
|
||||
job_token: string,
|
||||
status: string,
|
||||
maybe_result_token?: string,
|
||||
maybe_public_bucket_wav_audio_path?: string,
|
||||
maybe_result_token: string | null,
|
||||
maybe_public_bucket_wav_audio_path: string | null,
|
||||
model_token: string,
|
||||
tts_model_type: string,
|
||||
title: string,
|
||||
|
||||
@@ -12,7 +12,7 @@ function SessionTtsInferenceResultListFc(props: Props) {
|
||||
|
||||
props.ttsInferenceJobs.forEach(job => {
|
||||
|
||||
if (job.maybeResultToken === undefined || job.maybeResultToken === null) {
|
||||
if (!job.maybeResultToken) {
|
||||
results.push(
|
||||
<div key={job.jobToken}>Pending…</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user