mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-03 00:55:10 +08:00
### What problem does this PR solve? Fix: Optimize styling and add a search settings loading state #3221 - Updated the calendar component's background color to use a variable - Modified the Spin component's styling to use the primary text color instead of black - Added a form submission loading state to the search settings component - Optimized the search settings form, unifying the styles of the model selection and input fields ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
.rdp-selected {
|
.rdp-selected {
|
||||||
background-color: #f5f5f529;
|
background-color: var(--background-highlight);
|
||||||
}
|
}
|
||||||
.range-start {
|
.range-start {
|
||||||
background-color: #f5f5f5;
|
background-color: var(--text-secondary);
|
||||||
border-top-left-radius: 10px;
|
border-top-left-radius: 10px;
|
||||||
border-bottom-left-radius: 10px;
|
border-bottom-left-radius: 10px;
|
||||||
button {
|
button {
|
||||||
@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.range-end {
|
.range-end {
|
||||||
background-color: #f5f5f5;
|
background-color: var(--text-secondary);
|
||||||
border-top-right-radius: 10px;
|
border-top-right-radius: 10px;
|
||||||
border-bottom-right-radius: 10px;
|
border-bottom-right-radius: 10px;
|
||||||
button {
|
button {
|
||||||
|
|||||||
@ -25,14 +25,14 @@ export const Spin: React.FC<SpinProps> = ({
|
|||||||
className={cn(
|
className={cn(
|
||||||
'relative',
|
'relative',
|
||||||
{
|
{
|
||||||
'after:content-[""] after:absolute after:inset-0 after:z-10 after:bg-black/40 after:transition-all after:duration-300':
|
'after:content-[""] after:absolute after:inset-0 after:z-10 after:bg-text-primary/40 after:transition-all after:duration-300 h-full w-full':
|
||||||
spinning,
|
spinning,
|
||||||
},
|
},
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{spinning && (
|
{spinning && (
|
||||||
<div className="absolute inset-0 z-10 flex items-center justify-center bg-black/30 ">
|
<div className="absolute inset-0 z-10 flex items-center justify-center bg-text-primary/30 ">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'rounded-full border-muted-foreground border-2 border-t-transparent animate-spin',
|
'rounded-full border-muted-foreground border-2 border-t-transparent animate-spin',
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import {
|
|||||||
MultiSelectOptionType,
|
MultiSelectOptionType,
|
||||||
} from '@/components/ui/multi-select';
|
} from '@/components/ui/multi-select';
|
||||||
import { RAGFlowSelect } from '@/components/ui/select';
|
import { RAGFlowSelect } from '@/components/ui/select';
|
||||||
|
import { Spin } from '@/components/ui/spin';
|
||||||
import { Switch } from '@/components/ui/switch';
|
import { Switch } from '@/components/ui/switch';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
|
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
|
||||||
@ -226,11 +227,13 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { updateSearch } = useUpdateSearch();
|
const { updateSearch } = useUpdateSearch();
|
||||||
|
const [formSubmitLoading, setFormSubmitLoading] = useState(false);
|
||||||
const { data: systemSetting } = useFetchTenantInfo();
|
const { data: systemSetting } = useFetchTenantInfo();
|
||||||
const onSubmit = async (
|
const onSubmit = async (
|
||||||
formData: IUpdateSearchProps & { tenant_id: string },
|
formData: IUpdateSearchProps & { tenant_id: string },
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
setFormSubmitLoading(true);
|
||||||
const { search_config, ...other_formdata } = formData;
|
const { search_config, ...other_formdata } = formData;
|
||||||
const {
|
const {
|
||||||
llm_setting,
|
llm_setting,
|
||||||
@ -262,6 +265,8 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
setOpen(false);
|
setOpen(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to update search:', error);
|
console.error('Failed to update search:', error);
|
||||||
|
} finally {
|
||||||
|
setFormSubmitLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
@ -486,7 +491,8 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex flex-col">
|
<FormItem className="flex flex-col">
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
<span className="text-destructive mr-1"> *</span>Model
|
<span className="text-destructive mr-1"> *</span>
|
||||||
|
{t('chat.model')}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<RAGFlowSelect
|
<RAGFlowSelect
|
||||||
@ -494,7 +500,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
options={rerankModelOptions}
|
options={rerankModelOptions}
|
||||||
triggerClassName={'bg-bg-input'}
|
triggerClassName={'bg-bg-input'}
|
||||||
// disabled={disabled}
|
// disabled={disabled}
|
||||||
placeholder={'model'}
|
placeholder={t('chat.model')}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -523,6 +529,7 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
|
type={'number'}
|
||||||
className="h-7 w-20 bg-bg-card"
|
className="h-7 w-20 bg-bg-card"
|
||||||
max={2048}
|
max={2048}
|
||||||
min={0}
|
min={0}
|
||||||
@ -619,7 +626,14 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
|
|||||||
>
|
>
|
||||||
{t('search.cancelText')}
|
{t('search.cancelText')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit">{t('search.okText')}</Button>
|
<Button type="submit" disabled={formSubmitLoading}>
|
||||||
|
{formSubmitLoading && (
|
||||||
|
<div className="size-4">
|
||||||
|
<Spin size="small" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{t('search.okText')}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
Reference in New Issue
Block a user