mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
begin to categorize jobs
This commit is contained in:
1 parent
0380ccd61a
commit
dc2bf87d81
1 file changed
+21
-2
@@ -130,7 +130,6 @@ interface State {
|
||||
isShowingBootstrapLanguageNotice: boolean;
|
||||
|
||||
// Jobs enqueued during this browser session.
|
||||
inferenceJobs: Array<InferenceJob>;
|
||||
ttsInferenceJobs: Array<TtsInferenceJob>;
|
||||
w2lInferenceJobs: Array<W2lInferenceJob>;
|
||||
ttsModelUploadJobs: Array<TtsModelUploadJob>;
|
||||
@@ -138,6 +137,10 @@ interface State {
|
||||
vocoderUploadJobs: Array<VocoderUploadJob>;
|
||||
voiceConversionModelUploadJobs: Array<VoiceConversionModelUploadJob>;
|
||||
|
||||
// Generic inference jobs.
|
||||
inferenceJobs: Array<InferenceJob>;
|
||||
inferenceJobsByCategory: Map<FrontendInferenceJobType, Array<InferenceJob>>;
|
||||
|
||||
// Current text entered
|
||||
textBuffer: string;
|
||||
|
||||
@@ -152,6 +155,13 @@ function newVocodes() {
|
||||
return discord || twitter || alphaCookie;
|
||||
}
|
||||
|
||||
function initInferenceJobsByCategoryMap() : Map<FrontendInferenceJobType, InferenceJob[]> {
|
||||
let inferenceJobsByCategory = new Map();
|
||||
inferenceJobsByCategory.set(FrontendInferenceJobType.TextToSpeech, []);
|
||||
inferenceJobsByCategory.set(FrontendInferenceJobType.VoiceConversion, []);
|
||||
return inferenceJobsByCategory;
|
||||
}
|
||||
|
||||
function isMacOs() {
|
||||
// Not on macs yet
|
||||
// https://stackoverflow.com/a/38241481
|
||||
@@ -176,6 +186,8 @@ class App extends React.Component<Props, State> {
|
||||
|
||||
let showPleaseFollowNotice = false;
|
||||
|
||||
let inferenceJobsByCategory = initInferenceJobsByCategoryMap();
|
||||
|
||||
this.state = {
|
||||
enableAlpha: enableAlpha,
|
||||
migrationMode: migrationMode,
|
||||
@@ -194,7 +206,6 @@ class App extends React.Component<Props, State> {
|
||||
isShowingPleaseFollowNotice: showPleaseFollowNotice,
|
||||
isShowingBootstrapLanguageNotice: false,
|
||||
|
||||
inferenceJobs: [],
|
||||
ttsInferenceJobs: [],
|
||||
w2lInferenceJobs: [],
|
||||
ttsModelUploadJobs: [],
|
||||
@@ -202,6 +213,9 @@ class App extends React.Component<Props, State> {
|
||||
vocoderUploadJobs: [],
|
||||
voiceConversionModelUploadJobs: [],
|
||||
|
||||
inferenceJobs: [],
|
||||
inferenceJobsByCategory: inferenceJobsByCategory,
|
||||
|
||||
textBuffer: "",
|
||||
|
||||
voiceConversionModels: [],
|
||||
@@ -338,6 +352,8 @@ class App extends React.Component<Props, State> {
|
||||
checkInferenceJob = async (jobToken: string) => {
|
||||
const lookupResult = await GetModelInferenceJobStatus(jobToken);
|
||||
|
||||
let inferenceJobsByCategory = initInferenceJobsByCategoryMap();
|
||||
|
||||
if (GetModelInferenceJobStatusIsOk(lookupResult)) {
|
||||
let updatedJobs: Array<InferenceJob> = [];
|
||||
|
||||
@@ -347,6 +363,7 @@ class App extends React.Component<Props, State> {
|
||||
!jobStateCanChange(existingJob.jobState)
|
||||
) {
|
||||
updatedJobs.push(existingJob);
|
||||
inferenceJobsByCategory.get(existingJob.frontendJobType)?.push(existingJob);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,10 +373,12 @@ class App extends React.Component<Props, State> {
|
||||
);
|
||||
|
||||
updatedJobs.push(updatedJob);
|
||||
inferenceJobsByCategory.get(updatedJob.frontendJobType)?.push(existingJob);
|
||||
});
|
||||
|
||||
this.setState({
|
||||
inferenceJobs: updatedJobs,
|
||||
inferenceJobsByCategory: inferenceJobsByCategory,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user