改进 UI/UX 以及 wav 命名格式 - #294
Open
YuniqueUnic wants to merge 203 commits into
Open
Conversation
YuniqueUnic
commented
Dec 7, 2025
Contributor
- 重构 TTS 推理流水线为独立的服务函数,并改进生成音频文件名的可读性。
- 修复并简化新 UI 下的批量操作(删除 / 下载),让前后端协议一致、更可靠。
- 改进 API cURL 示例展示逻辑,调整音频元数据字段的处理方式。
- 更新 README,展示新的 UI 截图和说明。
服务器上部署时文件访问地址错误
修复 WEB_ADDRESS 变量获取顺序,放在 load_dotenv() 之后
Update app.py
Calculates audio duration using soundfile in tts() and updates the audio_files dictionary with the actual duration. Adds start.bat for easier application startup. Updates speaker/2222.pt model file.
Add audio duration calculation and start script
Remove hardcoded http host from audio file url generation to use relative path instead for better portability and deployment flexibility.
Fix: update audio file url to relative path
- Add `split` and `segment_len` parameters to control audio segmentation - Update `/tts` endpoint to return segmented audio files when enabled - Introduce `/list_wavs` and `/delete_wav` endpoints for managing generated audios - Enhance frontend with token insertion toolbar and tone preset buttons - Improve text splitting logic with configurable segment length - Fix minor bugs and improve code structure in TTS processing flow
Moved the core TTS generation pipeline from app.py to uilib/tts_service.py to improve modularity and readability. Also introduced audio_service.py for handling audio file listing and deletion, reducing duplication and centralizing file management logic. This change simplifies the main application route and enhances testability and maintainability of the TTS module.
Introduce a new `relative_url` field in the audio file objects to allow more flexible URL handling. Update both frontend templates and backend services to prioritize `relative_url` over `url` when available. This change affects: - `templates/index.html` and `templates/indexen.html`: Use `relative_url` for audio source and download links. - `uilib/audio_service.py` and `uilib/tts_service.py`: Add `relative_url` field to audio file dictionaries.
- Add `split` and `segment_len` parameters to control audio segmentation - Update `/tts` endpoint to return segmented audio files when enabled - Introduce `/list_wavs` and `/delete_wav` endpoints for managing generated audios - Enhance frontend with token insertion toolbar and tone preset buttons - Improve text splitting logic with configurable segment length - Fix minor bugs and improve code structure in TTS processing flow
Moved the core TTS generation pipeline from app.py to uilib/tts_service.py to improve modularity and readability. Also introduced audio_service.py for handling audio file listing and deletion, reducing duplication and centralizing file management logic. This change simplifies the main application route and enhances testability and maintainability of the TTS module.
- replace html lang to zh and update title - add brutalist CSS variables, components and styles - restructure layout into left input and right params columns - update token and preset controls with new buttons - add import txt and clear all wavs buttons - create new audio item template with API button - initialize tooltips and slider displays
- Replace Bootstrap grid with CSS Grid for three-column layout (config | main | result) - Add fixed header bar with title and version badge - Implement responsive breakpoint at 1000px for mobile vertical stacking - Optimize scrolling behavior: disable body scroll, enable panel-level overflow - Redesign panel headers with color-coded backgrounds (cyan/pink/yellow) - Simplify form controls and button styles with consistent brutalism
- Add CSS variables for column widths (--col-config, --col-result) - Replace grid layout with flexbox and add draggable splitters for column resizing - Implement line-numbered textarea editor with dedicated wrapper - Add tooltip icons with help text for all form controls - Reduce padding and font sizes for more compact layout - Add GitHub links to header bar with dual project references - Improve mobile responsiveness with conditional
…feature - Compress all CSS rules into single-line format for reduced file size - Add batch selection toolbar with select all/deselect/delete/clear buttons - Implement audio item checkbox selection with visual feedback - Add format tokens button to normalize spacing between text and control tokens - Enhance token insertion logic to auto-add spaces before/after tokens - Add responsive download button text (full/short) based on viewport
- Increase --col-config and --col-result from 260px/320px to 340px for better spacing - Add CSS rules to reorder columns on mobile: main -> config -> result - Maintain consistent styling across index.html and indexen.html templates
- Update reject pattern in Normalizer to preserve digits and control characters like '[', ']', and '_' - Enhance `remove_brackets` function to support numeric suffixed control tokens such as [oral_2], [laugh_0], [break_6] - Introduce control token protection mechanism during text normalization to prevent corruption of control tokens by Chinese/English text processors - Add utility functions `_protect_control_tokens` and `_restore_control_tokens` with index encoding to safely handle control tokens through normalization - Include comprehensive tests for control token handling in normalization and text splitting processes
- Disable ChatTTS built-in text normalization and homophone replacement - Add logic to skip processing when both flags are disabled - Enhance control token handling in utils to prevent modification - Update regex patterns and documentation for clarity - Protect control tokens like [uv_break], [oral_2] from being altered
…one replacement - Add regex pattern to identify ChatTTS control tokens like [uv_break], [laugh], [oral_2], etc., and preserve them through the normalization pipeline - Introduce internal methods `_protect_control_tokens` and `_restore_control_tokens` to replace and restore control tokens using safe letter-only placeholders - Update `Normalizer.__call__` to apply protection before processing and restore after, ensuring control tokens are unaffected by character mapping or homophone replacement - Enable `do_homophone_replacement` in `ts_service.py` while keeping `do_text_normalization` disabled, now that control tokens are properly protected - Add unit test to verify control token preservation when homophone replacement is enabled
- Revised tooltip text in both index.html and indexen.html to clarify that advanced tone controls ([oral_N], [laugh_N], [break_N]) should be set via the Refine Prompt section. - Removed specific token buttons ([oral_2], [laugh_0], [break_6]) from the quick tokens panel to reduce UI clutter and avoid confusion.
- Add `lang` query parameter handling in the index route to serve different templates for Chinese and English. - Update `index.html` and `indexen.html` to include language switch links for zh and en. - Modify audio item appending behavior in both templates to disable auto-play on load.
- Added `/download_wavs_batch` API endpoint to package and download multiple WAV files as a ZIP archive - Supports both form data and JSON input formats for specifying filenames - Includes security checks to prevent path traversal - Updated frontend UI to replace "Clear All" button with "Batch Download" option - Implemented client-side logic to submit selected filenames via POST request - ZIP filename includes timestamp and count of included files for better identification
- Add "Save" button in UI to manually persist current workspace state - Automatically save workspace state to localStorage with debounced inputs - Restore previously saved workspace state on page load - Persist various UI controls including text, prompts, voice settings, etc. - Improve token formatting logic to respect line breaks per line The feature enhances user experience by preserving their working context across page reloads or browser sessions. The implementation includes saving, restoring, and scheduling auto-save of the workspace state using localStorage. Token formatting now handles each line separately to avoid modifying user-defined line breaks.
- Remove duplicated code block in tts() that was setting filename/url fields - Update comment for clarity on pyVideoTrans interface compatibility - Refactor audio file URL generation to support both relative and absolute URLs - Add relative_url field for frontend usage while maintaining url field for API - Introduce _build_full_url helper to construct absolute URLs using request host or WEB_ADDRESS fallback - Fix HTML templates to use relative_url || url for audio src and download links - Ensure consistent quoting style in Python dictionary key access
- Add `_build_text_slug` to generate clean, readable slugs from text input, excluding control tokens and invalid filename characters - Update audio file naming to include human-readable slugs with timestamp prefixes - Refactor batch deletion and download endpoints to use JSON payloads and newline-delimited filenames - Improve cURL command escaping and support for special characters in form data - Adjust button labels and localization strings for clarity in both Chinese and English UIs
- Add new UI screenshot (ChatTTS-NEWUI.png) to repository - Update README.md with new UI feature highlights - Include note about improved UI/UX design, batch result operations, and quick tone insertion - Add image reference for new UI interface
Contributor
Author
|
改动有些大, 如果合不进去就 close 掉吧 |
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.