Fix: Display the search page chunks in plain text format (#18213)

This commit is contained in:
balibabu
2026-08-13 16:15:10 +08:00
committed by GitHub
parent 75bb42c166
commit 6d061b359e
6 changed files with 27 additions and 77 deletions

View File

@@ -305,7 +305,7 @@ export const SelectWithSearch = forwardRef<
<CommandItem
value={searchValue.trim()}
onSelect={handleSelect}
className="mb-1 min-h-10"
className="mb-1 min-h-10 data-[selected='true']:bg-card-soft"
>
<span className="leading-none">{searchValue.trim()}</span>
</CommandItem>
@@ -338,7 +338,7 @@ export const SelectWithSearch = forwardRef<
: 'combobox-option'
}
className={cn(
'relative flex flex-col min-h-10',
"relative flex flex-col min-h-10 data-[selected='true']:bg-card-soft",
option.description
? 'items-start gap-1'
: 'justify-center items-start',
@@ -372,13 +372,13 @@ export const SelectWithSearch = forwardRef<
(typeof group.label === 'string' ? [group.label] : [])
}
onSelect={handleSelect}
data-testid={
data-testid={
optionTestIdPrefix && group.value
? `${optionTestIdPrefix}${group.value}`
: 'combobox-option'
}
className={cn(
'relative flex flex-col min-h-10 mb-1',
"relative flex flex-col min-h-10 mb-1 data-[selected='true']:bg-card-soft",
group.description
? 'items-start gap-1'
: 'justify-center items-start',

View File

@@ -130,7 +130,7 @@ export interface IReferenceChunk {
similarity: number;
vector_similarity: number;
term_similarity: number;
positions: number[];
positions: number[][];
doc_type?: string;
document_metadata?: Record<string, any>;
}

View File

@@ -189,6 +189,7 @@ export interface ITestingChunk {
positions: number[][];
docnm_kwd: string;
doc_type_kwd: string;
document_metadata?: Record<string, any>;
}
export interface ITestingDocument {

View File

@@ -16,7 +16,6 @@
import { EmptyType } from '@/components/empty/constant';
import Empty from '@/components/empty/empty';
import HighLightMarkdown from '@/components/highlight-markdown';
import { FileIcon } from '@/components/icon-font';
import { ImageWithPopover } from '@/components/image';
import { SkeletonCard } from '@/components/skeleton-card';
@@ -43,6 +42,8 @@ import MarkdownContent from './markdown-content';
import MindMapSheet from './mindmap-sheet';
import { RAGFlowLogo } from './ragflow-logo';
import RetrievalDocuments from './retrieval-documents';
import { sanitizeHtmlWithImagesAsText } from '@/utils/dom-util';
import classNames from 'classnames';
const formatMetadataValue = (value: unknown) => {
if (Array.isArray(value)) return value.join(', ');
@@ -252,9 +253,18 @@ export default function SearchingView({
id={chunk.image_id || chunk.img_id}
></ImageWithPopover>
)}
<HighLightMarkdown>
{chunk.content_with_weight}
</HighLightMarkdown>
<div
dangerouslySetInnerHTML={{
__html: sanitizeHtmlWithImagesAsText(
chunk.content_with_weight,
).trim(),
}}
className={classNames(
// Keep whitespaces?
'text-wrap break-words whitespace-pre text-base',
'[&_em]:text-accent-primary [&_em]:not-italic',
)}
/>
</div>
{chunk.document_metadata &&
Object.keys(chunk.document_metadata).length > 0 && (

View File

@@ -44,16 +44,9 @@ module.exports = {
'colors-outline-neutral-standard':
'var(--colors-outline-neutral-standard)',
'colors-text-core-standard': 'var(--colors-text-core-standard)',
'colors-text-neutral-strong': 'var(--colors-text-neutral-strong)',
'colors-text-neutral-standard': 'var(--colors-text-neutral-standard)',
'colors-text-neutral-weak': 'var(--colors-text-neutral-weak)',
'colors-text-functional-danger': 'var(--colors-text-functional-danger)',
'colors-text-inverse-strong': 'var(--colors-text-inverse-strong)',
'colors-text-persist-light': 'var(--colors-text-persist-light)',
'colors-text-inverse-weak': 'var(--colors-text-inverse-weak)',
'background-badge': 'var(--background-badge)',
'text-badge': 'var(--text-badge)',
'text-title': 'var(--text-title)',
'text-sub-title': 'var(--text-sub-title)',
@@ -61,7 +54,6 @@ module.exports = {
'text-title-invert': 'var(--text-title-invert)',
'background-header-bar': 'var(--background-header-bar)',
'background-card': 'var(--background-card)',
'background-note': 'var(--background-note)',
'background-highlight': 'var(--background-highlight)',
'input-border': 'var(--input-border)',
@@ -91,7 +83,6 @@ module.exports = {
DEFAULT: 'rgb(var(--text-secondary-inverse) / <alpha-value>)',
},
'text-disabled': 'var(--text-disabled)',
'text-input-tip': 'var(--text-input-tip)',
'border-default': 'var(--border-default)',
'border-accent': 'var(--border-accent)',
'border-button': 'var(--border-button)',
@@ -115,9 +106,7 @@ module.exports = {
'team-group': 'var(--team-group)',
'team-member': 'var(--team-member)',
'team-department': 'var(--team-department)',
'bg-group': 'var(--bg-group)',
'bg-member': 'var(--bg-member)',
'bg-department': 'var(--bg-department)',
primary: {
DEFAULT: 'hsl(var(--primary))',
@@ -147,30 +136,11 @@ module.exports = {
DEFAULT: 'var(--background-inverse-standard)',
foreground: 'var(--background-inverse-standard-foreground)',
},
backgroundCoreWeak: {
DEFAULT: 'var(--background-core-weak)',
foreground: 'var(--background-core-weak-foreground)',
},
'colors-background-inverse-standard': {
DEFAULT: 'var(--colors-background-inverse-standard)',
foreground: 'var(--colors-background-inverse-standard-foreground)',
},
'colors-background-inverse-strong': {
DEFAULT: 'var(--colors-background-inverse-strong)',
foreground: 'var(--background-inverse-standard-foreground)',
},
backgroundCoreWeak: 'var(--background-core-weak)',
'colors-background-neutral-standard': {
DEFAULT: 'var(--colors-background-neutral-standard)',
foreground: 'var(--background-inverse-standard-foreground)',
},
'colors-background-neutral-strong': {
DEFAULT: 'var(--colors-background-neutral-strong)',
foreground: 'var(--background-inverse-standard-foreground)',
},
'colors-background-neutral-weak': {
DEFAULT: 'var(--colors-background-neutral-weak)',
foreground: 'var(--background-inverse-standard-foreground)',
},
sidebar: {
DEFAULT: 'hsl(var(--sidebar-background))',
foreground: 'hsl(var(--sidebar-foreground))',

View File

@@ -37,11 +37,7 @@
--background-inverse-standard: rgba(230, 227, 246, 0.15);
--background-inverse-standard-foreground: rgb(92, 81, 81);
--colors-background-inverse-standard: rgba(29, 26, 44, 0.1);
--colors-background-inverse-strong: rgba(11, 10, 18, 0.8);
--colors-background-inverse-weak: rgba(17, 16, 23, 0.1);
--colors-background-neutral-standard: white;
--colors-background-neutral-strong: rgba(226, 223, 246, 1);
--button-blue-text: rgb(22, 119, 255);
@@ -49,14 +45,8 @@
--colors-outline-neutral-strong: rgba(112, 107, 107, 0.15);
--colors-outline-neutral-standard: rgba(53, 51, 65, 0.1);
--colors-text-core-standard: rgba(127, 105, 255, 1);
--colors-text-neutral-strong: rgba(17, 16, 23, 1);
--colors-text-neutral-standard: rgba(152, 148, 176, 1);
--colors-text-neutral-weak: rgba(170, 160, 197, 1);
--colors-text-functional-danger: rgba(255, 81, 81, 1);
--colors-text-inverse-strong: rgba(255, 255, 255, 1);
--colors-text-persist-light: rgba(255, 255, 255, 1);
--colors-text-inverse-weak: rgba(184, 181, 203, 1);
--sidebar-background: 0 0% 98%;
--sidebar-foreground: 240 5.3% 26.1%;
@@ -69,7 +59,6 @@
--background-inverse-strong: rgba(255, 255, 255, 0.15);
--background-badge: rgba(22, 22, 24, 0.5);
--text-badge: rgba(151, 154, 171, 1);
--text-title: rgba(22, 22, 24, 1);
@@ -80,8 +69,6 @@
--text-title-invert: rgba(255, 255, 255, 1);
--background-card: rgba(22, 22, 24, 0.05);
--background-note: rgba(22, 22, 24, 0.1);
--background-highlight: rgba(76, 164, 231, 0.1);
--input-border: rgba(22, 22, 24, 0.2);
@@ -104,8 +91,6 @@
--text-primary: 22 22 24;
--text-secondary: 117 120 122;
--text-disabled: #b2b5b7;
/* input placeholder color */
--text-input-tip: #b2b5b7;
/* Input default color */
--border-default: rgba(0, 0, 0, 0.2);
/* Input accent color */
@@ -125,9 +110,7 @@
--team-group: #5ab77e;
--team-member: #5c96c8;
--team-department: #8866d3;
--bg-group: rgba(90, 183, 126, 0.1);
--bg-member: rgba(92, 150, 200, 0.1);
--bg-department: rgba(136, 102, 211, 0.1);
/* --*-inverse: colors in dark mode */
--text-primary-inverse: 246 246 247;
@@ -169,39 +152,21 @@
--background-inverse-standard: rgba(230, 227, 246, 0.15);
--background-inverse-standard-foreground: rgba(255, 255, 255, 1);
--background-inverse-weak: rgba(184, 181, 203, 0.15);
--background-inverse-weak-foreground: rgba(255, 255, 255, 1);
--background-core-standard: rgba(137, 126, 255, 1);
--background-core-standard-foreground: rgba(255, 255, 255, 1);
--background-inverse-strong: rgba(255, 255, 255, 0.15);
--background-inverse-strong-foreground: rgba(255, 255, 255, 1);
--background-core-weak: rgb(101, 75, 248);
--background-core-weak-foreground: rgba(255, 255, 255, 1);
--background-badge: rgba(22, 22, 24, 0.5);
--text-badge: rgba(151, 154, 171, 1);
--colors-background-inverse-standard: rgba(230, 227, 246, 0.15);
--colors-background-inverse-strong: rgba(255, 255, 255, 0.8);
--colors-background-neutral-standard: rgba(11, 10, 18, 1);
--colors-background-neutral-strong: rgba(29, 26, 44, 1);
--colors-background-neutral-weak: rgba(17, 16, 23, 1);
--colors-outline-sentiment-primary: rgba(146, 118, 255, 1);
--colors-outline-neutral-strong: rgba(255, 255, 255, 0.15);
--colors-outline-neutral-standard: rgba(230, 227, 246, 0.1);
--colors-text-core-standard: rgba(137, 126, 255, 1);
--colors-text-neutral-strong: rgba(255, 255, 255, 1);
--colors-text-neutral-standard: rgba(230, 227, 246, 1);
--colors-text-neutral-weak: rgba(170, 160, 197, 1);
--colors-text-functional-danger: rgba(255, 81, 81, 1);
--colors-text-inverse-strong: rgba(17, 16, 23, 1);
--colors-text-persist-light: rgba(255, 255, 255, 1);
--colors-text-inverse-weak: rgba(84, 80, 106, 1);
--sidebar-background: 240 5.9% 10%;
--sidebar-foreground: 240 4.8% 95.9%;
@@ -220,7 +185,6 @@
--text-title-invert: rgba(22, 22, 24, 1);
--background-card: rgba(255, 255, 255, 0.05);
--background-note: rgba(255, 255, 255, 0.05);
--background-highlight: rgba(76, 164, 231, 0.1);
@@ -242,7 +206,6 @@
--text-primary: 246 246 247;
--text-secondary: 178 181 183;
--text-disabled: #75787a;
--text-input-tip: #75787a;
--border-default: rgba(255, 255, 255, 0.2);
--border-accent: #ffffff;
--border-button: rgba(255, 255, 255, 0.1);
@@ -295,6 +258,12 @@
}
@layer utilities {
.bg-card-soft {
/* First line is the fallback for browsers without color-mix() */
background-color: var(--bg-card);
background-color: color-mix(in srgb, var(--bg-card) 50%, transparent);
}
.scrollbar-auto {
/* hide scrollbar */
scrollbar-width: thin;