Skip to content

Commit 64d0d93

Browse files
authored
Merge pull request #18 from GCWing/gcwing/dev
feat(i18n): session title generation supports user locale
2 parents 80b5c97 + 56e66ea commit 64d0d93

9 files changed

Lines changed: 67 additions & 129 deletions

File tree

src/crates/core/src/agentic/session/session_manager.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,23 @@ impl SessionManager {
652652

653653
let max_length = max_length.unwrap_or(20);
654654

655+
// Get current user locale for language setting
656+
let user_language = if let Some(service) = crate::service::get_global_i18n_service().await {
657+
service.get_current_locale().await
658+
} else {
659+
crate::service::LocaleId::ZhCN
660+
};
661+
662+
let language_instruction = match user_language {
663+
crate::service::LocaleId::ZhCN => "使用简体中文",
664+
crate::service::LocaleId::EnUS => "Use English",
665+
};
666+
655667
// Construct system prompt
656668
let system_prompt = format!(
657-
"You are a professional session title generation assistant. Based on the user's message content, generate a concise and accurate session title.\n\nRequirements:\n- Title should not exceed {} characters\n- Use English\n- Concise and accurate, reflecting the conversation topic\n- Do not add quotes or other decorative symbols\n- Return only the title text, no other content",
658-
max_length
669+
"You are a professional session title generation assistant. Based on the user's message content, generate a concise and accurate session title.\n\nRequirements:\n- Title should not exceed {} characters\n- {}\n- Concise and accurate, reflecting the conversation topic\n- Do not add quotes or other decorative symbols\n- Return only the title text, no other content",
670+
max_length,
671+
language_instruction
659672
);
660673

661674
// Truncate message to save tokens (max 200 characters)

src/crates/core/src/service/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub use diff::{
2929
};
3030
pub use filesystem::{DirectoryStats, FileSystemService, FileSystemServiceFactory};
3131
pub use git::GitService;
32-
pub use i18n::{I18nConfig, I18nService, LocaleId, LocaleMetadata};
32+
pub use i18n::{get_global_i18n_service, I18nConfig, I18nService, LocaleId, LocaleMetadata};
3333
pub use lsp::LspManager;
3434
pub use mcp::MCPService;
3535
pub use project_context::{ContextDocumentStatus, ProjectContextConfig, ProjectContextService};

src/web-ui/src/features/onboarding/components/OnboardingWizard.scss

Lines changed: 37 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
align-items: center;
165165
justify-content: space-between;
166166
gap: $size-gap-4;
167-
padding: $size-gap-4 $size-gap-6;
167+
padding: $size-gap-2 $size-gap-3;
168168
border-top: 1px dashed var(--border-medium);
169169
}
170170

@@ -183,11 +183,11 @@
183183
align-items: center;
184184
justify-content: center;
185185
gap: $size-gap-2;
186-
min-height: 40px;
187-
padding: 8px 16px;
188-
min-width: 100px;
186+
min-height: 32px;
187+
padding: 6px 16px;
188+
min-width: 80px;
189189
border: 1px dashed var(--border-medium);
190-
border-radius: var(--size-radius-base, 8px);
190+
border-radius: 4px;
191191
background: transparent;
192192
color: var(--color-text-secondary);
193193
font-size: $font-size-sm;
@@ -376,7 +376,7 @@
376376
gap: $size-gap-2;
377377
padding: $size-gap-3 $size-gap-6;
378378
border: 1px dashed var(--border-medium);
379-
border-radius: $size-radius-base;
379+
border-radius: 4px;
380380
background: transparent;
381381
color: var(--color-text-secondary);
382382
font-size: $font-size-base;
@@ -447,9 +447,9 @@
447447
display: flex;
448448
flex-direction: column;
449449
align-items: center;
450-
font-size: $font-size-2xl;
451-
font-weight: $font-weight-semibold;
452-
color: var(--color-text-primary);
450+
font-size: $font-size-lg;
451+
font-weight: $font-weight-medium;
452+
color: var(--color-text-muted);
453453
margin: $size-gap-4 0 $size-gap-6 0;
454454
text-align: center;
455455
line-height: 1.6;
@@ -852,58 +852,9 @@
852852
flex-direction: column;
853853
gap: $size-gap-2;
854854

