Fix: Preserve the text format returned by the API. (#18167)

This commit is contained in:
balibabu
2026-08-12 19:08:48 +08:00
committed by GitHub
parent 544b7c1bca
commit 5b701f23e5
2 changed files with 23 additions and 18 deletions

View File

@@ -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();

View File

@@ -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>