Release 6.10.2025 - #573
Merged
Merged
Conversation
Adds an index to the executive dashboard to manage document stores
Summary This PR introduces several key upgrades and new features across core generative AI model integrations, along with enhancements for image generation, user context handling, and prompt-level caching. Key Changes 1. Model Registry Updates - Added gemini-2.5-flash-image-preview model for image generation and understanding. - Added support for gpt-5, gpt-5-mini, and gpt-5-nano models with explicit cost metadata. - Default models for Google Gemini and Anthropic Claude updated: - Gemini default: gemini-2.5-flash - Anthropic default: claude-sonnet-4-0 2. Google Generative AI – Image Generation Integration - Response Modalities: Added responseModalities input and UI option. Supports TEXT and IMAGE outputs. - User Context: Model initialization now propagates user organization, ID, and email (for image upload/auth). - Image Handling: - Auto-uploads generated images to storage, organized by user/org. - Injects image Markdown into final output (supports streaming and non-streaming). - Safely builds public URLs for generated images. 3. Chat Model Inputs & User Experience - OpenAI Node: Added promptCacheKey input for prompt-level cache control, improving cache efficiency and cost management. - Various code and interface refinements to surface new modalities, credential usage, and context passing 4. File Upload & Image Upload Permission Simplified isImageUploadAllowed logic: chat models with allowImageUploads: true will correctly enable image upload in the UI, regardless of specific node names. Motivation & Context - Adds early support for the latest Google Gemini and GPT-5 models. - Enables direct image generation and output via Gemini, including correct inline preview for users. - Improves auditability and compliance of generated assets by tying uploads to user/org context. - Provides finer control over OpenAI prompt-caching to optimize costs. Testing - Validated image generation and upload using gemini-2.5-flash-image-preview, confirming correct Markdown injection and download links. - Verified prompt cache hits with OpenAI using custom promptCacheKey. - Confirmed new models selectable and default as expected for Gemini/Anthropic. - Image upload UI toggle respects new chat model configuration.
This commit introduces significant enhancements to the AAIToolAgent, including the addition of an output parser for structured output. The agent now supports parsing its output into a structured format, improving the usability and flexibility of the tool. Key changes include: - Updated constructor to include an optional output parser input. - Enhanced the run method to initialize and utilize the output parser. - Added methods for injecting format instructions into the system message and parsing the output. These improvements aim to provide a more robust and user-friendly experience for users leveraging the Tool Agent in the Answer tab.
## 🐛 Problem
Users were experiencing duplicate default chatflows being created when
logging in concurrently. This race condition occurred primarily in
production environments where multiple authentication requests for the
same user could execute simultaneously.
### Root Cause
The race condition had several contributing factors:
1. **Stale In-Memory Data**: The `findOrCreateDefaultChatflowsForUser`
function relied on in-memory user objects that could be outdated
2. **Missing Database Persistence**: The authentication middleware
updated `user.defaultChatflowId` in memory but didn't persist it to the
database immediately
3. **No Database-Level Protection**: Multiple processes could create
duplicate chatflows simultaneously without constraint enforcement
## ✅ Solution
This PR implements a multi-layered fix:
### 1. **Application-Level Fixes**
- **Enhanced Database Checks**: `findOrCreateDefaultChatflowsForUser`
now always queries the database for the latest `defaultChatflowId`
instead of trusting stale in-memory data
- **Immediate Persistence**: Authentication middleware now persists
`defaultChatflowId` updates to the database immediately
- **Transaction-Level Safety**: Added additional database checks within
transactions to prevent race conditions
- **Graceful Conflict Resolution**: Added cleanup logic for redundant
chatflows created during race conditions
### 2. **Database-Level Protection**
- **Unique Constraint**: Added a partial unique index to prevent
multiple default chatflows per user per template
- **Safe Migration**: Migration includes duplicate cleanup and
constraint enforcement
- **Constraint Violation Handling**: Application code gracefully handles
unique constraint violations
## 🔧 Changes Made
### Code Changes
- `packages/server/src/middlewares/authentication/index.ts`: Added
immediate database persistence
-
`packages/server/src/middlewares/authentication/findOrCreateDefaultChatflowsForUser.ts`:
Enhanced with database-first checks and conflict resolution
-
`packages/server/src/database/migrations/postgres/1753000000001-AddUniqueConstraintDefaultChatflows.ts`:
New migration for unique constraint
### Database Schema
- Added unique partial index: `idx_unique_user_parent_chatflow` on
`("userId", "parentChatflowId")` where `"parentChatflowId" IS NOT NULL
AND "deletedDate" IS NULL`
## 🚨 Pre-Migration Steps Required
**⚠️ IMPORTANT**: Before running the migration, you must manually clean
up existing duplicate chatflows:
1. **Analyze Duplicates**:
```sql
-- Run this to see all duplicate chatflows
-- (Use scripts/dbeaver-detailed-analysis.sql)
```
2. **Generate DELETE Statements**:
```sql
-- Run this to generate safe DELETE statements
-- (Use scripts/dbeaver-improved-deletes.sql)
```
3. **Manual Cleanup**:
- Review each generated DELETE statement
- Execute them individually in DBeaver
- Verify user `defaultChatflowId` references remain valid
4. **Run Migration**:
- Migration will fail safely if duplicates remain
- Only proceeds when database is clean
## 🧪 Testing
### Reproduction Test
Created test scripts to simulate concurrent authentication requests:
- Multiple simultaneous `/api/v1/auth/me` calls
- Database verification queries
- Race condition detection logic
### Local Testing Results
- ✅ No race condition detected in local environment (expected due to low
latency)
- ✅ Code changes prevent race condition through multiple safety layers
- ✅ Unique constraint provides database-level enforcement
## 📊 Impact Analysis
### Production Data (Example)
- **Users with duplicates**: 57
- **Total duplicate chatflows**: 121
- **Chatflows to be cleaned up**: ~64
- **Safe DELETE generation**: Prioritizes user's current
`defaultChatflowId`
### User Experience
- ✅ **No Functionality Loss**: Users retain access to their default
chatflows
- ✅ **Performance Improvement**: Fewer duplicate chatflows reduce
database load
- ✅ **Data Integrity**: Guaranteed unique default chatflows per user per
template
## 🔄 Deployment Steps
1. **Pre-deployment**:
- [ ] Run duplicate analysis scripts
- [ ] Execute manual cleanup of duplicate chatflows
- [ ] Verify all user `defaultChatflowId` references are valid
2. **Deployment**:
- [ ] Deploy code changes
- [ ] Run migration (will validate no duplicates remain)
- [ ] Verify unique constraint is active
3. **Post-deployment**:
- [ ] Monitor for any constraint violations (should be none)
- [ ] Verify user login experience is normal
- [ ] Confirm no new duplicate chatflows are created
## 🔍 Verification Queries
After deployment, verify the fix:
```sql
-- Should return 0
SELECT COUNT(*) FROM (
SELECT "userId", "parentChatflowId"
FROM "chat_flow"
WHERE "parentChatflowId" IS NOT NULL AND "deletedDate" IS NULL
GROUP BY "userId", "parentChatflowId"
HAVING COUNT(*) > 1
) duplicates;
-- Should show the unique constraint exists
SELECT indexname, indexdef
FROM pg_indexes
WHERE tablename = 'chat_flow'
AND indexname = 'idx_unique_user_parent_chatflow';
```
## 🎯 Related Issues
- Fixes: Race condition in default chatflow creation during concurrent
user authentication
- Prevents: Multiple default chatflows per user per template
- Improves: Database integrity and application performance
---------
Co-authored-by: DiegoC <diecoscai@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cameron Taylor <50385537+ct3685@users.noreply.github.com>
Co-authored-by: Max Techera <maxi.techerag@gmail.com>
…yaml formatting (#568) chore: update submodule URL for embed package and clean up pnpm-lock.yaml formatting
## Summary - Integrated Meta Pixel (ID: 25220750360842472) for conversion tracking - Enhanced tracking service to support Facebook Pixel events - Added comprehensive form interaction tracking to WebinarRegistrationForm ## Changes - **Docusaurus Config**: Added Meta Pixel initialization script with PageView tracking - **Tracking Service**: Enhanced with Facebook Pixel support including CompleteRegistration, InitiateCheckout events - **WebinarRegistrationForm**: - Track form start when user begins typing - Track successful registration with lead score and estimated value ($100) - Track form abandonment on errors or page leave - **Fixed**: React unescaped entities warnings in webinar pages ## Testing - [x] Verify Meta Pixel loads on all pages (check Network tab for facebook.com requests) - [x] Test form interaction tracking (start, complete, abandon) - [x] Confirm CompleteRegistration event fires with correct data - [ ] Validate events in Meta Events Manager - [ ] Test with Meta Pixel Helper Chrome extension ## Context This enables conversion tracking for perpetual bi-weekly webinar campaigns, providing proper attribution and optimization signals for Meta Ads campaigns focused on our proven use cases: - IAS: Chief Sidekick + Help Center chatbot - WOW: Call transcript analysis + support automation - Content management and enterprise search 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
…#569) chore: update pnpm-lock.yaml formatting and embed submodule reference
Key Changes 1. Tracking Metadata Field Interface & Entity Changes: Added trackingMetadata (type: object or string, depending on module) to: IChatMessage interface IncomingInput interface The ChatMessage TypeORM entity Database Migration: Introduced migration scripts for all major DBs (MariaDB, MySQL, Postgres, SQLite) to add the tracking_metadata column to the chat_message table. Registered new migration in each database’s migration index. 2. End-to-End Metadata Handling Backend: Ensured trackingMetadata is properly passed and stored with user and agent messages throughout the chat flow execution. Extended buildChatflow.ts and handler.ts to augment records and callbacks with this metadata. Metadata is stored as JSON (or text) in the DB and sent to Langfuse with each field prefixed as tracking_*. API Specification: Updated the OpenAPI YAML to document the trackingMetadata property for prediction requests. Frontend: AnswersProvider: Adds trackingMetadata (with url and source fields) to the chat request payload. 3. Dependency Cleanup aai-embed-react: Removed direct dependency from packages-answers/ui/package.json and pnpm-lock.yaml. Now resolved via workspace protocol from apps/web instead. Other Dependency Updates: Upgraded eslint, rollup, tailwindcss, and related plugins to latest versions. Replaced old dependency versions where needed for improved compatibility (see pnpm-lock.yaml changes). Motivation Analytics & Reporting: Allows more granular tracking of user actions and chat contexts (e.g., what page, product, or source initiated a chat). Flexibility: Lets clients and frontends attach any relevant tags/identifiers to chat requests for downstream observability tools (Langfuse, etc). Dependency Hygiene: Removes unnecessary/duplicated dependencies and brings key dev/build tooling up to date.
chore: add package.json for embed-react to Dockerfile
## Summary - Adds JLINC integration for comprehensive AI observability and compliance tracking - Implements LangChain callback handler to track LLM and tool events - Provides Flowise UI configuration for easy setup ## Changes ### New Package: `packages-jlinc/jlinc-tracer` - Custom LangChain callback handler that extends `LangChainTracer` - Tracks events: `llm_start`, `llm_end`, `tool_start`, `tool_end` - Sends telemetry data to JLINC API endpoints for archival and compliance ### Flowise Integration - **Credentials**: Added `JlincApi.credential.ts` for API configuration - **Analytics Node**: Created JLINC analytics node for Flowise workflows - **Handler Integration**: Modified `handler.ts` to instantiate JLINCTracer when JLINC is selected ### UI Updates - Added JLINC to analytics providers in `AnalyseFlow.jsx` - Included configuration fields for Agreement ID and System Prefix - Added JLINC logo assets ## Configuration Users can enable JLINC tracking by: 1. Adding JLINC API credentials in Flowise 2. Selecting JLINC as the analytics provider in their flow 3. Configuring Agreement ID (optional) and System Prefix ## Test Plan - [ ] Verify JLINC credentials can be created and saved - [ ] Test JLINC analytics node appears in Flowise UI - [ ] Confirm events are logged when JLINC is enabled - [ ] Validate API connectivity with test endpoints 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.