mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fixes (web): Optimized search page style and functionality #3221 - Updated search page and view title styles - Modified dataset list and multi-select control styles - Optimized text field and button styles - Updated filter button icons - Adjusted metadata filter styles - Added default descriptions for the smart assistant ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { ChevronDown } from 'lucide-react';
|
import { Funnel } from 'lucide-react';
|
||||||
import React, {
|
import React, {
|
||||||
ChangeEventHandler,
|
ChangeEventHandler,
|
||||||
PropsWithChildren,
|
PropsWithChildren,
|
||||||
@ -25,20 +25,20 @@ export const FilterButton = React.forwardRef<
|
|||||||
>(({ count = 0, ...props }, ref) => {
|
>(({ count = 0, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<Button variant="secondary" {...props} ref={ref}>
|
<Button variant="secondary" {...props} ref={ref}>
|
||||||
<span
|
{/* <span
|
||||||
className={cn({
|
className={cn({
|
||||||
'text-text-primary': count > 0,
|
'text-text-primary': count > 0,
|
||||||
'text-text-sub-title-invert': count === 0,
|
'text-text-sub-title-invert': count === 0,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
Filter
|
Filter
|
||||||
</span>
|
</span> */}
|
||||||
{count > 0 && (
|
{count > 0 && (
|
||||||
<span className="rounded-full bg-text-badge px-1 text-xs ">
|
<span className="rounded-full bg-text-badge px-1 text-xs ">
|
||||||
{count}
|
{count}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<ChevronDown />
|
<Funnel />
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -58,7 +58,10 @@ export function MetadataFilter({ prefix = '' }: MetadataFilterProps) {
|
|||||||
name={methodName}
|
name={methodName}
|
||||||
tooltip={t('metadataTip')}
|
tooltip={t('metadataTip')}
|
||||||
>
|
>
|
||||||
<SelectWithSearch options={MetadataOptions} />
|
<SelectWithSearch
|
||||||
|
options={MetadataOptions}
|
||||||
|
triggerClassName="!bg-bg-input"
|
||||||
|
/>
|
||||||
</RAGFlowFormItem>
|
</RAGFlowFormItem>
|
||||||
)}
|
)}
|
||||||
{hasKnowledge && metadata === DatasetMetadata.Manual && (
|
{hasKnowledge && metadata === DatasetMetadata.Manual && (
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const buttonVariants = cva(
|
|||||||
outline:
|
outline:
|
||||||
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||||
secondary:
|
secondary:
|
||||||
'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
'bg-bg-input text-secondary-foreground shadow-xs hover:bg-bg-input/80',
|
||||||
ghost:
|
ghost:
|
||||||
'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
||||||
link: 'text-primary underline-offset-4 hover:underline',
|
link: 'text-primary underline-offset-4 hover:underline',
|
||||||
|
|||||||
@ -54,7 +54,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|||||||
return (
|
return (
|
||||||
<textarea
|
<textarea
|
||||||
className={cn(
|
className={cn(
|
||||||
'flex min-h-[80px] w-full bg-bg-card rounded-md border border-input px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm overflow-hidden',
|
'flex min-h-[80px] w-full bg-bg-input rounded-md border border-input px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm overflow-hidden',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
rows={autoSize?.minRows ?? props.rows ?? undefined}
|
rows={autoSize?.minRows ?? props.rows ?? undefined}
|
||||||
|
|||||||
@ -1442,6 +1442,7 @@ This delimiter is used to split the input text into several text pieces echo of
|
|||||||
showQueryMindmap: 'Show Query Mindmap',
|
showQueryMindmap: 'Show Query Mindmap',
|
||||||
embedApp: 'Embed App',
|
embedApp: 'Embed App',
|
||||||
relatedSearch: 'Related Search',
|
relatedSearch: 'Related Search',
|
||||||
|
descriptionValue: 'You are an intelligent assistant.',
|
||||||
okText: 'Save',
|
okText: 'Save',
|
||||||
cancelText: 'Cancel',
|
cancelText: 'Cancel',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1345,6 +1345,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
|
|||||||
showQueryMindmap: '显示查询思维导图',
|
showQueryMindmap: '显示查询思维导图',
|
||||||
embedApp: '嵌入网站',
|
embedApp: '嵌入网站',
|
||||||
relatedSearch: '相关搜索',
|
relatedSearch: '相关搜索',
|
||||||
|
descriptionValue: '你是一位智能助手。',
|
||||||
okText: '保存',
|
okText: '保存',
|
||||||
cancelText: '返回',
|
cancelText: '返回',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -27,7 +27,7 @@ const IconMap = {
|
|||||||
[RunningStatus.UNSTART]: (
|
[RunningStatus.UNSTART]: (
|
||||||
<div className="w-0 h-0 border-l-[10px] border-l-accent-primary border-t-8 border-r-4 border-b-8 border-transparent"></div>
|
<div className="w-0 h-0 border-l-[10px] border-l-accent-primary border-t-8 border-r-4 border-b-8 border-transparent"></div>
|
||||||
),
|
),
|
||||||
[RunningStatus.RUNNING]: <CircleX size={14} />,
|
[RunningStatus.RUNNING]: <CircleX size={14} color="var(--state-error)" />,
|
||||||
[RunningStatus.CANCEL]: <RefreshCw size={14} color="var(--accent-primary)" />,
|
[RunningStatus.CANCEL]: <RefreshCw size={14} color="var(--accent-primary)" />,
|
||||||
[RunningStatus.DONE]: <RefreshCw size={14} color="var(--accent-primary)" />,
|
[RunningStatus.DONE]: <RefreshCw size={14} color="var(--accent-primary)" />,
|
||||||
[RunningStatus.FAIL]: <RefreshCw size={14} color="var(--accent-primary)" />,
|
[RunningStatus.FAIL]: <RefreshCw size={14} color="var(--accent-primary)" />,
|
||||||
|
|||||||
@ -65,7 +65,8 @@ export function useDatasetTableColumns({
|
|||||||
header: ({ column }) => {
|
header: ({ column }) => {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="transparent"
|
||||||
|
className="border-none"
|
||||||
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||||
>
|
>
|
||||||
{t('name')}
|
{t('name')}
|
||||||
@ -103,7 +104,8 @@ export function useDatasetTableColumns({
|
|||||||
header: ({ column }) => {
|
header: ({ column }) => {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="transparent"
|
||||||
|
className="border-none"
|
||||||
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||||
>
|
>
|
||||||
{t('uploadDate')}
|
{t('uploadDate')}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export default function SearchPage({
|
|||||||
<div className="relative z-10 px-8 pt-8 flex text-transparent flex-col justify-center items-center w-[780px]">
|
<div className="relative z-10 px-8 pt-8 flex text-transparent flex-col justify-center items-center w-[780px]">
|
||||||
<h1
|
<h1
|
||||||
className={cn(
|
className={cn(
|
||||||
'text-4xl font-bold bg-gradient-to-r from-sky-600 from-30% via-sky-500 via-60% to-emerald-500 bg-clip-text',
|
'text-4xl font-bold bg-gradient-to-l from-[#40EBE3] to-[#4A51FF] bg-clip-text',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
RAGFlow
|
RAGFlow
|
||||||
|
|||||||
@ -113,7 +113,7 @@ export function LlmSettingFieldItems({
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectWithSearch
|
<SelectWithSearch
|
||||||
options={options || modelOptions}
|
options={options || modelOptions}
|
||||||
triggerClassName="bg-bg-card"
|
triggerClassName="!bg-bg-input"
|
||||||
{...field}
|
{...field}
|
||||||
></SelectWithSearch>
|
></SelectWithSearch>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@ -114,8 +114,8 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
const [avatarBase64Str, setAvatarBase64Str] = useState(''); // Avatar Image base64
|
const [avatarBase64Str, setAvatarBase64Str] = useState(''); // Avatar Image base64
|
||||||
const [datasetList, setDatasetList] = useState<MultiSelectOptionType[]>([]);
|
const [datasetList, setDatasetList] = useState<MultiSelectOptionType[]>([]);
|
||||||
const [datasetSelectEmbdId, setDatasetSelectEmbdId] = useState('');
|
const [datasetSelectEmbdId, setDatasetSelectEmbdId] = useState('');
|
||||||
const descriptionDefaultValue = 'You are an intelligent assistant.';
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const descriptionDefaultValue = t('search.descriptionValue');
|
||||||
const resetForm = useCallback(() => {
|
const resetForm = useCallback(() => {
|
||||||
formMethods.reset({
|
formMethods.reset({
|
||||||
search_id: data?.id,
|
search_id: data?.id,
|
||||||
@ -415,7 +415,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
<FormLabel>{t('search.description')}</FormLabel>
|
<FormLabel>{t('search.description')}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="You are an intelligent assistant."
|
placeholder={descriptionDefaultValue}
|
||||||
{...field}
|
{...field}
|
||||||
onFocus={() => {
|
onFocus={() => {
|
||||||
if (field.value === descriptionDefaultValue) {
|
if (field.value === descriptionDefaultValue) {
|
||||||
@ -444,7 +444,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
<span className="text-destructive mr-1"> *</span>
|
<span className="text-destructive mr-1"> *</span>
|
||||||
{t('search.datasets')}
|
{t('search.datasets')}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl className="bg-bg-input">
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
options={datasetList}
|
options={datasetList}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
@ -452,7 +452,6 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
}}
|
}}
|
||||||
showSelectAll={false}
|
showSelectAll={false}
|
||||||
placeholder={t('chat.knowledgeBasesMessage')}
|
placeholder={t('chat.knowledgeBasesMessage')}
|
||||||
variant="inverted"
|
|
||||||
maxCount={10}
|
maxCount={10}
|
||||||
defaultValue={field.value}
|
defaultValue={field.value}
|
||||||
{...field}
|
{...field}
|
||||||
@ -568,6 +567,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
<RAGFlowSelect
|
<RAGFlowSelect
|
||||||
{...field}
|
{...field}
|
||||||
options={rerankModelOptions}
|
options={rerankModelOptions}
|
||||||
|
triggerClassName={'bg-bg-input'}
|
||||||
// disabled={disabled}
|
// disabled={disabled}
|
||||||
placeholder={'model'}
|
placeholder={'model'}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export default function SearchingView({
|
|||||||
>
|
>
|
||||||
<h1
|
<h1
|
||||||
className={cn(
|
className={cn(
|
||||||
'text-4xl font-bold bg-gradient-to-r from-sky-600 from-30% via-sky-500 via-60% to-emerald-500 bg-clip-text cursor-pointer',
|
'text-4xl font-bold bg-gradient-to-l from-[#40EBE3] to-[#4A51FF] bg-clip-text cursor-pointer',
|
||||||
)}
|
)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsSearching?.(false);
|
setIsSearching?.(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user