Skip to content

Conversation

Karthik-beta
Copy link

Migrates AI provider from xAI to OpenRouter, updating environment variables and dependencies. Adds dynamic suggested actions using a new server action and model, introduces web search and advanced reasoning toggles in the chat input, and updates branding to 'WhatsonYourMind'.

Migrates AI provider from xAI to OpenRouter, updating environment variables and dependencies. Adds dynamic suggested actions using a new server action and model, introduces web search and advanced reasoning toggles in the chat input, and updates branding to 'WhatsonYourMind'.
Copy link

vercel bot commented Aug 26, 2025

@Karthik-beta is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

socket-security bot commented Aug 26, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​radix-ui/​react-toggle@​1.1.10991006598100
Updatedshiki@​3.9.2 ⏵ 3.11.01001007599 +2100
Added@​openrouter/​ai-sdk-provider@​1.1.210010010098100

View full report

- Enable 'chat-model-web-search' in schema and model list for web search capability
- Update AI provider configurations to include online GPT-5 nano model for web search
- Allow any media type in file part schema by relaxing mediaType validation
- Add copy-to-clipboard button for user messages with success toast notification
- Import CopyIcon and useCopyToClipboard hook for clipboard functionality in messages
- Maintain existing edit message button alongside new copy button in message UI
- Introduce enhancement middleware in chat API to process and improve user messages
- Apply enhancement only if confidence is above threshold and enhanced text shows significant improvement
- Store enhancement metadata in message metadata for audit and analysis
- Extend AI providers with new enhancement model configuration
- Define new PromptEnhancement database schema and related queries for saving and retrieving enhancements
- Add functions to retrieve enhancement statistics filtered by user and date ranges
- Define comprehensive TypeScript types covering prompt analysis, enhancement details, and contexts
- Update message streaming to include enhanced prompts for improved model inputs
…t analyzer

- Replace escaped backslashes with proper regex syntax in multiple pattern definitions
- Change some string literals from single-quoted with escaped apostrophes to double-quoted for better readability
- Fix context analyzer text extraction from chat history to concatenate text parts properly
- Remove unused maxTokens property from AI model invocation to reduce redundancy
- Add explicit type annotation for formatInstructions mapping in enhancement config
- Increase maxMessagesPerDay for guest users from 20 to 200
Copy link

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments:

lib/ai/tools/request-suggestions.ts (lines 53-53):

There's a TypeScript ignore comment with a TODO to fix a type issue, indicating a type safety problem.

View Details

Analysis

The line contains // @ts-ignore todo: fix type which suppresses TypeScript error checking for the Suggestion type assignment. This indicates that there's a type mismatch between the expected Suggestion interface and the actual element object structure. TypeScript ignore comments mask potential runtime errors and should be resolved by either fixing the type definitions or properly casting the data. This could lead to runtime errors if the data structure doesn't match expectations.

Comment on lines +160 to +162
if (enhancementResult.confidence > 0.6 &&
enhancementResult.enhanced !== enhancementResult.original &&
enhancementResult.enhanced.length > enhancementResult.original.length * 1.1) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enhancement logic has a potential issue where it only checks for length increase but not quality improvements that might maintain similar length.

View Details

Analysis

The enhancement application logic requires the enhanced prompt to be both significantly different AND longer than the original (enhancementResult.enhanced.length > enhancementResult.original.length * 1.1). This condition could prevent valuable enhancements that improve clarity or structure without necessarily increasing length. For example, a well-structured prompt that replaces verbose text with more precise language might be rejected even if it's objectively better. This logic should either remove the length requirement or make it more nuanced to account for quality improvements that don't increase length.

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.

1 participant