mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Optimized the style and functionality of multiple components #3221 - Modified the SkeletonCard component, adding a className attribute and adjusting the style - Updated the RAGFlowSelect component, adding a disabled attribute - Adjusted the style of the Tooltip component - Optimized the layout of the RetrievalTesting and TestingResult pages - Updated the style and loading status display of NextSearch-related pages - Removed unnecessary logs from the Spotlight component ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,13 +1,16 @@
|
|||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
export function SkeletonCard() {
|
type SkeletonCardProps = {
|
||||||
|
className?: string;
|
||||||
|
};
|
||||||
|
export function SkeletonCard(props: SkeletonCardProps) {
|
||||||
|
const { className } = props;
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col space-y-3 items-center">
|
<div className={cn('space-y-2', className)}>
|
||||||
<Skeleton className="h-[125px] w-[250px] rounded-xl" />
|
<Skeleton className="h-4 w-full bg-bg-card" />
|
||||||
<div className="space-y-2 w-[250px]">
|
<Skeleton className="h-4 w-full bg-bg-card" />
|
||||||
<Skeleton className="h-4 w-[250px]" />
|
<Skeleton className="h-4 w-2/3 bg-bg-card" />
|
||||||
<Skeleton className="h-4 w-[200px]" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -224,6 +224,7 @@ export const RAGFlowSelect = forwardRef<
|
|||||||
allowClear,
|
allowClear,
|
||||||
placeholder,
|
placeholder,
|
||||||
contentProps = {},
|
contentProps = {},
|
||||||
|
disabled = false,
|
||||||
// defaultValue,
|
// defaultValue,
|
||||||
triggerClassName,
|
triggerClassName,
|
||||||
onlyShowSelectedIcon = false,
|
onlyShowSelectedIcon = false,
|
||||||
@ -278,7 +279,12 @@ export const RAGFlowSelect = forwardRef<
|
|||||||
}, [onlyShowSelectedIcon, options, value]);
|
}, [onlyShowSelectedIcon, options, value]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select onValueChange={handleChange} value={value} key={key}>
|
<Select
|
||||||
|
onValueChange={handleChange}
|
||||||
|
value={value}
|
||||||
|
key={key}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
<FormControlWidget>
|
<FormControlWidget>
|
||||||
<SelectTrigger
|
<SelectTrigger
|
||||||
value={value}
|
value={value}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export const AntToolTip: React.FC<AntToolTipProps> = ({
|
|||||||
{visible && title && (
|
{visible && title && (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'absolute z-50 px-2.5 py-1.5 text-xs text-white bg-gray-800 rounded-sm shadow-sm whitespace-nowrap',
|
'absolute z-50 px-2.5 py-2 text-xs text-text-primary bg-muted rounded-sm shadow-sm whitespace-wrap',
|
||||||
getPlacementClasses(),
|
getPlacementClasses(),
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
@ -115,7 +115,7 @@ export const AntToolTip: React.FC<AntToolTipProps> = ({
|
|||||||
{title}
|
{title}
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'absolute w-2 h-2 bg-gray-800',
|
'absolute w-2 h-2 bg-muted ',
|
||||||
placement === 'top' &&
|
placement === 'top' &&
|
||||||
'bottom-[-4px] left-1/2 transform -translate-x-1/2 rotate-45',
|
'bottom-[-4px] left-1/2 transform -translate-x-1/2 rotate-45',
|
||||||
placement === 'bottom' &&
|
placement === 'bottom' &&
|
||||||
|
|||||||
@ -40,12 +40,14 @@ export default function RetrievalTesting() {
|
|||||||
<Plus /> Add New Test
|
<Plus /> Add New Test
|
||||||
</Button> */}
|
</Button> */}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="h-[calc(100vh-241px)] overflow-auto scrollbar-thin">
|
||||||
<TestingForm
|
<TestingForm
|
||||||
loading={loading}
|
loading={loading}
|
||||||
setValues={setValues}
|
setValues={setValues}
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
></TestingForm>
|
></TestingForm>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<TestingResult
|
<TestingResult
|
||||||
data={data}
|
data={data}
|
||||||
page={page}
|
page={page}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export function TestingResult({
|
|||||||
<FilterButton></FilterButton>
|
<FilterButton></FilterButton>
|
||||||
</FilterPopover>
|
</FilterPopover>
|
||||||
</div>
|
</div>
|
||||||
<section className="flex flex-col gap-5 overflow-auto h-[76vh] mb-5">
|
<section className="flex flex-col gap-5 overflow-auto h-[calc(100vh-241px)] scrollbar-thin mb-5">
|
||||||
{data.chunks?.map((x) => (
|
{data.chunks?.map((x) => (
|
||||||
<FormContainer key={x.chunk_id} className="px-5 py-2.5">
|
<FormContainer key={x.chunk_id} className="px-5 py-2.5">
|
||||||
<ChunkTitle item={x}></ChunkTitle>
|
<ChunkTitle item={x}></ChunkTitle>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { FileIcon } from '@/components/icon-font';
|
import { FileIcon } from '@/components/icon-font';
|
||||||
import { ImageWithPopover } from '@/components/image';
|
import { ImageWithPopover } from '@/components/image';
|
||||||
import { Input } from '@/components/originui/input';
|
import { Input } from '@/components/originui/input';
|
||||||
|
import { SkeletonCard } from '@/components/skeleton-card';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import {
|
import {
|
||||||
Popover,
|
Popover,
|
||||||
@ -8,7 +9,6 @@ import {
|
|||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from '@/components/ui/popover';
|
} from '@/components/ui/popover';
|
||||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
|
||||||
import { IReference } from '@/interfaces/database/chat';
|
import { IReference } from '@/interfaces/database/chat';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
@ -157,11 +157,7 @@ export default function SearchingView({
|
|||||||
{t('search.AISummary')}
|
{t('search.AISummary')}
|
||||||
</div>
|
</div>
|
||||||
{isEmpty(answer) && sendingLoading ? (
|
{isEmpty(answer) && sendingLoading ? (
|
||||||
<div className="space-y-2 mt-2">
|
<SkeletonCard className=" mt-2" />
|
||||||
<Skeleton className="h-4 w-full bg-bg-card" />
|
|
||||||
<Skeleton className="h-4 w-full bg-bg-card" />
|
|
||||||
<Skeleton className="h-4 w-2/3 bg-bg-card" />
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
answer.answer && (
|
answer.answer && (
|
||||||
<div className="border rounded-lg p-4 mt-3 max-h-52 overflow-auto scrollbar-none">
|
<div className="border rounded-lg p-4 mt-3 max-h-52 overflow-auto scrollbar-none">
|
||||||
@ -195,12 +191,9 @@ export default function SearchingView({
|
|||||||
<>
|
<>
|
||||||
{chunks.map((chunk, index) => {
|
{chunks.map((chunk, index) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<div key={index}>
|
||||||
<div
|
<div className="w-full flex flex-col">
|
||||||
key={chunk.chunk_id}
|
<div className="w-full highlightContent">
|
||||||
className="w-full flex flex-col"
|
|
||||||
>
|
|
||||||
<div className="w-full">
|
|
||||||
<ImageWithPopover
|
<ImageWithPopover
|
||||||
id={chunk.img_id}
|
id={chunk.img_id}
|
||||||
></ImageWithPopover>
|
></ImageWithPopover>
|
||||||
@ -215,10 +208,12 @@ export default function SearchingView({
|
|||||||
className="text-sm text-text-primary mb-1"
|
className="text-sm text-text-primary mb-1"
|
||||||
></div>
|
></div>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="text-text-primary">
|
<PopoverContent className="text-text-primary !w-full max-w-lg ">
|
||||||
|
<div className="max-h-96 overflow-auto scrollbar-thin">
|
||||||
<HightLightMarkdown>
|
<HightLightMarkdown>
|
||||||
{chunk.content_with_weight}
|
{chunk.content_with_weight}
|
||||||
</HightLightMarkdown>
|
</HightLightMarkdown>
|
||||||
|
</div>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
@ -235,7 +230,7 @@ export default function SearchingView({
|
|||||||
{index < chunks.length - 1 && (
|
{index < chunks.length - 1 && (
|
||||||
<div className="w-full border-b border-border-default/80 mt-6"></div>
|
<div className="w-full border-b border-border-default/80 mt-6"></div>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -7,7 +7,6 @@ interface SpotlightProps {
|
|||||||
|
|
||||||
const Spotlight: React.FC<SpotlightProps> = ({ className }) => {
|
const Spotlight: React.FC<SpotlightProps> = ({ className }) => {
|
||||||
const isDark = useIsDarkTheme();
|
const isDark = useIsDarkTheme();
|
||||||
console.log('isDark', isDark);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`absolute inset-0 opacity-80 ${className} rounded-lg`}
|
className={`absolute inset-0 opacity-80 ${className} rounded-lg`}
|
||||||
|
|||||||
Reference in New Issue
Block a user