fix(admin): add Markdown rendering to assessment & collection chat drawers
Both directive chat drawers were rendering AI responses as plain text. Apply the same ReactMarkdown + remark-gfm treatment used in supervisor. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
12e622040a
commit
3b6e1586b7
|
|
@ -1,6 +1,8 @@
|
||||||
import { useState, useEffect, useRef } from 'react';
|
import { useState, useEffect, useRef } from 'react';
|
||||||
import { Drawer, Button, Input, Tag, Spin } from 'antd';
|
import { Drawer, Button, Input, Tag, Spin } from 'antd';
|
||||||
import { RobotOutlined, SendOutlined } from '@ant-design/icons';
|
import { RobotOutlined, SendOutlined } from '@ant-design/icons';
|
||||||
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import remarkGfm from 'remark-gfm';
|
||||||
import { useDirectiveChat } from '../../application/useAssessmentConfig';
|
import { useDirectiveChat } from '../../application/useAssessmentConfig';
|
||||||
import type { ChatMessage } from '../../infrastructure/assessment-config.api';
|
import type { ChatMessage } from '../../infrastructure/assessment-config.api';
|
||||||
|
|
||||||
|
|
@ -94,7 +96,15 @@ export function DirectiveChatDrawer({ open, onClose }: DirectiveChatDrawerProps)
|
||||||
>
|
>
|
||||||
{msg.role === 'user' ? '管理员' : 'AI 助手'}
|
{msg.role === 'user' ? '管理员' : 'AI 助手'}
|
||||||
</Tag>
|
</Tag>
|
||||||
<div className="whitespace-pre-wrap">{msg.content}</div>
|
{msg.role === 'assistant' ? (
|
||||||
|
<div className="supervisor-markdown">
|
||||||
|
<ReactMarkdown remarkPlugins={[remarkGfm]}>
|
||||||
|
{msg.content}
|
||||||
|
</ReactMarkdown>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="whitespace-pre-wrap">{msg.content}</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { useState, useEffect, useRef } from 'react';
|
import { useState, useEffect, useRef } from 'react';
|
||||||
import { Drawer, Button, Input, Tag, Spin } from 'antd';
|
import { Drawer, Button, Input, Tag, Spin } from 'antd';
|
||||||
import { RobotOutlined, SendOutlined } from '@ant-design/icons';
|
import { RobotOutlined, SendOutlined } from '@ant-design/icons';
|
||||||
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import remarkGfm from 'remark-gfm';
|
||||||
import { useDirectiveChat } from '../../application/useCollectionConfig';
|
import { useDirectiveChat } from '../../application/useCollectionConfig';
|
||||||
import type { ChatMessage } from '../../infrastructure/collection-config.api';
|
import type { ChatMessage } from '../../infrastructure/collection-config.api';
|
||||||
|
|
||||||
|
|
@ -94,7 +96,15 @@ export function CollectionChatDrawer({ open, onClose }: CollectionChatDrawerProp
|
||||||
>
|
>
|
||||||
{msg.role === 'user' ? '管理员' : 'AI 助手'}
|
{msg.role === 'user' ? '管理员' : 'AI 助手'}
|
||||||
</Tag>
|
</Tag>
|
||||||
<div className="whitespace-pre-wrap">{msg.content}</div>
|
{msg.role === 'assistant' ? (
|
||||||
|
<div className="supervisor-markdown">
|
||||||
|
<ReactMarkdown remarkPlugins={[remarkGfm]}>
|
||||||
|
{msg.content}
|
||||||
|
</ReactMarkdown>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="whitespace-pre-wrap">{msg.content}</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue