-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What problem does this PR solve? Feat: Add description for tag parsing method #4368 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
8 changed files
with
244 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 33 additions & 13 deletions
46
web/src/pages/add-knowledge/components/knowledge-setting/tag-tabs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; | ||
import { Segmented } from 'antd'; | ||
import { SegmentedLabeledOption } from 'antd/es/segmented'; | ||
import { upperFirst } from 'lodash'; | ||
import { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { TagTable } from './tag-table'; | ||
import { TagWordCloud } from './tag-word-cloud'; | ||
|
||
enum TagType { | ||
Cloud = 'cloud', | ||
Table = 'table', | ||
} | ||
|
||
const TagContentMap = { | ||
[TagType.Cloud]: <TagWordCloud></TagWordCloud>, | ||
[TagType.Table]: <TagTable></TagTable>, | ||
}; | ||
|
||
export function TagTabs() { | ||
const [value, setValue] = useState<TagType>(TagType.Cloud); | ||
const { t } = useTranslation(); | ||
|
||
const options: SegmentedLabeledOption[] = [TagType.Cloud, TagType.Table].map( | ||
(x) => ({ | ||
label: t(`knowledgeConfiguration.tag${upperFirst(x)}`), | ||
value: x, | ||
}), | ||
); | ||
|
||
return ( | ||
<Tabs defaultValue="account" className="mt-4"> | ||
<TabsList> | ||
<TabsTrigger value="account">Word cloud</TabsTrigger> | ||
<TabsTrigger value="password">Table</TabsTrigger> | ||
</TabsList> | ||
<TabsContent value="account"> | ||
<TagWordCloud></TagWordCloud> | ||
</TabsContent> | ||
<TabsContent value="password"> | ||
<TagTable></TagTable> | ||
</TabsContent> | ||
</Tabs> | ||
<section className="mt-4"> | ||
<Segmented | ||
value={value} | ||
options={options} | ||
onChange={(val) => setValue(val as TagType)} | ||
/> | ||
{TagContentMap[value]} | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters