Skip to content

Latest commit

 

History

History
477 lines (366 loc) · 17.1 KB

File metadata and controls

477 lines (366 loc) · 17.1 KB

📋 All Releases English | 简体中文

Chats 1.8.1 Release Notes

Release Date: 2025-11-11 (29 commits since 1.8.0.247)

1.8.1 is a significant feature enhancement release. The core highlights include User Model Permission Management System, Reasoning Content Lifecycle Tracking & Auto-collapse, File Preview Component Refactor, and Chat List Caching Optimization. This release also adds TokenPony provider support, upgrades Azure OpenAI branding to Azure AI Foundry, and fixes reasoning content parsing issues caused by the OpenAI 2.6.0 upgrade.

🎯 Core Features

1) User Model Permission Management System

New Management Interface:

  • New /admin/user-models page (manage by user dimension)
  • New "Model Users" management in model page (manage by model dimension)
  • Tree structure displays user → model key → model permission relationships
  • Support batch grant/revoke model access permissions

Core Components (3 new components):

  • ByUserTab.tsx (1,180 lines) - View and manage model permissions by user
    • User list (with search and filter)
    • Skeleton loading state
    • URL state persistence (shareable URLs and state persistence across refreshes)
  • UserModelTree.tsx (912 lines) - Tree view of user model permissions
    • Three-layer structure: Provider → Model Key → Model
    • Checkbox full/partial selection state management
    • Batch permission updates
  • ModelUserList.tsx (506 lines) - Manage user permissions from model perspective
    • Display users with access to the model
    • Add/remove user permissions
    • Drawer interface (max-height 384px, scrollable)

Interaction Optimizations:

  • URL as single source of truth for state (shareable URLs and browser navigation)
  • Search criteria and filters automatically sync to URL parameters
  • Maintain filter and search state after page refresh
  • New "User Permissions" action button in model list page

Backend Support:

  • New user list query API (optimized loading performance)
  • New model user list API (query authorized users by model)
  • Batch permission update API (reduce network requests)

2) Reasoning Content Lifecycle Tracking & Auto-collapse

Reasoning State Tracking:

  • New finished flag in ReasoningContent type
    • finished: false - Reasoning in progress (auto-expand)
    • finished: true - Reasoning completed (auto-collapse)
    • undefined - Historical data (treated as completed)
  • Real-time marking of reasoning segment lifecycle status
  • Automatically mark as finished when receiving any non-reasoning SSE event

Smart Collapse Behavior:

  • ThinkingMessage component auto-expands/collapses based on finished state
    • During reasoning: auto-expand, show real-time thinking process
    • After completion: auto-collapse, save screen space
  • ToolCallBlock component auto-collapse optimization
    • Auto-collapse tool call details when tool response arrives
    • Support manual toggle, user actions have highest priority
  • All auto-collapse behaviors respect manual user toggles

Prevent Premature API Calls:

  • Added chatStatus guard condition
  • Avoid calling reasoning duration API during streaming
  • Avoid requests with temporary message IDs (RESPONSE_MESSAGE_TEMP_ID)
  • Fixed "input string was not in a correct format" error

Backend Support:

  • Pass cancellationToken through tool execution chain
  • Support proper cancellation handling mechanism

3) File Preview Component Refactor

New FilePreview Component (270 lines):

  • Unified file preview and interaction experience
  • Support multiple file types:
    • Images (auto-display)
    • Videos (HTML5 player)
    • Audio (HTML5 player)
    • Documents (icon + filename + download button)
  • Smart file type recognition (based on contentType and fileName)

New File Type Icons (7 icons):

  • PDF (IconFilePdf)
  • Word (IconFileWord)
  • Excel (IconFileExcel)
  • PowerPoint (IconFilePpt)
  • ZIP archives (IconFileZip)
  • Text files (IconFileText)
  • Generic files (IconFile)

Unified Interaction Features:

  • Hover effects (semi-transparent overlay + scale)
  • Delete button (optional, with confirmation)
  • Download button (for non-image files)
  • Image click preview (integrated with ImagePreview component)
  • Consistent styles and behaviors

