mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-13 04:13:35 +08:00
Fix: Preserve the text format returned by the API. (#18167)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react';
|
||||
import { forwardRef, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SelectWithSearch } from './originui/select-with-search';
|
||||
import { RAGFlowFormItem } from './ragflow-form';
|
||||
@@ -24,24 +24,27 @@ type TopSelectProps = {
|
||||
onChange?(value: number): void;
|
||||
};
|
||||
|
||||
export function TopSelect({ value = 10, onChange }: TopSelectProps) {
|
||||
const { t } = useTranslation();
|
||||
export const TopSelect = forwardRef<HTMLButtonElement, TopSelectProps>(
|
||||
function TopSelect({ value = 10, onChange }, ref) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const sizeChangerOptions = useMemo(() => {
|
||||
return [10, 20, 50, 100].map((x) => ({
|
||||
label: <span>{t('common.top', { top: x })}</span>,
|
||||
value: x.toString(),
|
||||
}));
|
||||
}, [t]);
|
||||
const sizeChangerOptions = useMemo(() => {
|
||||
return [10, 20, 50, 100].map((x) => ({
|
||||
label: <span>{t('common.top', { top: x })}</span>,
|
||||
value: x.toString(),
|
||||
}));
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<SelectWithSearch
|
||||
options={sizeChangerOptions}
|
||||
value={value.toString()}
|
||||
onChange={(val) => onChange?.(Number(val))}
|
||||
></SelectWithSearch>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<SelectWithSearch
|
||||
ref={ref}
|
||||
options={sizeChangerOptions}
|
||||
value={value.toString()}
|
||||
onChange={(val) => onChange?.(Number(val))}
|
||||
></SelectWithSearch>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
export function TopSelectFormItem() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -84,7 +84,9 @@ export function TestingResult({
|
||||
<article key={x.chunk_id}>
|
||||
<Card className="px-5 py-2.5 bg-transparent shadow-none">
|
||||
<ChunkTitle item={x}></ChunkTitle>
|
||||
<p className="!mt-2.5"> {x.content_with_weight}</p>
|
||||
<p className="!mt-2.5 whitespace-pre-wrap">
|
||||
{x.content_with_weight}
|
||||
</p>
|
||||
<div className="mt-2.5 text-right text-xs text-text-sub-title-invert">
|
||||
{x.doc_name || x.docnm_kwd}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user