Skip to content

Commit ed06fba

Browse files
committed
feat(web): let onboarding pick the wiki language (UN quick-picks)
Adds a "Wiki language" field to the onboarding setup step, reusing the existing UnLanguageDatalist (the six official UN languages) as free-text quick-picks — so a non-English user sets their knowledge-base language up front. Saved via patchGlobalConfig config.language. en/zh label added to the common namespace.
1 parent 491cf5f commit ed06fba

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

frontend/src/components/Onboarding.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
DialogFooter,
1313
} from "@/components/ui/dialog"
1414
import { Button } from "@/components/ui/button"
15+
import { UnLanguageDatalist, UN_LANG_LIST_ID } from "@/components/UnLanguageDatalist"
1516
import { patchGlobalConfig, type GlobalConfigPatch } from "@/api/config"
1617
import { createKb } from "@/api/kb"
1718

@@ -28,6 +29,7 @@ export default function Onboarding({ open, onClose }: { open: boolean; onClose:
2829
const navigate = useNavigate()
2930
const [step, setStep] = useState(1)
3031
const [model, setModel] = useState("gpt-5.4")
32+
const [language, setLanguage] = useState("")
3133
const [apiKey, setApiKey] = useState("")
3234
const [baseUrl, setBaseUrl] = useState("")
3335
const [kbName, setKbName] = useState("my-kb")
@@ -39,6 +41,7 @@ export default function Onboarding({ open, onClose }: { open: boolean; onClose:
3941
setBusy(true)
4042
try {
4143
const patch: GlobalConfigPatch = { config: { model: model.trim() } }
44+
if (language.trim()) patch.config!.language = language.trim()
4245
if (apiKey.trim()) patch.api_key = apiKey.trim()
4346
if (baseUrl.trim()) patch.openai_api_base = baseUrl.trim()
4447
await patchGlobalConfig(patch)
@@ -108,6 +111,19 @@ export default function Onboarding({ open, onClose }: { open: boolean; onClose:
108111
</label>
109112
<input value={model} onChange={(e) => setModel(e.target.value)} className={inputCls} />
110113
</div>
114+
<div>
115+
<label className="text-[12px] font-medium text-muted-foreground">
116+
{t("onboarding.langLabel")}
117+
</label>
118+
<input
119+
value={language}
120+
onChange={(e) => setLanguage(e.target.value)}
121+
list={UN_LANG_LIST_ID}
122+
placeholder="English"
123+
className={inputCls}
124+
/>
125+
<UnLanguageDatalist />
126+
</div>
111127
<div>
112128
<label className="text-[12px] font-medium text-muted-foreground">
113129
{t("onboarding.apiKeyLabel")}

frontend/src/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"configTitle": "Connect your model",
6060
"configBody": "OpenKB uses an LLM to compile and answer. Paste an API key — it is stored locally and never leaves your machine.",
6161
"modelLabel": "LLM model",
62+
"langLabel": "Wiki language",
6263
"apiKeyLabel": "LLM API key",
6364
"apiKeyPlaceholder": "Paste your API key",
6465
"baseUrlLabel": "Custom base URL (optional)",

frontend/src/locales/zh/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"configTitle": "连接你的模型",
6060
"configBody": "OpenKB 用大模型来编译和回答。粘贴一个 API 密钥即可——它只存在本机,不会外传。",
6161
"modelLabel": "模型",
62+
"langLabel": "知识库语言",
6263
"apiKeyLabel": "LLM API 密钥",
6364
"apiKeyPlaceholder": "粘贴 API 密钥",
6465
"baseUrlLabel": "自定义 Base URL(可选)",

0 commit comments

Comments
 (0)