Skip to content

fix(ai): remove duplicate PageSpace model aliases from selector - #210

Merged
2witstudios merged 1 commit into
masterfrom
claude/fix-duplicate-models-jInIB
Jan 15, 2026
Merged

2witstudios merged 1 commit into
masterfrom
claude/fix-duplicate-models-jInIB

Conversation

@2witstudios

@2witstudios 2witstudios commented Jan 15, 2026 •

Copy link
Copy Markdown
Owner

Model selectors were showing "Standard" and "Pro" twice because the AI_PROVIDERS.pagespace.models object contained both actual model IDs (glm-4.5-air, glm-4.7) and their aliases (standard, pro).

The aliases are intended for internal storage/API use only and get resolved via resolvePageSpaceModel() before API calls. Removed the aliases from the models object to prevent duplicate UI entries.

Updated isValidModel() to still accept aliases for PageSpace so agents with aiModel: 'standard' are validated correctly.

Summary by CodeRabbit

  • Refactor
    • Optimized PageSpace AI provider model alias handling to ensure aliases remain valid while streamlining configuration data.

✏️ Tip: You can customize this high-level summary in your review settings.

Model selectors were showing "Standard" and "Pro" twice because
the AI_PROVIDERS.pagespace.models object contained both actual
model IDs (glm-4.5-air, glm-4.7) and their aliases (standard, pro).

The aliases are intended for internal storage/API use only and get
resolved via resolvePageSpaceModel() before API calls. Removed
the aliases from the models object to prevent duplicate UI entries.

Updated isValidModel() to still accept aliases for PageSpace so
agents with aiModel: 'standard' are validated correctly.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jan 15, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Removed explicit PageSpace model alias entries (standard → glm-4.5-air, pro → glm-4.7) from AI_PROVIDERS configuration while adding validation logic to accept these aliases as valid models through the isValidModel function.

Changes

Cohort / File(s) Summary
PageSpace Model Alias Refactoring
apps/web/src/lib/ai/core/ai-providers-config.ts
Removed standard and pro alias mappings from AI_PROVIDERS.pagespace.models; added conditional logic in isValidModel to validate PageSpace aliases via isPageSpaceModelAlias() check

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • #200: Adds getUserFacingModelName mapping for the same underlying PageSpace models (glm-4.7, glm-4.5-air) alongside alias handling changes
  • #207: Modifies PageSpace model alias handling in the same file by introducing alias map and resolution utilities

Poem

🐰 Aliases hop away from configs so tight,
Now validation does the magic right,
Standard and pro still dance and play,
Just checked before they go their way! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: removing duplicate PageSpace model aliases from the selector to fix the duplicate UI entries issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
apps/web/src/lib/ai/core/ai-providers-config.ts (1)

383-387: Consider adding alias resolution to getModelDisplayName for consistency.

Unlike isValidModel (which now accepts PageSpace aliases) and getUserFacingModelName (which resolves aliases via resolvePageSpaceModel), this function will return the raw alias string (e.g., 'standard') instead of a display name when called with an alias.

If this function is used anywhere in the UI for agents that have alias values stored, it would show the raw alias. If this is intentional (since getUserFacingModelName is the primary user-facing function), no action needed.

♻️ Optional: Add alias resolution for PageSpace
 export function getModelDisplayName(provider: string, model: string): string {
   const providerConfig = AI_PROVIDERS[provider as keyof typeof AI_PROVIDERS];
   if (!providerConfig) return model;
+  // Resolve PageSpace aliases to canonical model IDs
+  const resolvedModel = provider === 'pagespace' ? resolvePageSpaceModel(model) : model;
-  return providerConfig.models[model as keyof typeof providerConfig.models] || model;
+  return providerConfig.models[resolvedModel as keyof typeof providerConfig.models] || model;
 }

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d82f1a7 and 33eeb98.

📒 Files selected for processing (1)
  • apps/web/src/lib/ai/core/ai-providers-config.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Use camelCase for variable and function names
Use UPPER_SNAKE_CASE for constants
Use PascalCase for type and enum names
Use kebab-case for filenames, except React hooks (camelCase with use prefix), Zustand stores (camelCase with use prefix), and React components (PascalCase)
Lint with Next/ESLint as configured in apps/web/eslint.config.mjs
Message content should always use the message parts structure with { parts: [{ type: 'text', text: '...' }] }
Use centralized permission functions from @pagespace/lib/permissions (e.g., getUserAccessLevel, canUserEditPage) instead of implementing permission logic locally
Always use Drizzle client from @pagespace/db package for database access
Use ESM modules throughout the codebase

**/*.{ts,tsx}: Never use any types - always use proper TypeScript types
Write code that is explicit over implicit and self-documenting

Files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: React hook files should use camelCase matching the exported hook name (e.g., useAuth.ts)
Zustand store files should use camelCase with use prefix (e.g., useAuthStore.ts)

Files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Format code with Prettier

Files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
**/*ai*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Vercel AI SDK for AI integrations

Files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
apps/web/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/src/**/*.{ts,tsx}: Use message parts structure for message content: { parts: [{ type: 'text', text: '...' }] }
For database access, always use Drizzle client from @pagespace/db: import { db, pages } from '@pagespace/db';
Use centralized Drizzle ORM with PostgreSQL for all database operations - no direct SQL or other ORMs
Use Socket.IO for real-time collaboration features - imported from the realtime service at port 3001
Use Vercel AI SDK with async/await for all AI operations and streaming
Use Next.js 15 App Router and TypeScript for all routes and components

Files:

  • apps/web/src/lib/ai/core/ai-providers-config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Unit Tests
🔇 Additional comments (1)
apps/web/src/lib/ai/core/ai-providers-config.ts (1)

373-378: LGTM! Alias validation correctly added.

The logic correctly short-circuits to return true for PageSpace aliases before falling through to the canonical model lookup. This ensures agents with aiModel set to 'standard' or 'pro' continue to validate correctly after the alias entries were removed from AI_PROVIDERS.pagespace.models.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@2witstudios
2witstudios merged commit 4c1bba4 into master Jan 15, 2026
3 checks passed
@2witstudios
2witstudios deleted the claude/fix-duplicate-models-jInIB branch January 29, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants