-
Notifications
You must be signed in to change notification settings - Fork 533
Select existing KB from a drop-down #986
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
base: v3
Are you sure you want to change the base?
Changes from 1 commit
e1a04d0
ba54077
ca56574
d899949
f902b49
a5c99e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,7 @@ import { | |
| } from '../types'; | ||
| import { toCamelCase } from '../../../utils/StringUtils'; | ||
| import useGlobalConfig from '../../../hooks/useGlobalConfig'; | ||
| import useKnowledgeBaseApi from '../../../hooks/useKnowledgeBaseApi'; | ||
|
mludvig marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cloud you wrap |
||
|
|
||
| const edgeGenerationParams = EDGE_GENERATION_PARAMS; | ||
|
|
||
|
|
@@ -82,6 +83,8 @@ const BotKbEditPage: React.FC = () => { | |
| const { availableTools } = useAgent(); | ||
| const { getGlobalConfig } = useGlobalConfig(); | ||
| const { data: globalConfig } = getGlobalConfig(); | ||
| const { listKnowledgeBases } = useKnowledgeBaseApi(); | ||
| const { data: knowledgeBasesData } = listKnowledgeBases(); | ||
|
mludvig marked this conversation as resolved.
Outdated
|
||
|
|
||
| const [isLoading, setIsLoading] = useState(false); | ||
|
|
||
|
|
@@ -1604,7 +1607,10 @@ const BotKbEditPage: React.FC = () => { | |
| label={t( | ||
| 'knowledgeBaseSettings.advancedConfigration.createDedicatedKnowledgeBase.label' | ||
| )} | ||
| onChange={() => setKnowledgeBaseType('new')} | ||
| onChange={() => { | ||
| setKnowledgeBaseType('new'); | ||
| setExistKnowledgeBaseId(null); | ||
| }} | ||
| /> | ||
| <RadioButton | ||
| name="knowledgeBaseType" | ||
|
|
@@ -1613,7 +1619,10 @@ const BotKbEditPage: React.FC = () => { | |
| label={t( | ||
| 'knowledgeBaseSettings.advancedConfigration.createTenantInSharedKnowledgeBase.label' | ||
| )} | ||
| onChange={() => setKnowledgeBaseType('shared')} | ||
| onChange={() => { | ||
| setKnowledgeBaseType('shared'); | ||
| setExistKnowledgeBaseId(null); | ||
| }} | ||
| /> | ||
| <RadioButton | ||
| name="knowledgeBaseType" | ||
|
|
@@ -1628,18 +1637,34 @@ const BotKbEditPage: React.FC = () => { | |
|
|
||
| {(() => { | ||
| if (knowledgeBaseType === 'existing') { | ||
| // Prepare knowledge base options for the dropdown | ||
| const knowledgeBaseOptions = ( | ||
| knowledgeBasesData?.knowledgeBases || [] | ||
| ).map((kb) => ({ | ||
| value: kb.knowledgeBaseId, | ||
| label: `${kb.name} (${kb.knowledgeBaseId})`, | ||
| description: kb.description || kb.status, | ||
|
mludvig marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| })); | ||
|
|
||
| return ( | ||
| <div className="mt-3 rounded-lg border border-aws-font-color-light/30 p-4 dark:border-aws-font-color-dark/30"> | ||
| <InputText | ||
| <Select | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In some usecases, users want to enter ID, title, desc with free text format. |
||
| label={t( | ||
| 'knowledgeBaseSettings.advancedConfigration.existingKnowledgeBaseId.label' | ||
| )} | ||
| value={existKnowledgeBaseId ?? ''} | ||
| options={knowledgeBaseOptions} | ||
| onChange={setExistKnowledgeBaseId} | ||
| disabled={!isNewBot} | ||
| placeholder="ABCDEFGHIJ" | ||
| disabled={knowledgeBaseOptions.length === 0} | ||
| /> | ||
| <div className="text-sm text-aws-font-color-light/50 dark:text-aws-font-color-dark"> | ||
| {knowledgeBaseOptions.length === 0 && ( | ||
| <div className="mt-2 text-sm text-red"> | ||
| {t( | ||
| 'knowledgeBaseSettings.advancedConfigration.existingKnowledgeBaseId.noKnowledgeBasesFound' | ||
| )} | ||
| </div> | ||
| )} | ||
| <div className="mt-2 text-sm text-aws-font-color-light/50 dark:text-aws-font-color-dark"> | ||
| {t( | ||
| 'knowledgeBaseSettings.advancedConfigration.existingKnowledgeBaseId.description' | ||
| )} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.