Skip to content

[ユースケースビルダー] フォーム・オプションの定義に含まれる空白のチェックを追加 #960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/web/public/locales/translation/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,10 @@ useCaseBuilder:
rag_knowledge_base_not_enabled: >-
{{retrieveKnowledgeBase}} is specified in the prompt template, but RAG
Chat (Knowledge Base) is not enabled in GenU.
spaces_in_label: >-
Remove any white spaces before and after {{label}}.
spaces_in_value: >-
Remove any white spaces before and after options of {{label}}.
favorites: Favorites
fileUploadDescription: Users can upload files for the LLM to reference the content.
fileUploadDisabled: Disable file upload
Expand Down
2 changes: 2 additions & 0 deletions packages/web/public/locales/translation/ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,8 @@ useCaseBuilder:
rag_knowledge_base_not_enabled: >-
プロンプトテンプレート内で {{retrieveKnowledgeBase}} が指定されていますが GenU で RAG チャット
(Knowledge Base) が有効になっていません。
spaces_in_label: '{{label}}の前後にある空白を削除してください。'
spaces_in_value: '{{label}}の値は、前後に空白を含まないよう設定してください。'
favorites: お気に入り
fileUploadDescription: 添付可能なファイルはモデルによって異なります
fileUploadDisabled: ファイルは添付できません
Expand Down
18 changes: 18 additions & 0 deletions packages/web/src/components/useCaseBuilder/UseCaseBuilderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ const UseCaseBuilderView: React.FC<Props> = (props) => {
}
}

for (const item of items) {
if (item.label != item.label.trim()) {
tmpErrorMessages.push(
t('useCaseBuilder.error.spaces_in_label', {label: item.label})
);
}
}

for (const item of selectItems) {
if (!item.options || item.options.length === 0) {
tmpErrorMessages.push(t('useCaseBuilder.error.missing_select_options'));
Expand All @@ -295,6 +303,16 @@ const UseCaseBuilderView: React.FC<Props> = (props) => {
);
}

// Check for options with leading/trailing spaces
const spacedOptions = options.filter((o) => o !== o.trim());
if (spacedOptions.length > 0) {
tmpErrorMessages.push(
t('useCaseBuilder.error.spaces_in_value', {
label: item.label
})
);
}

const uniqueOptions = options.filter(
(elem, idx, self) => self.findIndex((e) => e === elem) === idx
);
Expand Down