Application Scope:

  • ChatInput - Attachment preview in message input
  • ResponseMessage - File display in response messages
  • UserMessage - File display in user messages
  • Replaces duplicate code in three places

Backend Refactor:

  • File processing logic moved from ChatController to ChatService
  • Content type checking moved to ChatCompletionService layer
  • Fixed gemini-2.0-flash-exp file support issue
  • Improved file type support with ImageSharp library (supports JPEG, PNG, GIF, WebP, BMP, etc.)

Cleanup:

  • Removed GeneratedImageSize class and database mapping
  • Removed KnownImageSize class and database mapping
  • These classes were no longer used in 1.8.0

4) Chat List Caching Optimization

New chatCache.ts Utility Module (122 lines):

  • Cache chat list to localStorage
  • Cache keys bound to username (chat_groups_cache_{username})
  • Auto-expiration mechanism (24 hours)
  • Search keyword sensitive (different keywords use different caches)

Loading Flow Optimization:

  • Load chat list from cache first (instant display)
  • Parallel initial API requests (chat list, user info, model list, etc.)
  • Update cache and UI after API returns
  • Removed blocking full-screen loading screen

User Experience Enhancement:

  • Immediately display chat list on first app entry (no API wait)
  • Significantly improved perceived performance (shorter time to content)
  • Notable improvement on slow networks

Security Assurance:

  • Auto-clear cache on logout (prevent cross-user data leakage)
  • Validate username match in cache (prevent seeing old data after user switch)
  • Auto-clear and reload if cache doesn't match

Other Optimizations:

  • Added loading state to new chat button (show spinner + disable button)
  • Prevent duplicate chat creation from multiple clicks
  • handleNewChat returns Promise for proper async handling

5) Provider Management Enhancements

New TokenPony Provider (ID=19):

  • Provider name: TokenPony (小马算力)
  • Default URL: https://api.tokenpony.cn/v1
  • New tokenpony.svg icon
  • Full Chinese and English translation support

Azure Branding Upgrade:

  • DBModelProvider.AzureOpenAIDBModelProvider.AzureAIFoundry (enum value remains 1)
  • AzureChatCompletionServiceAzureAIFoundryChatService (class rename)
  • Icon update: azure-openai.svgazure-ai-foundry.svg
  • Azure services auto-handle URLs (auto-append /openai/v1/ if not present)

URL Transformation Logic:

  • New TransformAzureAIFoundryHost method (auto-append path)
  • New CreateTransformedModelKey method (unified transformation logic)
  • AzureResponseApiService and AzureImageGenerationService reuse transformation methods
  • Reduced duplicate code, improved maintainability

Provider Selector UI Optimization:

  • Changed from dropdown to icon grid layout
  • Responsive columns (4-8 cols, auto-adjust based on screen width)
  • Scrollable container (max-height limit)
  • Responsive padding (better mobile display)
  • Fixed dark theme Ollama/OpenRouter/GitHub icon backgrounds (removed black backgrounds)

ChatService Architecture Simplification:

  • Removed suggestedApiUrl parameter from all ChatService constructors
  • Simplified URL fallback logic: ModelKey.HostModelProviderInfo.GetInitialHost
  • Removed empty ChatService implementations (DeepSeek, Doubao, MiniMax, Kimi, Ollama, Xunfei)
  • ChatFactory auto-fallback to ChatCompletionService for unknown providers
  • Reduced boilerplate code, improved readability

6) Settings Page Optimization

Icon Button Improvements:

  • Theme toggle button changed to icon button (removed text label)
  • Language toggle button changed to icon button (removed text label)
  • Cleaner UI, space-saving
  • Maintains full functionality (hover tooltips still display)

Navigation Improvements:

  • Settings page tabs changed from <button> to <a> tags
  • Support right-click menu (open in new tab)
  • Support Ctrl/Cmd+Click to open in new tab
  • Improved accessibility (semantic HTML)

Back Button Fix:

  • Fixed back button always returning to home issue
  • Correctly uses browser history
  • Improved navigation experience

🐛 Bug Fixes

