Add enable/disable functionality for custom templates#2750
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughCustom template versions can now be enabled or disabled. The AI Workspace retrieves all template versions, selects versions per ownership and family based on enablement and version, and displays toggle controls for all template origins. ChangesCustom template enablement and version selection
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ProviderTemplatesList
participant providerTemplateApis
participant PlatformAPI
ProviderTemplatesList->>providerTemplateApis: Request all template versions
providerTemplateApis->>PlatformAPI: Fetch versions without latest-only filter
PlatformAPI-->>providerTemplateApis: Return template versions
providerTemplateApis-->>ProviderTemplatesList: Provide allVersions
ProviderTemplatesList->>ProviderTemplatesList: Group families and select display versions
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
portals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/ProviderTemplatesList.tsx (1)
136-171: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate version-parsing/comparison logic across files.
parseVersion/isHigherhere duplicates the same "parsev<major>.<minor>and compare" logic already implemented separately asparseVerNuminProviderTemplateOverview.tsx. Extracting a sharedcompareTemplateVersions/parseTemplateVersionutility (e.g. alongsidefamilyHandleinproviderTemplateDisplay.ts) would prevent the two implementations from silently diverging as version semantics evolve.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@portals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/ProviderTemplatesList.tsx` around lines 136 - 171, Extract the version parsing and comparison logic from the familyCards useMemo into shared parseTemplateVersion/compareTemplateVersions utilities alongside familyHandle in providerTemplateDisplay.ts, then update ProviderTemplatesList and ProviderTemplateOverview to use them instead of local parseVerNum, parseVersion, or isHigher implementations. Preserve the existing v<major>.<minor> ordering and invalid-version behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@portals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/ProviderTemplatesList.tsx`:
- Around line 136-171: Extract the version parsing and comparison logic from the
familyCards useMemo into shared parseTemplateVersion/compareTemplateVersions
utilities alongside familyHandle in providerTemplateDisplay.ts, then update
ProviderTemplatesList and ProviderTemplateOverview to use them instead of local
parseVerNum, parseVersion, or isHigher implementations. Preserve the existing
v<major>.<minor> ordering and invalid-version behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 694831c7-8ba9-44c0-8096-f8d0afb5133e
📒 Files selected for processing (5)
platform-api/internal/service/llm.goplatform-api/internal/service/llm_provider_template_test.goportals/ai-workspace/src/apis/providerTemplateApis.tsportals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/ProviderTemplateOverview.tsxportals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/ProviderTemplatesList.tsx
💤 Files with no reviewable changes (1)
- platform-api/internal/service/llm.go
Purpose
Previously, enable/disable was restricted to built-in templates only. This PR allows custom templates to be toggled as well, since enable/disable only affects control-plane listing.
Changes
managedByrestriction inSetVersionEnabledso custom templates can be enabled/disabled. Disabling is still blocked when the version is in use by a provider.Resolves: #2692