@lobehub/lobehub 2.0.0-next.212 → 2.0.0-next.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/auto-i18n.yml +1 -1
- package/.github/workflows/bundle-analyzer.yml +1 -1
- package/.github/workflows/claude-auto-testing.yml +1 -1
- package/.github/workflows/claude-dedupe-issues.yml +1 -1
- package/.github/workflows/claude-issue-triage.yml +1 -1
- package/.github/workflows/claude-translate-comments.yml +1 -1
- package/.github/workflows/claude-translator.yml +1 -1
- package/.github/workflows/claude.yml +1 -1
- package/.github/workflows/desktop-build-electron.yml +2 -2
- package/.github/workflows/e2e.yml +1 -1
- package/.github/workflows/issue-auto-close-duplicates.yml +1 -1
- package/.github/workflows/lighthouse.yml +2 -2
- package/.github/workflows/lock-closed-issues.yml +1 -1
- package/.github/workflows/manual-build-desktop.yml +6 -6
- package/.github/workflows/pr-build-desktop.yml +5 -5
- package/.github/workflows/pr-build-docker.yml +2 -2
- package/.github/workflows/release-desktop-beta.yml +4 -4
- package/.github/workflows/release-docker.yml +2 -2
- package/.github/workflows/release.yml +1 -1
- package/.github/workflows/sync-database-schema.yml +1 -1
- package/.github/workflows/sync.yml +1 -1
- package/.github/workflows/test.yml +5 -5
- package/.github/workflows/verify-desktop-patch.yml +1 -1
- package/CHANGELOG.md +58 -0
- package/apps/desktop/package.json +3 -2
- package/apps/desktop/src/main/const/store.ts +1 -1
- package/apps/desktop/src/main/controllers/SystemCtr.ts +2 -3
- package/apps/desktop/src/main/core/App.ts +10 -3
- package/apps/desktop/src/main/types/store.ts +1 -1
- package/changelog/v1.json +14 -0
- package/locales/ar/models.json +35 -4
- package/locales/ar/providers.json +1 -0
- package/locales/bg-BG/models.json +24 -1
- package/locales/bg-BG/providers.json +1 -0
- package/locales/de-DE/models.json +30 -1
- package/locales/de-DE/providers.json +1 -0
- package/locales/en-US/models.json +1 -0
- package/locales/en-US/providers.json +1 -0
- package/locales/es-ES/models.json +32 -1
- package/locales/es-ES/providers.json +1 -0
- package/locales/fa-IR/models.json +48 -1
- package/locales/fa-IR/providers.json +1 -0
- package/locales/fr-FR/models.json +47 -1
- package/locales/fr-FR/providers.json +1 -0
- package/locales/it-IT/models.json +32 -1
- package/locales/it-IT/providers.json +1 -0
- package/locales/ja-JP/models.json +2 -1
- package/locales/ja-JP/providers.json +1 -0
- package/locales/ko-KR/models.json +24 -1
- package/locales/ko-KR/providers.json +1 -0
- package/locales/nl-NL/models.json +46 -1
- package/locales/nl-NL/providers.json +1 -0
- package/locales/pl-PL/models.json +41 -1
- package/locales/pl-PL/providers.json +1 -0
- package/locales/pt-BR/models.json +32 -1
- package/locales/pt-BR/providers.json +1 -0
- package/locales/ru-RU/models.json +54 -2
- package/locales/ru-RU/providers.json +1 -0
- package/locales/tr-TR/models.json +32 -1
- package/locales/tr-TR/providers.json +1 -0
- package/locales/vi-VN/models.json +37 -1
- package/locales/vi-VN/providers.json +1 -0
- package/locales/zh-CN/models.json +24 -3
- package/locales/zh-CN/providers.json +1 -0
- package/locales/zh-TW/models.json +11 -1
- package/locales/zh-TW/providers.json +1 -0
- package/package.json +4 -3
- package/packages/builtin-tool-knowledge-base/src/client/Render/SearchKnowledgeBase/Item/index.tsx +4 -2
- package/packages/builtin-tool-local-system/src/client/Intervention/EditLocalFile/index.tsx +3 -2
- package/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx +3 -2
- package/packages/const/src/theme.ts +0 -2
- package/packages/context-engine/src/engine/messages/types.ts +1 -1
- package/packages/desktop-bridge/src/routeVariants.ts +2 -9
- package/packages/electron-client-ipc/src/types/system.ts +1 -1
- package/packages/model-runtime/src/core/BaseAI.ts +1 -1
- package/packages/model-runtime/src/core/streams/qwen.test.ts +140 -0
- package/packages/model-runtime/src/core/streams/qwen.ts +17 -5
- package/packages/model-runtime/src/types/chat.ts +12 -12
- package/packages/model-runtime/src/types/error.ts +1 -1
- package/packages/model-runtime/src/types/image.ts +1 -1
- package/scripts/electronWorkflow/modifiers/nextConfig.mts +41 -13
- package/src/app/[variants]/(auth)/_layout/index.tsx +3 -2
- package/src/app/[variants]/(auth)/_layout/style.ts +8 -18
- package/src/app/[variants]/(auth)/layout.tsx +7 -3
- package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/index.tsx +4 -2
- package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/style.ts +3 -0
- package/src/app/[variants]/(main)/_layout/DesktopLayoutContainer.tsx +3 -2
- package/src/app/[variants]/(main)/chat/features/Conversation/Header/index.tsx +2 -1
- package/src/app/[variants]/(main)/chat/profile/features/ProfileEditor/PluginTag.tsx +3 -2
- package/src/app/[variants]/(main)/community/(list)/_layout/Footer.tsx +3 -2
- package/src/app/[variants]/(main)/group/features/Conversation/ChatItem/Thread.tsx +3 -2
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +0 -1
- package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/PluginTag.tsx +3 -2
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentItem/Editing.tsx +2 -2
- package/src/app/[variants]/(main)/home/_layout/Footer/index.tsx +1 -1
- package/src/app/[variants]/(main)/home/_layout/index.tsx +3 -2
- package/src/app/[variants]/(main)/home/features/CommunityAgents/Item.tsx +3 -2
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect/index.tsx +4 -2
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ModelSelect/ImageModelItem.tsx +3 -2
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/Select/index.tsx +4 -2
- package/src/app/[variants]/(main)/image/features/PromptInput/index.tsx +3 -2
- package/src/app/[variants]/(main)/memory/features/TimeLineView/index.tsx +9 -4
- package/src/app/[variants]/(main)/page/_layout/Body/List/Item/Editing.tsx +2 -2
- package/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx +11 -11
- package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +3 -2
- package/src/app/[variants]/(main)/settings/stats/features/overview/ShareButton/TotalCard.tsx +4 -2
- package/src/app/[variants]/(mobile)/me/(home)/features/Header.tsx +6 -8
- package/src/app/[variants]/layout.tsx +10 -15
- package/src/app/[variants]/onboarding/_layout/index.tsx +3 -2
- package/src/app/[variants]/onboarding/features/ModeSelectionStep.tsx +3 -2
- package/src/app/[variants]/router/index.tsx +12 -8
- package/src/components/Cell/Divider.tsx +4 -2
- package/src/components/DataStyleModal/index.tsx +4 -2
- package/src/components/FeatureList/index.tsx +4 -2
- package/src/components/FileParsingStatus/EmbeddingStatus.tsx +3 -2
- package/src/components/FileParsingStatus/index.tsx +3 -2
- package/src/components/Notification/index.tsx +4 -2
- package/src/components/client/ClientOnly.tsx +17 -0
- package/src/features/AlertBanner/CloudBanner.tsx +4 -3
- package/src/features/CommandMenu/ThemeMenu.tsx +1 -1
- package/src/features/CommandMenu/types.ts +5 -2
- package/src/features/CommandMenu/useCommandMenu.ts +3 -2
- package/src/features/Conversation/Markdown/plugins/LobeArtifact/Render/index.tsx +3 -2
- package/src/features/Conversation/Messages/components/FileChunks/ChunkItem.tsx +3 -2
- package/src/features/Conversation/Messages/components/FileChunks/index.tsx +4 -2
- package/src/features/Conversation/Messages/components/SearchGrounding.tsx +3 -2
- package/src/features/ElectronTitlebar/hooks/useWatchThemeUpdate.ts +21 -38
- package/src/features/GroupChatSettings/AgentCard.tsx +3 -2
- package/src/features/GroupChatSettings/HostMemberCard.tsx +3 -2
- package/src/features/PageEditor/DiffAllToolbar.tsx +4 -2
- package/src/features/User/UserPanel/ThemeButton.tsx +18 -29
- package/src/hooks/useIsDark.ts +11 -0
- package/src/layout/AuthProvider/Clerk/useAppearance.ts +4 -2
- package/src/layout/AuthProvider/MarketAuth/MarketAuthConfirmModal.tsx +3 -2
- package/src/layout/GlobalProvider/AppTheme.tsx +15 -19
- package/src/layout/GlobalProvider/NextThemeProvider.tsx +22 -0
- package/src/layout/GlobalProvider/StyleRegistry.tsx +18 -13
- package/src/layout/GlobalProvider/index.tsx +38 -36
- package/src/libs/next/proxy/define-config.ts +2 -11
- package/src/server/services/comfyui/config/constants.ts +7 -7
- package/src/server/services/comfyui/config/promptToolConst.ts +26 -26
- package/src/server/services/comfyui/utils/promptSplitter.ts +23 -23
- package/src/server/services/comfyui/utils/weightDType.ts +4 -5
- package/src/store/global/action.test.ts +0 -15
- package/src/store/global/actions/__tests__/general.test.ts +0 -37
- package/src/store/global/actions/general.ts +0 -21
- package/src/store/global/initialState.ts +0 -6
- package/src/store/global/selectors/systemStatus.test.ts +0 -20
- package/src/store/global/selectors/systemStatus.ts +0 -2
- package/src/styles/global.ts +0 -2
- package/src/utils/server/routeVariants.test.ts +17 -51
- package/src/utils/server/routeVariants.ts +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prompt Optimizer Configuration
|
|
3
|
-
*
|
|
3
|
+
* Prompt optimizer configuration - for intelligent splitting and optimization of prompts
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Style keywords configuration - organized by category
|
|
8
|
-
*
|
|
8
|
+
* Style keyword configuration - organized by category for easy maintenance and extension
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
12
12
|
export const STYLE_KEYWORDS = {
|
|
13
|
-
// Artists and platforms
|
|
13
|
+
// Artists and platforms
|
|
14
14
|
ARTISTS: [
|
|
15
15
|
'by greg rutkowski',
|
|
16
16
|
'by artgerm',
|
|
@@ -34,7 +34,7 @@ export const STYLE_KEYWORDS = {
|
|
|
34
34
|
'digital painting',
|
|
35
35
|
],
|
|
36
36
|
|
|
37
|
-
// Art styles
|
|
37
|
+
// Art styles
|
|
38
38
|
ART_STYLES: [
|
|
39
39
|
'photorealistic',
|
|
40
40
|
'photo realistic',
|
|
@@ -90,7 +90,7 @@ export const STYLE_KEYWORDS = {
|
|
|
90
90
|
'retrowave',
|
|
91
91
|
],
|
|
92
92
|
|
|
93
|
-
// Lighting effects
|
|
93
|
+
// Lighting effects
|
|
94
94
|
LIGHTING: [
|
|
95
95
|
'dramatic lighting',
|
|
96
96
|
'soft lighting',
|
|
@@ -131,7 +131,7 @@ export const STYLE_KEYWORDS = {
|
|
|
131
131
|
'incandescent',
|
|
132
132
|
],
|
|
133
133
|
|
|
134
|
-
// Photography terms
|
|
134
|
+
// Photography terms
|
|
135
135
|
PHOTOGRAPHY: [
|
|
136
136
|
'depth of field',
|
|
137
137
|
'shallow depth of field',
|
|
@@ -184,7 +184,7 @@ export const STYLE_KEYWORDS = {
|
|
|
184
184
|
'instant photo',
|
|
185
185
|
],
|
|
186
186
|
|
|
187
|
-
// Quality descriptions
|
|
187
|
+
// Quality descriptions
|
|
188
188
|
QUALITY: [
|
|
189
189
|
'high quality',
|
|
190
190
|
'best quality',
|
|
@@ -227,7 +227,7 @@ export const STYLE_KEYWORDS = {
|
|
|
227
227
|
'exquisite',
|
|
228
228
|
],
|
|
229
229
|
|
|
230
|
-
// Rendering and effects
|
|
230
|
+
// Rendering and effects
|
|
231
231
|
RENDERING: [
|
|
232
232
|
'octane render',
|
|
233
233
|
'octane',
|
|
@@ -270,7 +270,7 @@ export const STYLE_KEYWORDS = {
|
|
|
270
270
|
'high dynamic range',
|
|
271
271
|
],
|
|
272
272
|
|
|
273
|
-
// Color and mood
|
|
273
|
+
// Color and mood
|
|
274
274
|
COLOR_MOOD: [
|
|
275
275
|
'vibrant',
|
|
276
276
|
'vibrant colors',
|
|
@@ -330,7 +330,7 @@ export const STYLE_KEYWORDS = {
|
|
|
330
330
|
'gothic atmosphere',
|
|
331
331
|
],
|
|
332
332
|
|
|
333
|
-
// Texture and materials
|
|
333
|
+
// Texture and materials
|
|
334
334
|
TEXTURE_MATERIAL: [
|
|
335
335
|
'glossy',
|
|
336
336
|
'matte',
|
|
@@ -397,7 +397,7 @@ export const STYLE_KEYWORDS = {
|
|
|
397
397
|
|
|
398
398
|
/**
|
|
399
399
|
* Style synonyms mapping for better recognition
|
|
400
|
-
*
|
|
400
|
+
* Synonym mapping to improve recognition accuracy
|
|
401
401
|
*/
|
|
402
402
|
export const STYLE_SYNONYMS: Record<string, string[]> = {
|
|
403
403
|
// Photography variations
|
|
@@ -443,7 +443,7 @@ export const STYLE_SYNONYMS: Record<string, string[]> = {
|
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
445
|
* Compound styles that should be recognized as a whole
|
|
446
|
-
*
|
|
446
|
+
* Compound styles that should be recognized as a complete unit
|
|
447
447
|
*/
|
|
448
448
|
export const COMPOUND_STYLES = [
|
|
449
449
|
// Studio and brand styles
|
|
@@ -536,37 +536,37 @@ export const COMPOUND_STYLES = [
|
|
|
536
536
|
|
|
537
537
|
/**
|
|
538
538
|
* Precise adjective patterns for style extraction
|
|
539
|
-
*
|
|
539
|
+
* Precise adjective patterns for style extraction
|
|
540
540
|
*/
|
|
541
541
|
export const STYLE_ADJECTIVE_PATTERNS = {
|
|
542
|
-
// Visual quality related
|
|
542
|
+
// Visual quality related
|
|
543
543
|
quality:
|
|
544
544
|
/^(sharp|blur(ry)?|clear|crisp|clean|smooth|rough|grainy|noisy|pristine|flawless|perfect|polished)$/i,
|
|
545
545
|
|
|
546
|
-
// Artistic style related
|
|
546
|
+
// Artistic style related
|
|
547
547
|
artistic:
|
|
548
548
|
/^(abstract|surreal|minimal(ist)?|ornate|baroque|gothic|modern|contemporary|traditional|classical|vintage|retro|antique|futuristic|avant-garde)$/i,
|
|
549
549
|
|
|
550
|
-
// Color and lighting
|
|
550
|
+
// Color and lighting
|
|
551
551
|
visual:
|
|
552
552
|
/^(bright|dark|dim|vibrant|vivid|muted|saturated|desaturated|warm|cool|cold|hot|soft|hard|harsh|gentle|subtle|bold|pale|rich|deep)$/i,
|
|
553
553
|
|
|
554
|
-
// Mood and atmosphere
|
|
554
|
+
// Mood and atmosphere
|
|
555
555
|
mood: /^(dramatic|peaceful|chaotic|serene|calm|mysterious|mystical|magical|epic|legendary|heroic|romantic|melancholic|nostalgic|whimsical|playful|serious|solemn|cheerful|gloomy|ominous|eerie|creepy|scary|dreamy|ethereal|fantastical|moody|atmospheric)$/i,
|
|
556
556
|
|
|
557
|
-
// Texture and material
|
|
557
|
+
// Texture and material
|
|
558
558
|
texture:
|
|
559
559
|
/^(metallic|wooden|glass(y)?|crystalline|fabric|leather|plastic|rubber|organic|synthetic|liquid|solid|transparent|translucent|opaque|reflective|matte|glossy|satin|rough|smooth|wet|dry|dusty|rusty|weathered|aged|new|fresh|worn)$/i,
|
|
560
560
|
|
|
561
|
-
// Size and scale
|
|
561
|
+
// Size and scale
|
|
562
562
|
scale:
|
|
563
563
|
/^(tiny|small|medium|large|huge|massive|gigantic|colossal|enormous|microscopic|miniature|oversized|epic-scale|human-scale|intimate|vast|infinite)$/i,
|
|
564
564
|
|
|
565
|
-
// Complexity and detail
|
|
565
|
+
// Complexity and detail
|
|
566
566
|
detail:
|
|
567
567
|
/^(simple|complex|intricate|elaborate|detailed|minimal|advanced|sophisticated|primitive|refined|crude|delicate|robust)$/i,
|
|
568
568
|
|
|
569
|
-
// Professional quality
|
|
569
|
+
// Professional quality
|
|
570
570
|
professional:
|
|
571
571
|
/^(professional|amateur|masterful|skilled|expert|novice|polished|raw|finished|unfinished|complete|incomplete|refined|rough)$/i,
|
|
572
572
|
} as const;
|
|
@@ -575,7 +575,7 @@ export const STYLE_ADJECTIVE_PATTERNS = {
|
|
|
575
575
|
|
|
576
576
|
/**
|
|
577
577
|
* Get all style keywords as a flattened array
|
|
578
|
-
*
|
|
578
|
+
* Get all style keywords as a flattened array
|
|
579
579
|
*/
|
|
580
580
|
export function getAllStyleKeywords(): readonly string[] {
|
|
581
581
|
return Object.values(STYLE_KEYWORDS).flat();
|
|
@@ -583,7 +583,7 @@ export function getAllStyleKeywords(): readonly string[] {
|
|
|
583
583
|
|
|
584
584
|
/**
|
|
585
585
|
* Get all compound styles
|
|
586
|
-
*
|
|
586
|
+
* Get all compound styles
|
|
587
587
|
*/
|
|
588
588
|
export function getCompoundStyles(): readonly string[] {
|
|
589
589
|
return COMPOUND_STYLES;
|
|
@@ -591,7 +591,7 @@ export function getCompoundStyles(): readonly string[] {
|
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
593
|
* Normalize a style term using synonyms
|
|
594
|
-
*
|
|
594
|
+
* Normalize a style term using synonyms
|
|
595
595
|
*/
|
|
596
596
|
export function normalizeStyleTerm(term: string): string {
|
|
597
597
|
const lowerTerm = term.toLowerCase();
|
|
@@ -608,7 +608,7 @@ export function normalizeStyleTerm(term: string): string {
|
|
|
608
608
|
|
|
609
609
|
/**
|
|
610
610
|
* Check if a word matches any style adjective pattern
|
|
611
|
-
*
|
|
611
|
+
* Check if a word matches any style adjective pattern
|
|
612
612
|
*/
|
|
613
613
|
export function isStyleAdjective(word: string): boolean {
|
|
614
614
|
const lowerWord = word.toLowerCase();
|
|
@@ -617,7 +617,7 @@ export function isStyleAdjective(word: string): boolean {
|
|
|
617
617
|
|
|
618
618
|
/**
|
|
619
619
|
* Extract style adjectives from words based on precise patterns
|
|
620
|
-
*
|
|
620
|
+
* Extract style adjectives from words based on precise patterns
|
|
621
621
|
*/
|
|
622
622
|
export function extractStyleAdjectives(words: string[]): string[] {
|
|
623
623
|
return words.filter((word) => isStyleAdjective(word));
|
|
@@ -6,37 +6,37 @@ import {
|
|
|
6
6
|
} from '@/server/services/comfyui/config/promptToolConst';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* FLUX
|
|
10
|
-
*
|
|
9
|
+
* FLUX dual-CLIP prompt intelligent splitter
|
|
10
|
+
* Separates a single prompt into different inputs for T5-XXL and CLIP-L
|
|
11
11
|
*/
|
|
12
12
|
export function splitPromptForDualCLIP(prompt: string): {
|
|
13
|
-
//
|
|
13
|
+
// Style keywords for CLIP-L to understand visual concepts
|
|
14
14
|
clipLPrompt: string;
|
|
15
|
-
//
|
|
15
|
+
// Full description for T5-XXL to understand semantics
|
|
16
16
|
t5xxlPrompt: string;
|
|
17
17
|
} {
|
|
18
18
|
if (!prompt) {
|
|
19
19
|
return { clipLPrompt: '', t5xxlPrompt: '' };
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
//
|
|
22
|
+
// Get all style configurations
|
|
23
23
|
const styleKeywords = getAllStyleKeywords();
|
|
24
24
|
const compoundStyles = getCompoundStyles();
|
|
25
25
|
|
|
26
|
-
//
|
|
26
|
+
// Separate style keywords
|
|
27
27
|
const lowerPrompt = prompt.toLowerCase();
|
|
28
28
|
const words = prompt.split(/[\s,]+/);
|
|
29
29
|
const lowerWords = lowerPrompt.split(/[\s,]+/);
|
|
30
|
-
const stylePhrases: string[] = []; //
|
|
30
|
+
const stylePhrases: string[] = []; // Changed to store complete phrases
|
|
31
31
|
const contentWords: string[] = [];
|
|
32
32
|
const processedIndices = new Set<number>();
|
|
33
33
|
|
|
34
|
-
// 1.
|
|
34
|
+
// 1. First check compound styles (highest priority)
|
|
35
35
|
for (const compound of compoundStyles) {
|
|
36
36
|
const compoundLower = compound.toLowerCase();
|
|
37
37
|
const index = lowerPrompt.indexOf(compoundLower);
|
|
38
38
|
if (index !== -1) {
|
|
39
|
-
//
|
|
39
|
+
// Found compound style, extract corresponding original phrase
|
|
40
40
|
const beforeWords = prompt
|
|
41
41
|
.slice(0, Math.max(0, index))
|
|
42
42
|
.split(/[\s,]+/)
|
|
@@ -56,23 +56,23 @@ export function splitPromptForDualCLIP(prompt: string): {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// 2.
|
|
59
|
+
// 2. Check individual style keywords and synonyms
|
|
60
60
|
for (let i = 0; i < words.length; i++) {
|
|
61
|
-
if (processedIndices.has(i)) continue; //
|
|
61
|
+
if (processedIndices.has(i)) continue; // Skip already processed words
|
|
62
62
|
|
|
63
63
|
const word = words[i];
|
|
64
64
|
const lowerWord = lowerWords[i];
|
|
65
65
|
let isStyleWord = false;
|
|
66
66
|
|
|
67
|
-
// 2.1
|
|
67
|
+
// 2.1 First check synonyms and normalize
|
|
68
68
|
const normalizedWord = normalizeStyleTerm(lowerWord);
|
|
69
69
|
|
|
70
|
-
// 2.2
|
|
70
|
+
// 2.2 Check if it's a style keyword
|
|
71
71
|
for (const keyword of styleKeywords) {
|
|
72
72
|
const keywordWords = keyword.toLowerCase().split(/\s+/);
|
|
73
73
|
|
|
74
74
|
if (keywordWords.length === 1) {
|
|
75
|
-
//
|
|
75
|
+
// Single word matching (including normalized words)
|
|
76
76
|
if (lowerWord === keywordWords[0] || normalizedWord === keywordWords[0]) {
|
|
77
77
|
stylePhrases.push(word);
|
|
78
78
|
processedIndices.add(i);
|
|
@@ -80,7 +80,7 @@ export function splitPromptForDualCLIP(prompt: string): {
|
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
} else if (keywordWords.length > 1 && i + keywordWords.length <= words.length) {
|
|
83
|
-
//
|
|
83
|
+
// Multi-word phrase matching
|
|
84
84
|
const sequence = lowerWords.slice(i, i + keywordWords.length).join(' ');
|
|
85
85
|
if (sequence === keyword.toLowerCase()) {
|
|
86
86
|
const phraseWords: string[] = [];
|
|
@@ -89,14 +89,14 @@ export function splitPromptForDualCLIP(prompt: string): {
|
|
|
89
89
|
processedIndices.add(i + j);
|
|
90
90
|
}
|
|
91
91
|
stylePhrases.push(phraseWords.join(' '));
|
|
92
|
-
i += keywordWords.length - 1; //
|
|
92
|
+
i += keywordWords.length - 1; // Skip matched words
|
|
93
93
|
isStyleWord = true;
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// 2.3
|
|
99
|
+
// 2.3 If not a keyword, check if it's a style adjective
|
|
100
100
|
if (!isStyleWord && !processedIndices.has(i)) {
|
|
101
101
|
const adjectives = extractStyleAdjectives([word]);
|
|
102
102
|
if (adjectives.length > 0) {
|
|
@@ -106,25 +106,25 @@ export function splitPromptForDualCLIP(prompt: string): {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// 2.4
|
|
109
|
+
// 2.4 Record non-style words
|
|
110
110
|
if (!isStyleWord && !processedIndices.has(i)) {
|
|
111
111
|
contentWords.push(word);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
//
|
|
115
|
+
// Build result
|
|
116
116
|
if (stylePhrases.length > 0) {
|
|
117
|
-
//
|
|
117
|
+
// Phrase-level deduplication, maintaining integrity of multi-word phrases
|
|
118
118
|
const uniquePhrases = [...new Set(stylePhrases)];
|
|
119
119
|
return {
|
|
120
|
-
// CLIP-L
|
|
120
|
+
// CLIP-L focuses on style and visual concepts
|
|
121
121
|
clipLPrompt: uniquePhrases.join(' '),
|
|
122
|
-
// T5-XXL
|
|
122
|
+
// T5-XXL receives complete context to understand semantic relationships
|
|
123
123
|
t5xxlPrompt: prompt,
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
//
|
|
127
|
+
// Fallback when no style words: same prompt (ensures compatibility)
|
|
128
128
|
return {
|
|
129
129
|
clipLPrompt: prompt,
|
|
130
130
|
t5xxlPrompt: prompt,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { resolveModel } from './staticModelLookup';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* FLUX
|
|
4
|
+
* FLUX Model Weight Dtype Selection Tool
|
|
5
5
|
*
|
|
6
|
-
* @description
|
|
7
|
-
* Automatic weight type selection: prioritize ModelNameStandardizer recommendations, return 'default' for unknown models
|
|
6
|
+
* @description Automatic weight type selection: prioritize ModelNameStandardizer recommendations, return 'default' for unknown models
|
|
8
7
|
*
|
|
9
|
-
* @param {string} modelName -
|
|
10
|
-
* @returns {string}
|
|
8
|
+
* @param {string} modelName - Model filename or path
|
|
9
|
+
* @returns {string} Weight type string
|
|
11
10
|
*/
|
|
12
11
|
export function selectOptimalWeightDtype(modelName: string): string {
|
|
13
12
|
const config = resolveModel(modelName);
|
|
@@ -408,19 +408,4 @@ describe('createPreferenceSlice', () => {
|
|
|
408
408
|
expect(result.current.status.noWideScreen).toEqual(false);
|
|
409
409
|
});
|
|
410
410
|
});
|
|
411
|
-
|
|
412
|
-
describe('switchThemeMode', () => {
|
|
413
|
-
it('should switch theme mode', async () => {
|
|
414
|
-
const { result } = renderHook(() => useGlobalStore());
|
|
415
|
-
|
|
416
|
-
// Perform the action
|
|
417
|
-
act(() => {
|
|
418
|
-
useGlobalStore.setState({ isStatusInit: true });
|
|
419
|
-
result.current.switchThemeMode('light');
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
// Assert that updateUserSettings was called with the correct theme mode
|
|
423
|
-
expect(result.current.status.themeMode).toEqual('light');
|
|
424
|
-
});
|
|
425
|
-
});
|
|
426
411
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { act, renderHook } from '@testing-library/react';
|
|
2
|
-
import { ThemeMode } from 'antd-style';
|
|
3
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
3
|
import { withSWR } from '~test-utils';
|
|
5
4
|
|
|
@@ -117,42 +116,6 @@ describe('generalActionSlice', () => {
|
|
|
117
116
|
});
|
|
118
117
|
});
|
|
119
118
|
|
|
120
|
-
describe('switchThemeMode', () => {
|
|
121
|
-
it('should update theme mode in system status', () => {
|
|
122
|
-
const { result } = renderHook(() => useGlobalStore());
|
|
123
|
-
const themeMode: ThemeMode = 'dark';
|
|
124
|
-
|
|
125
|
-
act(() => {
|
|
126
|
-
useGlobalStore.setState({ isStatusInit: true });
|
|
127
|
-
result.current.switchThemeMode(themeMode);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
expect(result.current.status.themeMode).toBe(themeMode);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('should not update theme mode if status is not initialized', () => {
|
|
134
|
-
const { result } = renderHook(() => useGlobalStore());
|
|
135
|
-
const themeMode: ThemeMode = 'dark';
|
|
136
|
-
|
|
137
|
-
act(() => {
|
|
138
|
-
result.current.switchThemeMode(themeMode);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
expect(result.current.status.themeMode).toBe(initialState.status.themeMode);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('should handle light theme mode', () => {
|
|
145
|
-
const { result } = renderHook(() => useGlobalStore());
|
|
146
|
-
|
|
147
|
-
act(() => {
|
|
148
|
-
useGlobalStore.setState({ isStatusInit: true });
|
|
149
|
-
result.current.switchThemeMode('light');
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
expect(result.current.status.themeMode).toBe('light');
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
119
|
describe('useInitSystemStatus', () => {
|
|
157
120
|
it('should reset transient UI states when loading from localStorage', async () => {
|
|
158
121
|
const mockStatus = {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { type ThemeMode } from 'antd-style';
|
|
2
1
|
import isEqual from 'fast-deep-equal';
|
|
3
2
|
import { gt, parse, valid } from 'semver';
|
|
4
3
|
import { type SWRResponse } from 'swr';
|
|
5
4
|
import type { StateCreator } from 'zustand/vanilla';
|
|
6
5
|
|
|
7
|
-
import { LOBE_THEME_APPEARANCE } from '@/const/theme';
|
|
8
6
|
import { CURRENT_VERSION, isDesktop } from '@/const/version';
|
|
9
7
|
import { useOnlyFetchOnceSWR } from '@/libs/swr';
|
|
10
8
|
import { globalService } from '@/services/global';
|
|
11
9
|
import type { SystemStatus } from '@/store/global/initialState';
|
|
12
10
|
import { type LocaleMode } from '@/types/locale';
|
|
13
|
-
import { setCookie } from '@/utils/client/cookie';
|
|
14
11
|
import { switchLang } from '@/utils/client/switchLang';
|
|
15
12
|
import { merge } from '@/utils/merge';
|
|
16
13
|
import { setNamespace } from '@/utils/storeDebug';
|
|
@@ -23,7 +20,6 @@ export interface GlobalGeneralAction {
|
|
|
23
20
|
openAgentInNewWindow: (agentId: string) => Promise<void>;
|
|
24
21
|
openTopicInNewWindow: (agentId: string, topicId: string) => Promise<void>;
|
|
25
22
|
switchLocale: (locale: LocaleMode, params?: { skipBroadcast?: boolean }) => void;
|
|
26
|
-
switchThemeMode: (themeMode: ThemeMode, params?: { skipBroadcast?: boolean }) => void;
|
|
27
23
|
updateSystemStatus: (status: Partial<SystemStatus>, action?: any) => void;
|
|
28
24
|
useCheckLatestVersion: (enabledCheck?: boolean) => SWRResponse<string>;
|
|
29
25
|
useInitSystemStatus: () => SWRResponse;
|
|
@@ -114,23 +110,6 @@ export const generalActionSlice: StateCreator<
|
|
|
114
110
|
})();
|
|
115
111
|
}
|
|
116
112
|
},
|
|
117
|
-
switchThemeMode: (themeMode, { skipBroadcast } = {}) => {
|
|
118
|
-
get().updateSystemStatus({ themeMode });
|
|
119
|
-
|
|
120
|
-
setCookie(LOBE_THEME_APPEARANCE, themeMode === 'auto' ? undefined : themeMode);
|
|
121
|
-
|
|
122
|
-
if (isDesktop && !skipBroadcast) {
|
|
123
|
-
(async () => {
|
|
124
|
-
try {
|
|
125
|
-
const { ensureElectronIpc } = await import('@/utils/electron/ipc');
|
|
126
|
-
|
|
127
|
-
await ensureElectronIpc().system.updateThemeModeHandler(themeMode);
|
|
128
|
-
} catch (error) {
|
|
129
|
-
console.error('Failed to update theme in main process:', error);
|
|
130
|
-
}
|
|
131
|
-
})();
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
113
|
updateSystemStatus: (status, action) => {
|
|
135
114
|
if (!get().isStatusInit) return;
|
|
136
115
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ThemeMode } from 'antd-style';
|
|
2
1
|
import type { NavigateFunction } from 'react-router-dom';
|
|
3
2
|
|
|
4
3
|
import { DatabaseLoadingState, type MigrationSQL, type MigrationTableItem } from '@/types/clientDB';
|
|
@@ -129,10 +128,6 @@ export interface SystemStatus {
|
|
|
129
128
|
showRightPanel?: boolean;
|
|
130
129
|
showSystemRole?: boolean;
|
|
131
130
|
systemRoleExpandedMap: Record<string, boolean>;
|
|
132
|
-
/**
|
|
133
|
-
* theme mode
|
|
134
|
-
*/
|
|
135
|
-
themeMode?: ThemeMode;
|
|
136
131
|
/**
|
|
137
132
|
* 是否使用短格式显示 token
|
|
138
133
|
*/
|
|
@@ -196,7 +191,6 @@ export const INITIAL_STATUS = {
|
|
|
196
191
|
showRightPanel: true,
|
|
197
192
|
showSystemRole: false,
|
|
198
193
|
systemRoleExpandedMap: {},
|
|
199
|
-
themeMode: 'auto',
|
|
200
194
|
tokenDisplayFormatShort: true,
|
|
201
195
|
topicPageSize: 20,
|
|
202
196
|
zenMode: false,
|
|
@@ -87,24 +87,4 @@ describe('systemStatusSelectors', () => {
|
|
|
87
87
|
expect(systemStatusSelectors.portalWidth(noPortalWidth)).toBe(400);
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
-
|
|
91
|
-
describe('theme mode', () => {
|
|
92
|
-
it('should return the correct theme', () => {
|
|
93
|
-
const s: GlobalState = merge(initialState, {
|
|
94
|
-
status: {
|
|
95
|
-
themeMode: 'light',
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
expect(systemStatusSelectors.themeMode(s)).toBe('light');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should return auto if not set', () => {
|
|
102
|
-
const s: GlobalState = merge(initialState, {
|
|
103
|
-
status: {
|
|
104
|
-
themeMode: undefined,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
expect(systemStatusSelectors.themeMode(s)).toBe('auto');
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
90
|
});
|
|
@@ -23,7 +23,6 @@ const showImagePanel = (s: GlobalState) => s.status.showImagePanel;
|
|
|
23
23
|
const showImageTopicPanel = (s: GlobalState) => s.status.showImageTopicPanel;
|
|
24
24
|
const hidePWAInstaller = (s: GlobalState) => s.status.hidePWAInstaller;
|
|
25
25
|
const isShowCredit = (s: GlobalState) => s.status.isShowCredit;
|
|
26
|
-
const themeMode = (s: GlobalState) => s.status.themeMode || 'auto';
|
|
27
26
|
const language = (s: GlobalState) => s.status.language || 'auto';
|
|
28
27
|
|
|
29
28
|
const showChatHeader = (s: GlobalState) => !s.status.zenMode;
|
|
@@ -80,7 +79,6 @@ export const systemStatusSelectors = {
|
|
|
80
79
|
showRightPanel,
|
|
81
80
|
showSystemRole,
|
|
82
81
|
systemStatus,
|
|
83
|
-
themeMode,
|
|
84
82
|
tokenDisplayFormatShort,
|
|
85
83
|
topicGroupKeys,
|
|
86
84
|
topicPageSize,
|
package/src/styles/global.ts
CHANGED