855-
// Adapt component library Select for onboarding (class is .select, not .bitfun-select)
855+
// Use component library default Select styles
856856
.select {
857857
width: 100%;
858-
859-
.select__label {
860-
font-size: $font-size-sm;
861-
font-weight: $font-weight-medium;
862-
color: var(--color-text-primary);
863-
margin-bottom: $size-gap-2;
864-
}
865-
866-
.select__trigger {
867-
min-height: 40px;
868-
padding: 8px 12px;
869-
border: 1px solid var(--border-base, rgba(255, 255, 255, 0.08));
870-
border-radius: var(--size-radius-base, 8px);
871-
background: var(--element-bg-subtle, rgba(255, 255, 255, 0.04));
872-
873-
&:hover:not(.select--disabled &) {
874-
border-color: var(--border-medium, rgba(255, 255, 255, 0.15));
875-
background: var(--glass-blue-subtle, rgba(96, 165, 250, 0.05));
876-
}
877-
}
878-
879-
&.select--open .select__trigger {
880-
border-color: var(--color-accent-500, #60a5fa);
881-
background: var(--element-bg-soft, rgba(255, 255, 255, 0.06));
882-
box-shadow: 0 0 0 3px var(--color-accent-200, rgba(96, 165, 250, 0.15));
883-
}
884-
885-
// Dropdown - tighter corners
886-
.select__dropdown {
887-
border-radius: var(--size-radius-base, 8px);
888-
margin-top: 4px;
889-
}
890-
891-
// Options list - tighter padding
892-
.select__options {
893-
padding: 4px;
894-
}
895-
896-
// Option item - tighter gap and padding
897-
.select__option {
898-
padding: 6px 10px;
899-
gap: 8px;
900-
font-size: $font-size-sm;
901-
border-radius: var(--size-radius-sm, 6px);
902-
}
903-
904-
.select__option-content {
905-
gap: 8px;
906-
}
907858
}
908859
}
909860

@@ -913,16 +864,16 @@
913864
color: var(--color-text-primary);
914865
}
915866

916-
// Inputs - match Select sizing
867+
// Inputs - match component library Select sizing
917868
&__input {
918869
width: 100%;
919-
min-height: 40px;
920-
padding: 8px 12px;
921-
border: 1px solid var(--border-base, rgba(255, 255, 255, 0.08));
922-
border-radius: var(--size-radius-base, 8px);
923-
background: var(--element-bg-subtle, rgba(255, 255, 255, 0.04));
870+
min-height: 36px;
871+
padding: 6px 12px;
872+
border: 1px solid var(--border-base, rgba(255, 255, 255, 0.14));
873+
border-radius: var(--size-radius-sm, 6px);
874+
background: transparent;
924875
color: var(--color-text-primary);
925-
font-size: $font-size-sm;
876+
font-size: var(--font-size-sm, 14px);
926877
font-family: $font-family-sans;
927878
box-sizing: border-box;
928879
transition: all $motion-base $easing-standard;
@@ -931,16 +882,14 @@
931882
color: var(--color-text-muted);
932883
}
933884

