Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jbilcke-hf committed Aug 12, 2024
1 parent f8cc0c9 commit c01ff04
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/app/api/resolve/providers/comfy-replicate/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ClapSegmentStatus, getClapAssetSourceType } from '@aitube/clap'

import { ResolveRequest } from '@aitube/clapper-services'
import { getComfyWorkflow } from '../comfy/getComfyWorkflow'
import { getComfyWorkflow } from '../comfyui/getComfyWorkflow'
import { runWorkflow } from './runWorkflow'
import { TimelineSegment } from '@aitube/timeline'

Expand Down
1 change: 1 addition & 0 deletions src/app/api/resolve/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { resolveSegment as resolveSegmentUsingHuggingFace } from './huggingface'
export { resolveSegment as resolveSegmentUsingComfyReplicate } from './comfy-replicate'
export { resolveSegment as resolveSegmentUsingReplicate } from './replicate'
export { resolveSegment as resolveSegmentUsingComfyUI } from './comfyui'
export { resolveSegment as resolveSegmentUsingComfyIcu } from './comfy-comfyicu'
export { resolveSegment as resolveSegmentUsingComfyDeploy } from './comfy-comfydeploy'
export { resolveSegment as resolveSegmentUsingFalAi } from './falai'
Expand Down
39 changes: 22 additions & 17 deletions src/app/api/resolve/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
resolveSegmentUsingAiTube,
resolveSegmentUsingModelsLab,
resolveSegmentUsingStabilityAi,
resolveSegmentUsingComfyUI,
} from './providers'

import { ResolveRequest } from '@aitube/clapper-services'
Expand Down Expand Up @@ -67,30 +68,34 @@ export async function POST(req: NextRequest) {

// console.log(`API ResolveRequest = `, request.settings)
const resolveSegment =
provider === ClapWorkflowProvider.HUGGINGFACE &&
engine === ClapWorkflowEngine.REST_API
? resolveSegmentUsingHuggingFace
: provider === ClapWorkflowProvider.REPLICATE &&
engine === ClapWorkflowEngine.COMFYUI_WORKFLOW
engine === ClapWorkflowEngine.COMFYUI_WORKFLOW
? provider === ClapWorkflowProvider.REPLICATE
? resolveSegmentUsingComfyReplicate
: provider === ClapWorkflowProvider.REPLICATE
? resolveSegmentUsingReplicate
: provider === ClapWorkflowProvider.COMFYUI
? resolveSegmentUsingComfyUI
: provider === ClapWorkflowProvider.COMFYICU
? resolveSegmentUsingComfyIcu
: provider === ClapWorkflowProvider.COMFYDEPLOY
? resolveSegmentUsingComfyDeploy
: provider === ClapWorkflowProvider.STABILITYAI
? resolveSegmentUsingStabilityAi
: provider === ClapWorkflowProvider.FALAI
? resolveSegmentUsingFalAi
: provider === ClapWorkflowProvider.MODELSLAB
? resolveSegmentUsingModelsLab
: provider === ClapWorkflowProvider.AITUBE
? resolveSegmentUsingAiTube
: null
: null
: provider === ClapWorkflowProvider.HUGGINGFACE
? resolveSegmentUsingHuggingFace
: provider === ClapWorkflowProvider.REPLICATE
? resolveSegmentUsingReplicate
: provider === ClapWorkflowProvider.STABILITYAI
? resolveSegmentUsingStabilityAi
: provider === ClapWorkflowProvider.FALAI
? resolveSegmentUsingFalAi
: provider === ClapWorkflowProvider.MODELSLAB
? resolveSegmentUsingModelsLab
: provider === ClapWorkflowProvider.AITUBE
? resolveSegmentUsingAiTube
: null

if (!resolveSegment) {
throw new Error(`Provider ${provider} is not supported yet`)
throw new Error(
`Engine "${engine}" is not supported by "${provider}" yet. If you believe this is a mistake, please open a Pull Request (with working code) to fix it. Thank you!`
)
}

let segment = request.segment
Expand Down

0 comments on commit c01ff04

Please sign in to comment.