/*
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 .
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { Button, Modal, Spin } from '@douyinfe/semi-ui';
import { AlertTriangle } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { compareParamSummary } from '../../hooks/creation/creationCompare';
import { formatQuoteAmount } from '../../hooks/creation/useCreationQuote';
import { displayNameOf } from './ModelPicker';
const amountOf = (item) =>
item && !item.error
? formatQuoteAmount(item.display_amount, item.currency)
: '';
/**
* 对比生成提交前摘要(WP C-2,方案 §4.2):逐模型"模型 · 实际参数 · 价格"与合计;
* 合计超过系统阈值时显示二次确认提示,确认按钮写明合计金额。
*/
const CompareSummary = ({ visible, compare, onCancel, onConfirm }) => {
const { t } = useTranslation();
const {
entries,
quote,
quoteLoading,
quoteFailed,
overThreshold,
submitting,
} = compare;
const items = quote?.items || [];
const total = quote
? formatQuoteAmount(quote.display_amount, quote.currency)
: '';
const approximate = Boolean(
quote?.approximate || items.some((item) => item?.approximate),
);
const totalText = total
? approximate
? t('约 {{amount}}', { amount: total })
: total
: quoteLoading
? t('正在估价...')
: t('价格以实际扣费为准');
return (
}
>