cherry-studio/src/main
LiuVaayne 1c71e6d474
support tokenflux image generation for [Flux.1 Kontext] (#6705)
* Add support for TokenFlux image generation service

This commit integrates TokenFlux as a new painting provider with dynamic
form generation based on model schemas, real-time generation polling,
and full painting history management.

Key features:
- Dynamic form rendering from JSON schema input parameters
- Model selection with pricing display
- Real-time generation status polling
- Integration with existing painting workflow and file management
- Provider-specific painting state management

The implementation follows existing patterns from other painting pages
while adding TokenFlux-specific functionality like schema-based form
generation and asynchronous polling for generation results.

* Add image upload support and comparison view to TokenFlux

Implements file upload handling for image parameters with base64
conversion, random seed generation, and side-by-side comparison
layout when input images are present.

* Refactor TokenFlux to use service class and components

Extract form rendering logic to DynamicFormRender component and API
logic to TokenFluxService class. Simplifies the main component by
removing duplicate code for model fetching, image generation polling,
and form field rendering.

* Refactor TokenFlux to fix state management and polling

- Change painting field from modelId to model for consistency
- Fix updatePaintingState to use functional state updates
- Add automatic polling for in-progress generations on mount
- Group models by provider in the selection dropdown
- Separate prompt from other input params in form data handling
- Improve error handling in the paintings store

* Auto-select first model when models are loaded

* Add image generation UI localization strings

Add translation keys for model selection, input parameters, image
labels, pricing display, and form validation across all supported
locales (en-us, ja-jp, ru-ru, zh-cn, zh-tw). Update TokenFluxPage
component to use localized strings instead of hardcoded English text.

* fix: Add a right border to the first child of the ImageComparisonSection

* style: Remove padding from UploadedImageContainer in TokenFluxPage

* feat: Implement caching for TokenFlux model fetching and update image upload handling

* feat: Enhance localization support by adding language context handling in TokenFluxPage

* refactor: Simplify layout structure in TokenFluxPage by removing unnecessary SectionGroup components and improving section title styling

---------

Co-authored-by: kangfenmao <kangfenmao@qq.com>
2025-06-05 15:47:51 +08:00
..
configs fix(SelectionAssistant): JetBrains IDEs, Remote desktop, Gaming, PDF views, etc (#6809) 2025-06-04 23:56:05 +08:00
embeddings fix: update dimensions handling in KnowledgeBaseParams (#6417) 2025-05-25 13:07:21 +08:00
integration/nutstore/sso/lib build: remove sentry integration 2025-04-24 11:48:53 +08:00
loader build: replace @llm-tools/embedjs with @cherrystudio/embedjs 2025-03-26 18:14:04 +08:00
mcpServers revert: mcp run python (#6151) 2025-05-22 00:04:15 +08:00
reranker fix(knowledge): remove topN 2025-05-18 10:02:05 +08:00
services support tokenflux image generation for [Flux.1 Kontext] (#6705) 2025-06-05 15:47:51 +08:00
utils test: more unit tests (#5130) 2025-05-26 16:50:26 +08:00
config.ts refactor(WindowService, ThemeProvider): streamline title bar style and theme toggling logic (#5633) 2025-05-04 13:19:56 +08:00
constant.ts feat: support portable config dir (#5039) 2025-04-24 17:23:56 +08:00
electron.d.ts feat: add the ability to display the application in tray #297 2024-11-09 08:42:09 +08:00
env.d.ts feat: added vite_main_bundle_id config and improved code cleanliness 2024-09-15 10:35:02 +08:00
index.ts fix: transparent window flashing when show (#6755) 2025-06-04 19:07:07 +08:00
ipc.ts refactor: Theme improve (#6619) 2025-05-30 15:10:58 +08:00