-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Switch to OpenRouter, add dynamic suggested actions #1137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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'.
@Karthik-beta is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
- 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
There was a problem hiding this 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.
if (enhancementResult.confidence > 0.6 && | ||
enhancementResult.enhanced !== enhancementResult.original && | ||
enhancementResult.enhanced.length > enhancementResult.original.length * 1.1) { |
There was a problem hiding this comment.
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.
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'.