sync: 同步总仓库 luoguang/monkey-ai weiyuan@bfdfb339 的 web/ 改动

同步基准:总仓库 a2ca13cb(= 本仓库初始导入 d8f3aee2)
范围:a2ca13cb..bfdfb339 中触及 web/ 的提交(不含 web/.claude/settings.local.json)

- 8490ac02 feat(aliyun): integrate Wan 3 and Qwen Image models
- 2aff08ec perf(analytics): 运营看板概览改读汇总表,首屏从 19s 降到 0.4s
- dc69335e feat(experience): 体验中心图像/视频创作升级(能力 schema、估价、新创作台)
- b059c657 fix(org): 下线 /org/create 自助加入企业页与 POST /api/org/join
- 4fcf47e6 fix(i18n): 修复中/英/韩/繁体多语言错乱,补齐日/越/泰译文
- e4c301d5 fix: merge enterprise task record date filters
- c9369b95 feat: expose enterprise image and video task records
- a410fee5 feat(claude): 无断点请求自动注入 cache_control 断点(方案 2)
- 521b3376 feat(claude): 缓存命中率优化——上游粘性路由 + 缓存时长强制改写
- 73b615dd feat(pricing): 企业成员不论登录身份均按所属企业等级计价与扣费
- f73f55c3 feat(client): 新增 WeyAi 版本说明管理与公开读取接口
- 8cdf1994 fix(topup): reset amount when switching from PayPal
- 93a4ac34 feat(baidu): configure Seedance liveness header by channel
- cb1818c5 fix(weyai): 按评审修正内容清理竞态、默认适用端与中文退回(M21)
- 04214d83 feat(weyai): WeyAi 内容管理与客户端内容接口(M21 第二部分)
- e3c4a57c feat(weyai): 设置页新增 WeyAi 页签与内容专用 COS 桶(M21 第一部分)
- b5ee8e70 fix(auth): 会话角色/状态以 DB 为准,修复提升管理员后管理接口报权限不足
- e4618fc2 fix: 修复企业看板日志聚合死循环导致 CPU 打满,并降低看板查询开销
- 584aad52 style(web): 个人中心侧边栏按 prettier 换行
- b8d87064 fix: 小程序教程隐藏充值后保留原步骤编号,企业充值判断直接用 isMiniProgramWebView
- eee7f5b2 fix: 小程序里企业首页不落到充值页,隐藏钱包入口与教程充值步骤
- 8b254d49 fix: 小程序里隐藏企业充值入口与页面
- a67661b4 fix(web): 小程序里个人中心默认页跳过充值和发票,避免来回跳转
- cff6c543 feat(web): WeyAi 小程序里打开个人中心时不出现充值和开票
- c6c99eb6 feat(billing): Claude 全部缓存写入统一按 1h 倍率计费
- 0699d1bf fix(web): 小程序 web-view 里注册页同样只显示站内方式
- 04853331 feat(web): WeyAi 小程序 web-view 里登录页只显示站内登录方式
This commit is contained in:
qiubaishen
2026-11-10 11:05:34 +08:00
parent d8f3aee261
commit 6160a23117
275 changed files with 38656 additions and 7694 deletions
@@ -0,0 +1,361 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
// 系统设置 →「WeyAi」→「版本说明」:每个 WeyAi 桌面版本的更新概要(Markdown)。
// 发布后,WeyAi 的「关于」页显示当前版本和历史版本的说明,发现新版本时的更新卡片
// 也会带上这里写的内容。客户端读公开接口 GET /api/weyai/desktop/release-notes,
// 未登录也能看到;草稿只在这里可见。root 和被下放了「WeyAi」页签的管理员都能用。
import React, { useCallback, useEffect, useState } from 'react';
import {
Banner,
Button,
DatePicker,
Empty,
Input,
Modal,
Popconfirm,
Space,
Switch,
Table,
TabPane,
Tabs,
Tag,
TextArea,
Typography,
} from '@douyinfe/semi-ui';
import { useTranslation } from 'react-i18next';
import { API, showError, showSuccess } from '../../../helpers';
import MarkdownRenderer from '../../../components/common/markdown/MarkdownRenderer';
const { Text } = Typography;
const BASE = '/api/admin/weyai/release-notes';
const EMPTY_DRAFT = {
id: 0,
version: '',
title: '',
content: '',
prerelease: false,
released_at: 0,
};
const contentPlaceholder = (t) => `### ${t('新功能')}
-
### ${t('改进')}
-
### ${t('修复')}
- `;
const formatDate = (sec) =>
sec ? new Date(sec * 1000).toLocaleDateString() : '';
const SettingsWeyAiReleaseNotes = () => {
const { t } = useTranslation();
const [notes, setNotes] = useState([]);
const [loading, setLoading] = useState(false);
const [busyId, setBusyId] = useState(0);
const [draft, setDraft] = useState(null);
const [saving, setSaving] = useState(false);
const load = useCallback(async () => {
const res = await API.get(BASE, { skipErrorHandler: true });
if (!res?.data?.success) {
throw new Error(res?.data?.message || t('加载失败,请重试'));
}
setNotes(res.data.data || []);
}, [t]);
useEffect(() => {
setLoading(true);
load()
.catch((e) => showError(e.message))
.finally(() => setLoading(false));
}, [load]);
const call = async (id, request, successText) => {
setBusyId(id);
try {
const res = await request();
if (!res?.data?.success) {
showError(res?.data?.message || t('操作失败,请重试'));
return;
}
showSuccess(successText);
await load();
} catch (err) {
showError(err?.response?.data?.message || t('操作失败,请重试'));
} finally {
setBusyId(0);
}
};
const setStatus = (note, status) =>
call(
note.id,
() =>
API.post(
`${BASE}/${note.id}/status`,
{ status },
{ skipErrorHandler: true },
),
status === 'published' ? t('已发布') : t('已撤回为草稿'),
);
const remove = (note) =>
call(
note.id,
() => API.delete(`${BASE}/${note.id}`, { skipErrorHandler: true }),
t('已删除'),
);
const save = async () => {
if (!draft) return;
setSaving(true);
try {
const body = {
version: draft.version,
title: draft.title,
content: draft.content,
prerelease: draft.prerelease,
released_at: draft.released_at,
};
const res = draft.id
? await API.put(`${BASE}/${draft.id}`, body, { skipErrorHandler: true })
: await API.post(BASE, body, { skipErrorHandler: true });
if (!res?.data?.success) {
showError(res?.data?.message || t('保存失败,请重试'));
return;
}
showSuccess(
draft.id ? t('保存成功') : t('已保存为草稿,确认无误后点「发布」'),
);
setDraft(null);
await load();
} catch (err) {
showError(err?.response?.data?.message || t('保存失败,请重试'));
} finally {
setSaving(false);
}
};
const columns = [
{
title: t('版本'),
width: 160,
render: (_, note) => (
<Space>
<Text strong>v{note.version}</Text>
{note.prerelease && (
<Tag size='small' color='orange'>
{t('预发布')}
</Tag>
)}
</Space>
),
},
{
title: t('标题'),
render: (_, note) => note.title || <Text type='tertiary'>—</Text>,
},
{
title: t('状态'),
width: 100,
render: (_, note) =>
note.status === 'published' ? (
<Tag color='green'>{t('已发布')}</Tag>
) : (
<Tag color='grey'>{t('草稿')}</Tag>
),
},
{
title: t('发布日期'),
width: 130,
render: (_, note) =>
formatDate(note.released_at) || <Text type='tertiary'>—</Text>,
},
{
title: t('操作'),
width: 240,
render: (_, note) => (
<Space>
<Button size='small' onClick={() => setDraft({ ...note })}>
{t('编辑')}
</Button>
{note.status === 'published' ? (
<Button
size='small'
type='warning'
loading={busyId === note.id}
onClick={() => setStatus(note, 'draft')}
>
{t('撤回')}
</Button>
) : (
<Button
size='small'
theme='solid'
loading={busyId === note.id}
onClick={() => setStatus(note, 'published')}
>
{t('发布')}
</Button>
)}
<Popconfirm
title={t('确定删除这条版本说明吗?')}
content={t('删除后客户端不再显示这个版本的说明')}
onConfirm={() => remove(note)}
>
<Button size='small' type='danger' disabled={busyId === note.id}>
{t('删除')}
</Button>
</Popconfirm>
</Space>
),
},
];
return (
<div>
<Banner
type='info'
closeIcon={null}
className='mb-4'
description={t(
'每个版本写一条更新概要,支持 Markdown。发布后 WeyAi「关于」页会显示当前版本和历史版本的说明,发现新版本时的更新提示也会带上对应内容;草稿不会下发。',
)}
/>
<div className='mb-3'>
<Button theme='solid' onClick={() => setDraft({ ...EMPTY_DRAFT })}>
{t('新建版本说明')}
</Button>
</div>
<Table
rowKey='id'
loading={loading}
columns={columns}
dataSource={notes}
pagination={false}
empty={<Empty description={t('还没有版本说明')} />}
/>
<Modal
title={draft?.id ? t('编辑版本说明') : t('新建版本说明')}
visible={Boolean(draft)}
width={760}
onCancel={() => setDraft(null)}
onOk={save}
okText={t('保存')}
confirmLoading={saving}
maskClosable={false}
>
{draft && (
<div className='flex flex-col gap-3'>
<div className='flex gap-3 flex-wrap items-center'>
<Input
style={{ width: 200 }}
prefix='v'
placeholder='2.3.0'
value={draft.version}
onChange={(version) =>
setDraft({
...draft,
version,
// 1.2.3-beta.1 → 1.2.3: the pre-release mark came from the suffix, drop it
prerelease:
draft.version.includes('-') && !version.includes('-')
? false
: draft.prerelease,
})
}
/>
<DatePicker
type='date'
placeholder={t('发布日期(留空则在发布时自动填写)')}
style={{ width: 280 }}
// A published note keeps its date; clearing it would be ignored on save.
showClear={draft.status !== 'published'}
value={
draft.released_at
? new Date(draft.released_at * 1000)
: undefined
}
onChange={(date) =>
setDraft({
...draft,
// Local noon: the same calendar day in every time zone within ±12 h.
released_at: date
? Math.floor(new Date(date).setHours(12, 0, 0, 0) / 1000)
: 0,
})
}
/>
<Space>
<Switch
checked={draft.prerelease || draft.version.includes('-')}
disabled={draft.version.includes('-')}
onChange={(prerelease) => setDraft({ ...draft, prerelease })}
/>
<Text>{t('预发布版本')}</Text>
</Space>
</div>
<Input
placeholder={t('标题(可选),例如:对话显示每轮 token 用量')}
maxLength={100}
value={draft.title}
onChange={(title) => setDraft({ ...draft, title })}
/>
<Tabs type='button' size='small'>
<TabPane tab={t('编辑')} itemKey='edit'>
<TextArea
className='mt-2'
autosize={{ minRows: 12, maxRows: 24 }}
maxCount={20000}
placeholder={contentPlaceholder(t)}
value={draft.content}
onChange={(content) => setDraft({ ...draft, content })}
/>
</TabPane>
<TabPane tab={t('预览')} itemKey='preview'>
<div
className='mt-2 p-3 rounded'
style={{
minHeight: 200,
border: '1px solid var(--semi-color-border)',
}}
>
{draft.content.trim() ? (
<MarkdownRenderer content={draft.content} />
) : (
<Text type='tertiary'>{t('还没有内容')}</Text>
)}
</div>
</TabPane>
</Tabs>
</div>
)}
</Modal>
</div>
);
};
export default SettingsWeyAiReleaseNotes;