Skip to content
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

Knowledge optimization #3755

Merged
merged 62 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8245cc5
1. support cover duplicate document
JohnJyong Mar 7, 2024
a6d2bd7
dataset optimization
JohnJyong Mar 7, 2024
a267969
add app and dataset tag support
JohnJyong Mar 8, 2024
ea2945c
knowledge add update dataset embedding model
JohnJyong Mar 11, 2024
bdc7611
feat: support change model in fe
crazywoola Mar 11, 2024
4b3982d
fix: index error
crazywoola Mar 12, 2024
75c208e
feat: retry button ui
crazywoola Mar 12, 2024
6f5cd4d
feat: retry button ui
crazywoola Mar 12, 2024
0c7680b
feat: use a standalone widget
crazywoola Mar 12, 2024
2597ae7
feat: add an api to get error tasks
crazywoola Mar 12, 2024
2790cf4
feat: add an api to get error tasks
crazywoola Mar 12, 2024
f8e3ad6
support mutil documents retry
JohnJyong Mar 12, 2024
3021f02
feat: add fetch
crazywoola Mar 13, 2024
4643c04
feat: add retry button
crazywoola Mar 13, 2024
cc17de4
feat: add missing status
crazywoola Mar 13, 2024
4ab025c
feat: add more status
crazywoola Mar 13, 2024
b161fae
feat: add more status
crazywoola Mar 13, 2024
483536a
chore: update code
crazywoola Mar 13, 2024
a1b48f4
fix: dataset error
crazywoola Mar 13, 2024
832d249
fix: dataset error
crazywoola Mar 13, 2024
224996b
fix vector db delete object when collection is not exist
JohnJyong Mar 16, 2024
c26f8eb
add tag filter
JohnJyong Mar 27, 2024
f73ea4e
add tag filter
JohnJyong Mar 27, 2024
8ed8aa9
add tags to dataset and app list
JohnJyong Mar 29, 2024
f0d7fc1
Merge branch 'main' into feat/knowledge-optimization
JohnJyong Apr 9, 2024
97c2be8
fix merge error
JohnJyong Apr 9, 2024
6847168
support keyword search in dataset list
JzoNgKVO Mar 28, 2024
5a210d6
add tag filter
JzoNgKVO Mar 28, 2024
f03b124
tag filter
JzoNgKVO Mar 28, 2024
9bc4953
update style of creation card
JzoNgKVO Mar 29, 2024
c34b40f
Merge branch 'main' into feat/knowledge-optimization
JohnJyong Apr 11, 2024
84da829
add db migrate
JohnJyong Apr 11, 2024
f8c4de2
merge main
JohnJyong Apr 11, 2024
d8ba1db
update dataset card
JzoNgKVO Apr 13, 2024
8951050
tag item
JzoNgKVO Apr 13, 2024
65c96ae
tag selector
JzoNgKVO Apr 13, 2024
8f21b87
tag selector
JzoNgKVO Apr 14, 2024
b01f839
tag delete
JzoNgKVO Apr 14, 2024
d7e52e7
tag update
JzoNgKVO Apr 14, 2024
9621e58
add translations
JzoNgKVO Apr 14, 2024
d05cdf0
add tag created at desc
JohnJyong Apr 14, 2024
d23d5bc
Merge branch 'main' into feat/knowledge-optimization
JohnJyong Apr 14, 2024
1c47500
add tag created at desc
JohnJyong Apr 15, 2024
6c07afb
question classifier prompt optimization
JohnJyong Apr 15, 2024
18fa967
add tag_id
JohnJyong Apr 15, 2024
1aef8c3
fix tag unbinding
JzoNgKVO Apr 15, 2024
086c3ac
style of tag selector
JzoNgKVO Apr 16, 2024
fe42ce4
tag select
JzoNgKVO Apr 16, 2024
0950ded
chore: modify i18n
JzoNgKVO Apr 17, 2024
c42ed75
tag update WYSIWYG
JzoNgKVO Apr 17, 2024
a922e1a
add debounce for tag filtering
JzoNgKVO Apr 17, 2024
2e4d03c
support tag filtering in app list
JzoNgKVO Apr 17, 2024
467299c
fix the return with wrong datatype of segment
JohnJyong Apr 17, 2024
2ae84ad
Merge remote-tracking branch 'origin/feat/knowledge-optimization' int…
JohnJyong Apr 17, 2024
2eb9e94
fix the return with wrong datatype of segment
JohnJyong Apr 17, 2024
d34cd11
app support tags
JzoNgKVO Apr 17, 2024
945db4d
app tags field
JohnJyong Apr 17, 2024
dcc3b47
fix style and action tip of tag modification
JzoNgKVO Apr 24, 2024
ab24480
fix use tag store
JzoNgKVO Apr 24, 2024
5c8fa11
Merge branch 'main' into feat/knowledge-optimization
JohnJyong Apr 24, 2024
1ff7ee1
dev/reformat
JohnJyong Apr 24, 2024
3338fe3
dev/reformat
JohnJyong Apr 24, 2024
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
Prev Previous commit
Next Next commit
tag update WYSIWYG
  • Loading branch information