934-
&:hover {
935-
border-color: var(--border-medium, rgba(255, 255, 255, 0.15));
936-
background: var(--glass-blue-subtle, rgba(96, 165, 250, 0.05));
885+
&:hover:not(:disabled) {
886+
background: var(--element-bg-subtle, rgba(255, 255, 255, 0.05));
887+
border-color: var(--border-strong, rgba(255, 255, 255, 0.26));
937888
}
938889

939890
&:focus {
940891
outline: none;
941892
border-color: var(--color-accent-500, #60a5fa);
942-
background: var(--element-bg-soft, rgba(255, 255, 255, 0.06));
943-
box-shadow: 0 0 0 3px var(--color-accent-200, rgba(96, 165, 250, 0.15));
944893
}
945894
}
946895

@@ -1069,11 +1018,11 @@
10691018
width: 100%;
10701019
min-height: 80px;
10711020
padding: 8px 12px;
1072-
border: 1px solid var(--border-base, rgba(255, 255, 255, 0.08));
1073-
border-radius: var(--size-radius-base, 8px);
1074-
background: var(--element-bg-subtle, rgba(255, 255, 255, 0.04));
1021+
border: 1px solid var(--border-base, rgba(255, 255, 255, 0.14));
1022+
border-radius: var(--size-radius-sm, 6px);
1023+
background: transparent;
10751024
color: var(--color-text-primary);
1076-
font-size: $font-size-xs;
1025+
font-size: var(--font-size-sm, 14px);
10771026
font-family: monospace;
10781027
line-height: 1.5;
10791028
box-sizing: border-box;
@@ -1084,16 +1033,14 @@
10841033
color: var(--color-text-muted);
10851034
}
10861035