1) OpenAI 2.6.0 Upgrade Related Fixes

Reasoning Content Parsing Issue:

  • Fixed reasoning_content reading issue after upgrading to OpenAI 2.6.0
  • Switched to self-compiled Sdcb.OpenAI library (version 2.6.0-alpha.3)
  • Fixed reasoning content extraction/decode issues
  • Ensured reasoning responses parse and display correctly

Dependency Changes:

  • ❌ Removed OpenAI 2.5.0 (official package)
  • ✅ Added Sdcb.OpenAI 2.6.0-alpha.3 (self-compiled package with reasoning content fix)

2) OpenAI Client Retry Disabled

  • Disabled OpenAI client auto-retry mechanism
  • Avoid long hangs and duplicate requests
  • Improved error handling predictability
  • Better user experience (fail fast rather than long waits)

3) OpenRouter Error Message Optimization

  • Optimized OpenRouter error message display
  • Provided clearer error prompts
  • Helps users quickly identify issues

🗄️ Database Migration

Migration Script Location:

src/scripts/db-migration/1.8/1.8.1.sql

Migration Content

Clean Azure AI Foundry URLs:

  • Remove api-version query parameters from ModelKey.Host
  • Clean URLs ending with /openai/v1?api-version=preview
  • Example:
    • Before: https://xxx.openai.azure.com/openai/v1?api-version=preview
    • After: https://xxx.openai.azure.com/openai/v1
  • Only affects records with ModelProviderId = 1 (Azure AI Foundry)
  • Includes validation output (shows affected records)

Migration Features

  • Safety: Auto-detect and clean, doesn't affect other providers
  • Idempotency: Can be executed repeatedly (uses LIKE condition check)
  • Validation: Shows affected records after migration for confirmation

Migration Steps

  1. Backup database (recommended)
  2. Execute migration script:
    sqlcmd -S localhost -d Chats -i 1.8.1.sql
  3. Verify migration results:
    -- Check Azure AI Foundry ModelKey Host
    SELECT Id, Name, Host, CreatedAt
    FROM ModelKey
    WHERE ModelProviderId = 1
      AND Host IS NOT NULL;

📊 Code Statistics

Overall Changes

  • Commit Count: 29 commits
  • Major Changes: User model permission management, reasoning lifecycle tracking, file preview refactor, chat cache optimization

Key Modules

Frontend New Components:

  • ByUserTab.tsx - 1,180 lines (manage model permissions by user)
  • UserModelTree.tsx - 912 lines (tree view of permissions)
  • ModelUserList.tsx - 506 lines (manage users from model perspective)
  • EditUserModelDialog.tsx - 214 lines (edit user model permission dialog)
  • FilePreview.tsx - 270 lines (unified file preview component)
  • chatCache.ts - 122 lines (chat list cache utility)

Frontend Refactors:

  • GeneralTab.tsx - Theme/language toggle changed to icon buttons
  • pages/admin/users/index.tsx - Simplified and removed redundant code (-202 lines net deletion)
  • pages/admin/model/index.tsx - Added model user management entry (+34 lines)
  • types/adminApis.ts - Added user model management related API type definitions (+86 lines)

Backend Changes:

  • Added TokenPony provider (ID=19)
  • DBModelProvider.AzureOpenAIDBModelProvider.AzureAIFoundry
  • AzureChatCompletionServiceAzureAIFoundryChatService
  • Removed empty ChatService implementations
  • Simplified ChatService constructor parameters
  • File processing logic refactor

Database:

  • New 1.8.1 migration script (35 lines)

Localization:

  • Added TokenPony related translations (zh-CN.json +35 lines)
  • Added user model management related translations

🚀 Upgrade Guide

Upgrading from 1.8.0 to 1.8.1

  1. Backup database (recommended)
  2. Stop application services
  3. Execute database migration:
    sqlcmd -S localhost -d Chats -i 1.8.1.sql
  4. Update backend code
    • Note: If you have custom Azure-related code, update class names and enum values
    • AzureOpenAIAzureAIFoundry
    • AzureChatCompletionServiceAzureAIFoundryChatService
  5. Update frontend code
    • Update DBModelProvider enum references
  6. Start application services
  7. Verify functionality:
    • Test Azure AI Foundry models work correctly
    • Test user model permission management features
    • Test file preview functionality
    • Test reasoning model auto-collapse features
    • Verify chat list cache is working

