Files
ragflow/web/src/components/new-document-link.tsx
balibabu 906c0c5c89 fix: Set the default value of Self RAG to false #1220 (#1702)
### What problem does this PR solve?

fix: Set the default value of Self RAG  to false #1220
fix: Change all tool file names to kebab format

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2024-07-25 14:38:17 +08:00

49 lines
996 B
TypeScript

import {
getExtension,
isSupportedPreviewDocumentType,
} from '@/utils/document-util';
import React from 'react';
interface IProps extends React.PropsWithChildren {
link?: string;
preventDefault?: boolean;
color?: string;
documentName: string;
documentId?: string;
prefix?: string;
}
const NewDocumentLink = ({
children,
link,
preventDefault = false,
color = 'rgb(15, 79, 170)',
documentId,
documentName,
prefix = 'file',
}: IProps) => {
let nextLink = link;
const extension = getExtension(documentName);
if (!link) {
nextLink = `/document/${documentId}?ext=${extension}&prefix=${prefix}`;
}
return (
<a
target="_blank"
onClick={
!preventDefault || isSupportedPreviewDocumentType(extension)
? undefined
: (e) => e.preventDefault()
}
href={nextLink}
rel="noreferrer"
style={{ color, wordBreak: 'break-all' }}
>
{children}
</a>
);
};
export default NewDocumentLink;