JzoNgKVO committed Apr 17, 2024
commit c42ed75b969b2262646c236ec03f137fa7047f7b
22 changes: 14 additions & 8 deletions web/app/(commonLayout)/datasets/DatasetCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useContext } from 'use-context-selector'
import Link from 'next/link'
import { useCallback, useState } from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import cn from 'classnames'
import Confirm from '@/app/components/base/confirm'
Expand All @@ -16,7 +16,7 @@ import CustomPopover from '@/app/components/base/popover'
import Divider from '@/app/components/base/divider'
import { DotsHorizontal } from '@/app/components/base/icons/src/vender/line/general'
import RenameDatasetModal from '@/app/components/datasets/rename-modal'
// import type { Tag } from '@/app/components/base/tag-management/constant'
import type { Tag } from '@/app/components/base/tag-management/constant'
import TagSelector from '@/app/components/base/tag-management/selector'

export type DatasetCardProps = {
Expand All @@ -30,6 +30,7 @@ const DatasetCard = ({
}: DatasetCardProps) => {
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const [tags, setTags] = useState<Tag[]>(dataset.tags)

const [showRenameModal, setShowRenameModal] = useState(false)
const [showConfirmDelete, setShowConfirmDelete] = useState(false)
Expand Down Expand Up @@ -80,6 +81,10 @@ const DatasetCard = ({
)
}

useEffect(() => {
setTags(dataset.tags)
}, [dataset])

return (
<>
<Link
Expand Down Expand Up @@ -123,31 +128,32 @@ const DatasetCard = ({
<div
className={cn(
'grow mb-2 px-[14px] max-h-[72px] text-xs leading-normal text-gray-500 group-hover:line-clamp-2',
dataset.tags.length ? 'line-clamp-2' : 'line-clamp-4',
tags.length ? 'line-clamp-2' : 'line-clamp-4',
!dataset.embedding_available && 'opacity-50 hover:opacity-100',
)}
title={dataset.description}>
{dataset.description}
</div>
<div className={cn(
'items-center shrink-0 pt-1 pl-[14px] pr-[6px] pb-[6px] h-[42px]',
dataset.tags.length ? 'flex' : '!hidden group-hover:!flex',
tags.length ? 'flex' : '!hidden group-hover:!flex',
)}>
<div className={cn('grow flex items-center gap-1 w-0', !dataset.embedding_available && 'opacity-50 hover:opacity-100')} onClick={(e) => {
e.stopPropagation()
e.preventDefault()
}}>
<div className={cn(
'group-hover:!block group-hover:!mr-0 mr-[41px] grow w-full',
dataset.tags.length ? '!block' : '!hidden',
tags.length ? '!block' : '!hidden',
)}>
<TagSelector
position='bl'
type='knowledge'
value={dataset.tags.map(tag => tag.id)}
selectedTags={dataset.tags}
onChange={onSuccess}
targetID={dataset.id}
value={tags.map(tag => tag.id)}
selectedTags={tags}
onCacheUpdate={setTags}
onChange={onSuccess}
/>
</div>
</div>
Expand Down
10 changes: 7 additions & 3 deletions web/app/components/base/tag-management/selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type TagSelectorProps = {
type: 'knowledge' | 'app'
value: string[]
selectedTags: Tag[]
onCacheUpdate: (tags: Tag[]) => void
onChange?: () => void
}

Expand All @@ -33,7 +34,7 @@ type PanelProps = {
const Panel = (props: PanelProps) => {
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const { targetID, type, value, selectedTags, onChange, onCreate } = props
const { targetID, type, value, selectedTags, onCacheUpdate, onChange, onCreate } = props
const { tagList, setTagList, setShowTagManagementModal } = useTagStore()
const [selectedTagIDs, setSelectedTagIDs] = useState<string[]>(value)
const [keywords, setKeywords] = useState('')
Expand Down Expand Up @@ -104,7 +105,8 @@ const Panel = (props: PanelProps) => {
const handleValueChange = () => {
const addTagIDs = selectedTagIDs.filter(v => !value.includes(v))
const removeTagIDs = value.filter(v => !selectedTagIDs.includes(v))

const selectedTags = tagList.filter(tag => selectedTagIDs.includes(tag.id))
onCacheUpdate(selectedTags)
Promise.all([
...(addTagIDs.length ? [bind(addTagIDs)] : []),
...[removeTagIDs.length ? removeTagIDs.map(tagID => unbind(tagID)) : []],
Expand Down Expand Up @@ -201,6 +203,7 @@ const TagSelector: FC<TagSelectorProps> = ({
type,
value,
selectedTags,
onCacheUpdate,
onChange,
}) => {
const { t } = useTranslation()
Expand Down Expand Up @@ -237,10 +240,11 @@ const TagSelector: FC<TagSelectorProps> = ({
<CustomPopover
htmlContent={
<Panel
targetID={targetID}
type={type}
targetID={targetID}
value={value}
selectedTags={selectedTags}
onCacheUpdate={onCacheUpdate}
onChange={onChange}
onCreate={getTagList}
/>
Expand Down