fix: user-setting modal fixes and DOMPurify cleanup (#16449)

### Summary
  fix: user-setting modal fixes and DOMPurify cleanup
- HighlightMarkdown: drop post-process DOMPurify pass (ineffective after
preprocessLaTeX; Coderabbit CRITICAL
#3486038798)
- SettingTeam: add invite-only-registered-users hint to add-user modal
- SettingModel: reset provider loading state when add-provider modal
closes
- MCP edit dialog: set maskClosable=false to prevent accidental
dismissal
- Form: switch FormDescription color from text-muted-foreground to
text-text-disabled
This commit is contained in:
chanx
2026-06-29 16:38:23 +08:00
committed by GitHub
parent 9b726a519e
commit ca17808f12
7 changed files with 20 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
import { MarkdownRemarkPlugins } from '@/constants/markdown-remark-plugins';
import classNames from 'classnames';
import DOMPurify from 'dompurify';
import Markdown from 'react-markdown';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import {
@@ -31,7 +30,6 @@ const HighLightMarkdown = ({
// would let entity-encoded payloads bypass DOMPurify and inject HTML.
// Sanitize the *post*-processed string instead. (Coderabbit CRITICAL #3486038798)
const processed = children ? preprocessLaTeX(children) : children;
const safeChildren = processed ? DOMPurify.sanitize(processed) : processed;
const dir = children
? getDirAttribute(children.replace(citationMarkerReg, ''))
: undefined;
@@ -67,7 +65,7 @@ const HighLightMarkdown = ({
} as any
}
>
{safeChildren}
{processed}
</Markdown>
</div>
);

View File

@@ -149,7 +149,7 @@ const FormDescription = React.forwardRef<
<p
ref={ref}
id={formDescriptionId}
className={cn('text-sm text-muted-foreground', className)}
className={cn('text-sm text-text-disabled', className)}
{...props}
/>
);

View File

@@ -1782,6 +1782,8 @@ Example: Virtual Hosted Style`,
updateDate: 'Date',
role: 'State',
invite: 'Invite member',
inviteTip:
'Only registered users can be invited. Please register the account before sending an invitation.',
agree: 'Accept',
refuse: 'Decline',
teamMembers: 'Team members',

View File

@@ -964,7 +964,8 @@ NER使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系
thinkingDefault: '系统默认',
thinkingEnabled: '开启',
thinkingDisabled: '关闭',
thinkingTip: '仅控制官方模型提供商中的 Qwen、Kimi 和 GLM 模型思考模式。系统默认会关闭 Qwen 思考,以避免任务长时间运行。',
thinkingTip:
'仅控制官方模型提供商中的 Qwen、Kimi 和 GLM 模型思考模式。系统默认会关闭 Qwen 思考,以避免任务长时间运行。',
quote: '显示引文',
quoteTip: '是否应该显示原文出处?',
selfRag: 'Self-RAG',
@@ -1468,6 +1469,7 @@ NER使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系
updateDate: '日期',
role: '状态',
invite: '邀请成员',
inviteTip: '仅支持邀请已注册用户,请先完成注册。',
agree: '同意',
refuse: '拒绝',
teamMembers: '团队成员',

View File

@@ -105,7 +105,7 @@ export function EditMcpDialog({
: tools;
}, [data.variables?.tools, tools]);
const disabled = !!!tools?.length || testLoading || fieldChanged;
const disabled = !tools?.length || testLoading || fieldChanged;
return (
// <Dialog open onOpenChange={hideModal}>
@@ -174,6 +174,7 @@ export function EditMcpDialog({
onCancel={hideModal}
cancelText={t('common.cancel')}
okText={t('common.save')}
maskClosable={false}
footer={
<DialogFooter>
<DialogClose asChild>

View File

@@ -11,7 +11,7 @@ import type {
IAddProviderInstanceRequestBody,
IModelInfo,
} from '@/interfaces/request/llm';
import { useCallback, useMemo, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { isLocalLlmFactory } from '../utils';
import SystemSetting from './components/system-setting';
import { AvailableModels } from './components/un-add-model';
@@ -140,6 +140,12 @@ const ModelProviders = () => {
[addProviderInstance, addInstanceModel],
);
useEffect(() => {
if (!providerVisible) {
setProviderLoading(false);
}
}, [providerVisible]);
const handleProviderVerify = useCallback(
async (params: any) => {
// ProviderModal's handleVerify flattens verifyArgs onto params
@@ -354,7 +360,6 @@ const ModelProviders = () => {
<section className="flex flex-col w-2/5 overflow-auto scrollbar-auto">
<AvailableModels handleAddModel={handleAddModel} />
</section>
{/* Unified ProviderModal (replaces 9 independent modals) */}
<ProviderModal
visible={providerVisible}
@@ -368,7 +373,6 @@ const ModelProviders = () => {
onVerify={handleProviderVerify}
onViewModeOk={handleViewModeOk}
/>
<BedrockModal
visible={bedrockAddingVisible}
hideModal={hideBedrockAddingModal}

View File

@@ -1,6 +1,7 @@
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
@@ -63,6 +64,9 @@ const AddingUserModal = ({
<FormControl>
<Input placeholder={t('setting.email')} {...field} />
</FormControl>
<FormDescription className="text-xs">
{t('setting.inviteTip')}
</FormDescription>
<FormMessage />
</FormItem>
)}