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
@@ -38,8 +38,11 @@ import {
HelpCircle,
X,
Loader2,
Wallet,
} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { formatQuoteAmount } from '../../../../../hooks/creation/useCreationQuote';
import {
canCancelVideoTask,
canRegenerateVideoTask,
@@ -50,6 +53,21 @@ import './VideoPreviewPanel.css';
const { Title, Text, Paragraph } = Typography;
// 估价 budget_source → 预算层级名(i18n key);org_budget 实际值为 org_budget:<subject_type>
const BUDGET_SOURCE_LABELS = {
org_budget: '部门 / 项目预算',
token: '令牌额度',
org_member: '成员额度',
org_gift: '企业赠送额度',
org: '企业额度',
membership: '会员额度',
gift: '赠送余额',
user: '账户余额',
};
const budgetSourceLabel = (source) =>
BUDGET_SOURCE_LABELS[String(source || '').split(':')[0]] || '';
const VideoPreviewPanel = ({
formData,
generating,
@@ -60,8 +78,15 @@ const VideoPreviewPanel = ({
selectedTaskForPlay, // 新增:从任务列表选择的任务
onRegenerate, // 新增:再生成回调
onClearSelectedTask, // 新增:清除选中任务的回调(关闭视频播放)
submitBlock = '', // 不能提交的原因(为空表示可提交)
submitting = false,
quote = null,
quoteLoading = false,
quoteFailed = false,
estSeconds = 0,
}) => {
const { t } = useTranslation();
const navigate = useNavigate();
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
// 监听窗口大小变化
@@ -210,12 +235,35 @@ const VideoPreviewPanel = ({
}
};
// 判断按钮是否禁用
const isButtonDisabled =
(!formData.prompt && !formData.selectedTemplate) ||
!selectedModel ||
(typeof selectedModel === 'object' && selectedModel.level_locked) ||
(formData.mode === 'image2video' && !formData.image);
// 判断按钮是否禁用(原因由 useVideoGeneration 按 schema 计算)
const isButtonDisabled = Boolean(submitBlock);
// 余额 / 预算不足:按钮变为"去充值"(估价失败时不阻止提交)
const needTopUp = !isButtonDisabled && quote?.balance_enough === false;
// 估价文案:"预计 ¥x · 约 N 秒 · 失败自动退还"
const renderQuoteText = () => {
const parts = [];
const item = quote?.items?.[0];
const amount =
item && !item.error
? formatQuoteAmount(item.display_amount, item.currency)
: '';
if (quoteFailed || (quote && !amount)) {
parts.push(t('价格以实际扣费为准'));
} else if (amount) {
parts.push(
item.approximate
? t('预计约 {{amount}}', { amount })
: t('预计 {{amount}}', { amount }),
);
} else if (quoteLoading) {
parts.push(t('正在估价...'));
}
if (estSeconds > 0) parts.push(t('约 {{n}} 秒', { n: estSeconds }));
if (parts.length === 0) return null;
parts.push(t('失败自动退还'));
return parts.join(' · ');
};
// 渲染顶部操作栏(始终显示)
const renderTopBar = () => {
@@ -243,52 +291,68 @@ const VideoPreviewPanel = ({
flexShrink: 0,
}}
>
<Button
type='primary'
theme='solid'
size={windowWidth > 768 ? 'default' : 'small'}
icon={<Play size={16} fill='currentColor' />}
onClick={isButtonDisabled ? undefined : handleGenerate}
disabled={isButtonDisabled || generating}
style={{
fontWeight: 600,
background:
isButtonDisabled || generating
? undefined
: 'linear-gradient(135deg, #1890ff 0%, #0050b3 100%)',
border: 'none',
}}
>
{generating
? t('生成中...')
: windowWidth > 768
? t('开始生成')
: t('生成')}
</Button>
{needTopUp ? (
<Button
type='warning'
theme='solid'
size={windowWidth > 768 ? 'default' : 'small'}
icon={<Wallet size={16} />}
onClick={() => navigate('/console/topup')}
style={{ fontWeight: 600 }}
>
{t('去充值')}
</Button>
) : (
<Button
type='primary'
theme='solid'
size={windowWidth > 768 ? 'default' : 'small'}
icon={<Play size={16} fill='currentColor' />}
onClick={isButtonDisabled ? undefined : handleGenerate}
disabled={isButtonDisabled || submitting}
loading={submitting}
style={{
fontWeight: 600,
background:
isButtonDisabled || submitting
? undefined
: 'linear-gradient(135deg, var(--semi-color-primary) 0%, var(--semi-color-primary-active, var(--semi-color-primary)) 100%)',
border: 'none',
}}
>
{submitting
? t('提交中...')
: windowWidth > 768
? t('开始生成')
: t('生成')}
</Button>
)}
{/* 估价 / 余额不足说明 */}
{!isButtonDisabled && (
<Text
type={needTopUp ? 'warning' : 'tertiary'}
style={{
fontSize: '12px',
fontVariantNumeric: 'tabular-nums',
minWidth: 0,
}}
aria-live='polite'
>
{needTopUp
? budgetSourceLabel(quote?.budget_source)
? t('{{source}}不足,请充值后再生成', {
source: t(budgetSourceLabel(quote.budget_source)),
})
: t('余额或预算不足,请充值后再生成')
: renderQuoteText()}
</Text>
)}
{/* 禁用提示 */}
{isButtonDisabled && !generating && (
<Text type='tertiary' style={{ fontSize: '12px' }}>
{!selectedModel && t('请选择模型')}
{selectedModel &&
typeof selectedModel === 'object' &&
selectedModel.level_locked &&
t('当前等级无权调用此模型')}
{selectedModel &&
!(
typeof selectedModel === 'object' && selectedModel.level_locked
) &&
!formData.prompt &&
!formData.selectedTemplate &&
t('请输入提示词或选择模板')}
{selectedModel &&
!(
typeof selectedModel === 'object' && selectedModel.level_locked
) &&
(formData.prompt || formData.selectedTemplate) &&
formData.mode === 'image2video' &&
!formData.image &&
t('请上传图片')}
{isButtonDisabled && !submitting && (
<Text type='tertiary' style={{ fontSize: '12px' }} role='note'>
{submitBlock}
</Text>
)}