merge: 合入总仓库 weiyuan(bfdfb339) web/ 新功能,保留 ui-optimization 的 UI 重构

来源:luoguang/monkey-ai weiyuan@bfdfb339 的 web/(经 sync/main-weiyuan-web-bfdfb339 同步)
同步基准:总仓库 a2ca13cb = 本仓库初始导入 d8f3aee2

冲突处理原则:保留 ui-optimization 的 UI(样式/结构/组件),嫁接 weiyuan 的功能逻辑。
- i18n:按键三方合并;ours 的「令牌→密钥」改名键上移植 theirs 的术语修订
- task-logs / OrgLogs:ours 已手工移植同一功能(6ad95e2),保留 ours
- 删除:OrgCreate(theirs 下线 /org/create)、旧 image 组件与 VideoRegenerateModal(theirs 体验中心重写)、
  OrgAvatarSection / PricingBentoPage / CommissionConsole(ours 重构中已移除)
- 测试:users-pagination 的 i18next mock 补 t();theirs 新增文件补 license header
This commit is contained in:
qiubaishen
2026-11-10 12:01:21 +08:00
266 changed files with 38432 additions and 7570 deletions
@@ -345,7 +345,12 @@ const DocumentRenderer = ({
const seen = new Map();
const headings = root.querySelectorAll('h2, h3');
headings.forEach((h) => {
if (h.querySelector('.doc-anchor')) return; // 已处理
const existing = h.querySelector('.doc-anchor');
if (existing) {
// 已处理;切换语言时只刷新读屏文案
existing.setAttribute('aria-label', t('复制段落链接'));
return;
}
let base = h.id || slugify(h.textContent);
if (!base) return;
let id = base;
@@ -357,7 +362,7 @@ const DocumentRenderer = ({
const a = document.createElement('a');
a.href = `#${id}`;
a.className = 'doc-anchor';
a.setAttribute('aria-label', '复制段落链接');
a.setAttribute('aria-label', t('复制段落链接'));
a.textContent = '#';
a.addEventListener('click', (e) => {
e.preventDefault();
@@ -429,7 +434,7 @@ const DocumentRenderer = ({
{t('内容正在准备中')}
</h3>
<p className='text-sm text-gray-500 dark:text-gray-400'>
{t('管理员尚未设置') + title + t('内容')}
{t('管理员尚未设置{{title}}内容', { title })}
</p>
</div>
);
@@ -457,7 +462,7 @@ const DocumentRenderer = ({
className='group inline-flex items-center gap-2 px-6 py-2.5 bg-gradient-to-r from-brand-from to-brand-to hover:shadow-lg hover:shadow-brand/30 dark:hover:shadow-brand/20 text-white text-sm font-medium rounded-lg shadow-sm transition-all hover:-translate-y-0.5'
>
<BookOpen size={16} />
{t('访问') + title}
{t('访问{{title}}', { title })}
<ExternalLink
size={14}
className='transition-transform group-hover:translate-x-0.5'
+3 -1
View File
@@ -144,7 +144,9 @@ const ModelSelector = ({
title={t('暂无可用模型')}
description={
category
? `${MODEL_CATEGORY_NAMES[category]}类模型暂无可用`
? t('{{category}}类模型暂无可用', {
category: MODEL_CATEGORY_NAMES[category],
})
: t('请先添加模型')
}
/>
@@ -70,6 +70,7 @@ export function Mermaid(props) {
// 等 setIsLoading(false) 触发重渲染时,React 找不到那些被 mermaid 删掉的节点,
// 就抛 removeChild "NotFoundError"。改用 mermaid.render() 拿 svg 字符串后写进 svgRef,
// React 始终认为 svgRef 这个 div 是空的,便不会与 mermaid 的 DOM 改动冲突。
const { t } = useTranslation();
const svgRef = useRef(null);
const [hasError, setHasError] = useState(false);
const [isLoading, setIsLoading] = useState(true);
@@ -164,7 +165,7 @@ export function Mermaid(props) {
animation: 'spin 1s linear infinite',
}}
/>
加载图表中...
{t('加载图表中...')}
</div>
)}
{/* React 视角下这个 div 恒为空,SVG 由 effect 通过 innerHTML 注入,互不干涉 */}
@@ -305,7 +306,7 @@ export function PreCode(props) {
color: 'var(--ui-color-text-2)',
}}
>
HTML预览:
{t('HTML预览:')}
</div>
<div dangerouslySetInnerHTML={{ __html: htmlCode }} />
</div>
@@ -719,6 +720,7 @@ export function MarkdownRenderer(props) {
previousContentLength = 0,
...otherProps
} = props;
const { t } = useTranslation();
return (
<div
@@ -753,7 +755,7 @@ export function MarkdownRenderer(props) {
animation: 'spin 1s linear infinite',
}}
/>
正在渲染...
{t('正在渲染...')}
</div>
) : (
<MarkdownContent
+1 -1
View File
@@ -672,7 +672,7 @@ const JSONEditor = ({
{hasJsonError && (
<Banner
type='danger'
description={`JSON 格式错误: ${jsonError}`}
description={t('JSON 格式错误: {{error}}', { error: jsonError })}
className='mb-3'
/>
)}
+2
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useEffect, useMemo, useState } from 'react';
import i18next from 'i18next';
// 读品牌值:localStorage → window.__WL_BRAND__(index.html 内联脚本写入)→ 空。
// 不用 getSystemName/getLogo —— 它们的终极兜底是 'Weelinking' / '/logo.svg'(老品牌),
@@ -38,6 +39,7 @@ const readBrand = (key, windowKey) => {
// 加载文案根据浏览器语言决定,避免 i18n 还没初始化时硬编码中文。
const getLoadingText = () => {
if (i18next.isInitialized) return i18next.t('加载中...');
const lang = ((typeof navigator !== 'undefined' && navigator.language) || 'zh').toLowerCase();
return lang.startsWith('zh') ? '加载中...' : 'Loading...';
};