New Feature Usage Guide

User Model Permission Management:

  1. Go to /admin/user-models page
  2. Select the user to manage in the user list
  3. Check/uncheck model permissions in the tree structure
  4. Click "Save Changes" to apply permission changes
  5. Alternatively, click "User Permissions" button from model page to view and manage user access for specific models

Chat List Caching:

  • Automatically enabled, no configuration needed
  • First access caches chat list to browser local storage
  • Subsequent accesses load from cache first, then update
  • Auto-clears cache on logout

File Preview:

  • File preview automatically displays after upload
  • Image types: Direct thumbnail display, click for fullscreen preview
  • Video/Audio: Display player
  • Documents: Show file icon + filename + download button

⚠️ Breaking Changes

1. Azure Branding Change

Affected Scope:

  • Enum value DBModelProvider.AzureOpenAI renamed to DBModelProvider.AzureAIFoundry
  • Enum numeric value remains unchanged (still 1)
  • Both frontend and backend need to update references

Migration Method:

// Before
if (modelProviderId === DBModelProvider.AzureOpenAI) { ... }

// After
if (modelProviderId === DBModelProvider.AzureAIFoundry) { ... }

Database Impact:

  • No database migration needed (enum value unchanged)
  • Code-level rename only

2. ChatService Constructor Change

Affected Scope:

  • Removed suggestedApiUrl parameter from all ChatService constructors
  • If you have custom ChatService implementations, update constructor signatures

Migration Method:

// Before
public class MyChatService(Model model, string suggestedApiUrl) 
    : ChatCompletionService(model, suggestedApiUrl) { }

// After
public class MyChatService(Model model) 
    : ChatCompletionService(model) { }

🎓 Learning Resources

Related Documentation

Community Support


🙏 Contributors

Thanks to all developers who contributed to this release!

Special thanks to:

  • @sdcb - User model permission management, reasoning lifecycle tracking, file preview refactor, chat cache optimization, Azure branding upgrade, TokenPony provider, OpenAI 2.6.0 upgrade fixes

If you have any questions or suggestions, please provide feedback on GitHub Issues.


📝 Changelog Summary

New Features

  • ✅ User model permission management system (dual perspective: by user and by model)
  • ✅ Reasoning content lifecycle tracking and auto-collapse
  • ✅ File preview component refactor (unified experience + multiple file type support)
  • ✅ Chat list caching (localStorage + 24-hour expiration)
  • ✅ TokenPony provider support (ID=19)
  • ✅ New chat button loading state

Architecture Improvements

  • ✅ Azure OpenAI branding upgraded to Azure AI Foundry
  • ✅ ChatService architecture simplification (removed suggestedApiUrl parameter)
  • ✅ File processing logic moved from Controller to Service layer
  • ✅ Removed empty ChatService implementations
  • ✅ Unified Azure URL transformation logic

UI/UX Optimizations

  • ✅ Provider selector changed to icon grid layout
  • ✅ Theme/language toggle changed to icon buttons
  • ✅ Fixed icon backgrounds in dark theme
  • ✅ Fixed back button behavior
  • ✅ Navigation links support right-click menu and new tab opening

Bug Fixes

  • ✅ Fixed reasoning content parsing issue caused by OpenAI 2.6.0 upgrade
  • ✅ Disabled OpenAI client auto-retry
  • ✅ Optimized OpenRouter error messages
  • ✅ Fixed gemini-2.0-flash-exp file support issue

Database Migration

  • ✅ Clean api-version parameters from Azure AI Foundry ModelKey Host

Code Cleanup

  • ✅ Removed GeneratedImageSize and KnownImageSize classes
  • ✅ Removed redundant ChatService implementations
  • ✅ Simplified user management page code (-202 lines)

Last updated: 2025-11-11