| @@ -61,7 +61,7 @@ type SourceProgressState = { · 60 unmodified lines |
| 61 | function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: SourceProgressState) { | 61 | function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: SourceProgressState) { |
| 62 | const isOpenApi = sourceType === "openapi"; | 62 | const isOpenApi = sourceType === "openapi"; |
| 63 | const labels = isOpenApi | 63 | const labels = isOpenApi |
| 64 | ? ["Download spec", "Extract operations", "Index tools"] | 64 | ? ["Downloading & Extracting Operations", "Index tools"] |
| 65 | : ["Connect", "Discover tools", "Index tools"]; | 65 | : ["Connect", "Discover tools", "Index tools"]; |
| 66 | | 66 | |
| 67 | const defaultSteps = labels.map((label, index) => ({ | 67 | const defaultSteps = labels.map((label, index) => ({ |
| @@ -80,24 +80,23 @@ function progressStepStates(sourceType: ToolSourceRecord["type"], progress?: Sou · 12 unmodified lines |
| 80 | | 80 | |
| 81 | if (progress.state === "indexing") { | 81 | if (progress.state === "indexing") { |
| 82 | return defaultSteps.map((step) => { | 82 | return defaultSteps.map((step) => { |
| 83 | if (step.id < 3) return { ...step, status: "done" as const }; | 83 | if (step.id === 1) return { ...step, status: "done" as const }; |
| 84 | return { ...step, status: "active" as const }; | 84 | if (step.id === 2) return { ...step, status: "active" as const }; |
| | 85 | return step; |
| 85 | }); | 86 | }); |
| 86 | } | 87 | } |
| 87 | | 88 | |
| 88 | if (progress.state === "loading") { | 89 | if (progress.state === "loading") { |
| 89 | const message = progress.message?.toLowerCase() ?? ""; | | |
| 90 | const activeStep = message.includes("download") ? 1 : 2; | | |
| 91 | return defaultSteps.map((step) => { | 90 | return defaultSteps.map((step) => { |
| 92 | if (step.id < activeStep) return { ...step, status: "done" as const }; | 91 | if (step.id === 1) return { ...step, status: "active" as const }; |
| 93 | if (step.id === activeStep) return { ...step, status: "active" as const }; | | |
| 94 | return step; | 92 | return step; |
| 95 | }); | 93 | }); |
| 96 | } | 94 | } |
| 97 | | 95 | |
| 98 | if (progress.state === "failed") { | 96 | if (progress.state === "failed") { |
| 99 | const message = progress.message?.toLowerCase() ?? ""; | 97 | const failedStep = sourceType === "openapi" |
| 100 | const failedStep = message.includes("index") ? 3 : message.includes("download") ? 1 : 2; | 98 | ? (typeof progress.processedTools === "number" && progress.toolCount > 0 ? 2 : 1) |
| | 99 | : (progress.message?.toLowerCase().includes("index") ? 3 : 2); |
| 101 | return defaultSteps.map((step) => { | 100 | return defaultSteps.map((step) => { |
| 102 | if (step.id < failedStep) return { ...step, status: "done" as const }; | 101 | if (step.id < failedStep) return { ...step, status: "done" as const }; |
| 103 | if (step.id === failedStep) return { ...step, status: "failed" as const }; | 102 | if (step.id === failedStep) return { ...step, status: "failed" as const }; |