1087-
&:hover {
1088-
border-color: var(--border-medium, rgba(255, 255, 255, 0.15));
1089-
background: var(--glass-blue-subtle, rgba(96, 165, 250, 0.05));
1036+
&:hover:not(:disabled) {
1037+
background: var(--element-bg-subtle, rgba(255, 255, 255, 0.05));
1038+
border-color: var(--border-strong, rgba(255, 255, 255, 0.26));
10901039
}
10911040

10921041
&:focus {
10931042
outline: none;
10941043
border-color: var(--color-accent-500, #60a5fa);
1095-
background: var(--element-bg-soft, rgba(255, 255, 255, 0.06));
1096-
box-shadow: 0 0 0 3px var(--color-accent-200, rgba(96, 165, 250, 0.15));
10971044
}
10981045
}
10991046

@@ -1121,22 +1068,22 @@
11211068
align-items: center;
11221069
justify-content: center;
11231070
gap: $size-gap-2;
1124-
min-height: 40px;
1125-
padding: 8px 12px;
1126-
border: 1px dashed var(--border-medium);
1127-
border-radius: var(--size-radius-base, 8px);
1071+
min-height: 36px;
1072+
padding: 6px 12px;
1073+
border: 1px solid var(--border-base, rgba(255, 255, 255, 0.14));
1074+
border-radius: var(--size-radius-sm, 6px);
11281075
background: transparent;
11291076
color: var(--color-text-secondary);
1130-
font-size: $font-size-sm;
1077+
font-size: var(--font-size-sm, 14px);
11311078
font-weight: $font-weight-medium;
11321079
font-family: $font-family-sans;
11331080
cursor: pointer;
11341081
box-sizing: border-box;
11351082
transition: all $motion-base $easing-standard;
11361083

11371084
&:hover:not(:disabled) {
1138-
border-style: solid;
1139-
background: var(--element-bg-subtle);
1085+
background: var(--element-bg-subtle, rgba(255, 255, 255, 0.05));
1086+
border-color: var(--border-strong, rgba(255, 255, 255, 0.26));
11401087
color: var(--color-text-primary);
11411088
}
11421089

@@ -1333,10 +1280,10 @@
13331280
display: flex;
13341281
align-items: center;
13351282
justify-content: center;
1336-
min-height: 40px;
1337-
padding: 8px 16px;
1283+
min-height: 32px;
1284+
padding: 6px 16px;
13381285
border: 1px dashed var(--border-medium);
1339-
border-radius: var(--size-radius-base, 8px);
1286+
border-radius: 4px;
13401287
background: transparent;
13411288
color: var(--color-text-secondary);
13421289
font-size: $font-size-sm;

src/web-ui/src/features/onboarding/components/steps/LanguageStep.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ export const LanguageStep: React.FC<LanguageStepProps> = ({
3434
BitFun
3535
</h1>
3636

37-
{/* Subtitle - always show both languages */}
37+
{/* Subtitle - both languages on one line with / separator */}
3838
<div className="bitfun-onboarding-language__subtitle">
39-
<span>选择界面语言</span>
40-
<span>Choose Your Language</span>
39+
<span>选择界面语言 / Choose Your Language</span>
4140
</div>
4241

4342
{/* Language options */}

src/web-ui/src/flow_chat/components/InlineDiffPreview.scss

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,36 +140,36 @@
140140
background: var(--color-bg-secondary, rgba(255, 255, 255, 0.03));
141141
user-select: none;
142142
border-right: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.05));
143-
143+
144144
&--single {
145145
padding: 0 4px;
146146
gap: 0;
147-
147+
148148
.diff-line__num {
149149
min-width: 24px;
150150
padding: 0 4px;
151151
}
152152
}
153153
}
154-
154+
155155
&__num {
156156
min-width: 32px;
157157
padding: 0 6px;
158158
text-align: right;
159159
color: var(--color-text-muted, #666);
160160
opacity: 0.6;
161161
font-size: 11px;
162-
162+
163163
&--original {
164164
border-right: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.08));
165165
padding-right: 8px;
166166
}
167-
167+
168168
&--modified {
169169
padding-left: 8px;
170170
}
171171
}
172-
172+
173173
&__prefix {
174174
display: flex;
175175
align-items: center;
@@ -245,10 +245,10 @@
245245
background: rgba(0, 0, 0, 0.03);
246246
border-right-color: rgba(0, 0, 0, 0.08);
247247
}
248-
248+
249249
.diff-line__num {
250250
color: #6e7781;
251-
251+
252252
&--original {
253253
border-right-color: rgba(0, 0, 0, 0.1);
254254
}

src/web-ui/src/flow_chat/components/InlineDiffPreview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ export const InlineDiffPreview: React.FC<InlineDiffPreviewProps> = memo(({
284284

285285
const origNum = line.originalLineNumber ?? '';
286286
const modNum = line.modifiedLineNumber ?? '';
287-
287+
288288
const prefix = line.type === 'added' ? '+' : line.type === 'removed' ? '-' : ' ';
289-
289+
290290
return (
291291
<div
292292
key={`line-${index}`}

src/web-ui/src/tools/editor/components/DiffEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export const DiffEditor: React.FC<DiffEditorProps> = ({
255255

256256
glyphMargin: false,
257257
folding: false,
258-
lineNumbersMinChars: 2,
258+
lineNumbersMinChars: 4,
259259
lineDecorationsWidth: 10,
260260
padding: { top: 4, bottom: 4 },
261261

src/web-ui/src/tools/lsp/components/LspPluginList/LspPluginList.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
padding: $size-gap-5;
346346
gap: $size-gap-3;
347347

348-
svg {
348+
> svg {
349349
width: 48px;
350350
height: 48px;
351351
}

src/web-ui/src/tools/project-context/components/AddKnowledgeDialog/AddKnowledgeDialog.scss

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,8 @@
1717
// ==================== Dialog ====================
1818
.bitfun-add-knowledge-dialog {
1919
position: relative;
20-
background: var(--color-bg-primary);
21-
border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
22-
border-radius: 10px;
23-
width: 420px;
24-
max-width: calc(100vw - 48px);
25-
max-height: 85vh;
2620
display: flex;
2721
flex-direction: column;
28-
box-shadow:
29-
0 20px 60px rgba(0, 0, 0, 0.35),
30-
0 0 0 1px rgba(255, 255, 255, 0.04);
31-
animation: bitfun-dialog-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
32-
33-
@keyframes bitfun-dialog-enter {
34-
from {
35-
opacity: 0;
36-
transform: translateY(16px) scale(0.98);
37-
}
38-
to {
39-
opacity: 1;
40-
transform: translateY(0) scale(1);
41-
}
42-
}
4322

4423
// ==================== Header ====================
4524
&__header {

0 commit comments

Comments
 (0)