Skip to content

Commit 4437262

Browse files
author
Takahiro Kubo
committed
Add error messages for spaces around select label and options
1 parent 90d168e commit 4437262

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Diff for: packages/web/public/locales/translation/en.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,10 @@ useCaseBuilder:
843843
rag_knowledge_base_not_enabled: >-
844844
{{retrieveKnowledgeBase}} is specified in the prompt template, but RAG
845845
Chat (Knowledge Base) is not enabled in GenU.
846+
spaces_in_label: >-
847+
Remove any white spaces before and after {{label}}.
848+
spaces_in_value: >-
849+
Remove any white spaces before and after options of {{label}}.
846850
favorites: Favorites
847851
fileUploadDescription: Users can upload files for the LLM to reference the content.
848852
fileUploadDisabled: Disable file upload

Diff for: packages/web/public/locales/translation/ja.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,8 @@ useCaseBuilder:
720720
rag_knowledge_base_not_enabled: >-
721721
プロンプトテンプレート内で {{retrieveKnowledgeBase}} が指定されていますが GenU で RAG チャット
722722
(Knowledge Base) が有効になっていません。
723+
spaces_in_label: '{{label}}の前後にある空白を削除してください。'
724+
spaces_in_value: '{{label}}の値は、前後に空白を含まないよう設定してください。'
723725
favorites: お気に入り
724726
fileUploadDescription: 添付可能なファイルはモデルによって異なります
725727
fileUploadDisabled: ファイルは添付できません

Diff for: packages/web/src/components/useCaseBuilder/UseCaseBuilderView.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,14 @@ const UseCaseBuilderView: React.FC<Props> = (props) => {
280280
}
281281
}
282282

283+
for (const item of items) {
284+
if (item.label != item.label.trim()) {
285+
tmpErrorMessages.push(
286+
t('useCaseBuilder.error.spaces_in_label', {label: item.label})
287+
);
288+
}
289+
}
290+
283291
for (const item of selectItems) {
284292
if (!item.options || item.options.length === 0) {
285293
tmpErrorMessages.push(t('useCaseBuilder.error.missing_select_options'));
@@ -295,6 +303,16 @@ const UseCaseBuilderView: React.FC<Props> = (props) => {
295303
);
296304
}
297305

306+
// Check for options with leading/trailing spaces
307+
const spacedOptions = options.filter((o) => o !== o.trim());
308+
if (spacedOptions.length > 0) {
309+
tmpErrorMessages.push(
310+
t('useCaseBuilder.error.spaces_in_value', {
311+
label: item.label
312+
})
313+
);
314+
}
315+
298316
const uniqueOptions = options.filter(
299317
(elem, idx, self) => self.findIndex((e) => e === elem) === idx
300318
);

0 commit comments

Comments
 (0)