fix: chat quote number (#4679)
This commit is contained in:
@@ -72,6 +72,7 @@ type RenderHeaderProps = {
|
||||
onUpdateParentId: (parentId: ParentIdType) => void;
|
||||
};
|
||||
type RenderListProps = {
|
||||
templateType: TemplateTypeEnum;
|
||||
templates: NodeTemplateListItemType[];
|
||||
type: TemplateTypeEnum;
|
||||
onClose: () => void;
|
||||
@@ -247,6 +248,7 @@ const NodeTemplatesModal = ({ isOpen, onClose }: ModuleTemplateListProps) => {
|
||||
setSearchKey={setSearchKey}
|
||||
/>
|
||||
<RenderList
|
||||
templateType={templateType}
|
||||
templates={templates}
|
||||
type={templateType}
|
||||
onClose={onClose}
|
||||
@@ -402,6 +404,7 @@ const RenderHeader = React.memo(function RenderHeader({
|
||||
});
|
||||
|
||||
const RenderList = React.memo(function RenderList({
|
||||
templateType,
|
||||
templates,
|
||||
type,
|
||||
onClose,
|
||||
@@ -712,7 +715,7 @@ const RenderList = React.memo(function RenderList({
|
||||
{t(template.name as any)}
|
||||
</Box>
|
||||
|
||||
{template.isFolder && (
|
||||
{template.isFolder && templateType === TemplateTypeEnum.teamPlugin && (
|
||||
<Box
|
||||
color={'myGray.500'}
|
||||
_hover={{
|
||||
|
||||
@@ -94,8 +94,8 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo
|
||||
icon: 'core/app/simpleMode/variable'
|
||||
},
|
||||
{
|
||||
key: 'sourceIndex',
|
||||
label: t('common:core.dataset.search.Source index'),
|
||||
key: 'sourceId',
|
||||
label: t('common:core.dataset.search.Source id'),
|
||||
icon: 'core/app/simpleMode/variable'
|
||||
},
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ const CollectionReader = ({
|
||||
const router = useRouter();
|
||||
const { userInfo } = useUserStore();
|
||||
|
||||
const { collectionId, datasetId, chatItemDataId, sourceId, sourceName } = metadata;
|
||||
const { collectionId, datasetId, chatItemDataId, sourceId, sourceName, quoteId } = metadata;
|
||||
const [quoteIndex, setQuoteIndex] = useState(0);
|
||||
|
||||
// Get dataset permission
|
||||
@@ -45,11 +45,19 @@ const CollectionReader = ({
|
||||
});
|
||||
|
||||
const filterResults = useMemo(() => {
|
||||
setQuoteIndex(0);
|
||||
return rawSearch
|
||||
const res = rawSearch
|
||||
.filter((item) => item.collectionId === collectionId)
|
||||
.sort((a, b) => (a.chunkIndex || 0) - (b.chunkIndex || 0));
|
||||
}, [collectionId, rawSearch]);
|
||||
|
||||
if (quoteId) {
|
||||
setQuoteIndex(res.findIndex((item) => item.id === quoteId));
|
||||
} else {
|
||||
setQuoteIndex(0);
|
||||
}
|
||||
|
||||
return res;
|
||||
}, [collectionId, quoteId, rawSearch]);
|
||||
|
||||
const currentQuoteItem = useMemo(() => {
|
||||
const item = filterResults[quoteIndex];
|
||||
if (item) {
|
||||
|
||||
Reference in New Issue
Block a user