Fix: Improved knowledge base configuration and related logic #9869 (#10315)

### What problem does this PR solve?

Fix: Improved knowledge base configuration and related logic #9869
- Optimized the display logic of the Generate Log button to support
displaying completion time and task ID
- Implemented the ability to pause task generation and connect to the
data flow cancellation interface
- Fixed issues with type definitions and optional chaining calls in some
components
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-09-26 19:09:11 +08:00
committed by GitHub
parent c7efaab30e
commit 886d38620e
19 changed files with 374 additions and 231 deletions

View File

@ -4,6 +4,7 @@ import { useTranslate } from '@/hooks/common-hooks';
import {
GenerateLogButton,
GenerateType,
IGenerateLogButtonProps,
} from '@/pages/dataset/dataset/generate-button/generate';
import random from 'lodash/random';
import { Shuffle } from 'lucide-react';
@ -18,7 +19,6 @@ import {
FormMessage,
} from '../ui/form';
import { ExpandedInput } from '../ui/input';
import { Switch } from '../ui/switch';
import { Textarea } from '../ui/textarea';
export const excludedParseMethods = [
@ -56,11 +56,7 @@ const Prompt = 'parser_config.raptor.prompt';
// The three types "table", "resume" and "one" do not display this configuration.
const RaptorFormFields = ({
showGenerateItem = false,
}: {
showGenerateItem?: boolean;
}) => {
const RaptorFormFields = ({ data }: { data: IGenerateLogButtonProps }) => {
const form = useFormContext();
const { t } = useTranslate('knowledgeConfiguration');
const useRaptor = useWatch({ name: UseRaptorField });
@ -108,13 +104,12 @@ const RaptorFormFields = ({
</FormLabel>
<div className="w-3/4">
<FormControl>
<Switch
checked={field.value}
onCheckedChange={(e) => {
changeRaptor(e);
field.onChange(e);
}}
></Switch>
<GenerateLogButton
{...data}
className="w-full text-text-secondary"
status={1}
type={GenerateType.Raptor}
/>
</FormControl>
</div>
</div>
@ -219,18 +214,6 @@ const RaptorFormFields = ({
</FormItem>
)}
/>
{showGenerateItem && (
<div className="w-full flex items-center">
<div className="text-sm whitespace-nowrap w-1/4">
{t('extractRaptor')}
</div>
<GenerateLogButton
className="w-3/4 text-text-secondary"
status={1}
type={GenerateType.Raptor}
/>
</div>
)}
</div>
)}
</>