fix:check

This commit is contained in:
yujiangping
2026-02-10 12:53:41 +08:00
parent 1097d699f8
commit b26f60ee8d
3 changed files with 48 additions and 5 deletions

View File

@@ -617,7 +617,7 @@ const CreateModal = forwardRef<CreateModalRef, CreateModalRefProps>(({
{thirdPartyPlatform === 'feishu' && (
<>
<Form.Item
name={['parser_config', 'app_id']}
name={['parser_config', 'feishu_app_id']}
label={t('knowledgeBase.createForm.feishuAppId')}
rules={[{ required: true, message: t('knowledgeBase.createForm.feishuAppIdRequired') }]}
>

View File

@@ -14,6 +14,7 @@ import { NoData } from './noData';
import { formatDateTime } from '@/utils/format';
import InfiniteScroll from 'react-infinite-scroll-component';
import RbMarkdown from '@/components/Markdown';
import { useMemo } from 'react';
interface RecallTestResultProps {
data: RecallTestData[];
@@ -61,6 +62,36 @@ const RecallTestResult = ({
return `**${t('knowledgeBase.question')}:** ${question}\n**${t('knowledgeBase.answer')}:** ${answer}`;
};
// Check if content is valid HTML
const isValidHTML = (content: string): boolean => {
if (!content) return false;
// Check if content contains HTML tags
const htmlTagPattern = /<[^>]+>/;
return htmlTagPattern.test(content);
};
// Render content with HTML or Markdown fallback
const renderTextContent = useMemo(() => {
return (content: string) => {
// Try to render as HTML first
if (isValidHTML(content)) {
try {
return (
<div
className='rb:prose rb:prose-sm rb:max-w-none'
dangerouslySetInnerHTML={{ __html: content }}
/>
);
} catch (error) {
console.warn('HTML parsing failed, falling back to Markdown:', error);
}
}
// Fallback to Markdown rendering
return <RbMarkdown content={content} showHtmlComments={true} />;
};
}, []);
const handleItemClick = (e: React.MouseEvent, item: RecallTestData, index: number) => {
// Check if the click is on an image or image-related element
const target = e.target as HTMLElement;
@@ -167,9 +198,9 @@ const RecallTestResult = ({
const qaContent = parseQAContent(item.page_content);
if (qaContent) {
const formattedContent = formatQAContent(qaContent.question, qaContent.answer);
return <RbMarkdown content={formattedContent} showHtmlComments={true} />;
return renderTextContent(formattedContent);
}
return <RbMarkdown content={item.page_content} showHtmlComments={true} />;
return renderTextContent(item.page_content);
})()}
</div>
</div>