fix(create): 修复创作页布局与模型价格筛选

This commit is contained in:
Rou
2026-09-01 17:51:18 +08:00
parent 70d272853e
commit 667e144e7a
4 changed files with 48 additions and 10 deletions

View File

@@ -77,6 +77,7 @@ export default function AnalyticsPanel({ users, channels }: Props) {
const [pricingWorkspaceOpen, setPricingWorkspaceOpen] = useState(false);
const [pendingPricing, setPendingPricing] = useState<ModelPricing | null | undefined>(undefined);
const [form] = Form.useForm<PricingFormValues>();
const pricingChannelId = Form.useWatch("channelId", form);
const analyticsPageSize = 20;
const filters = useMemo<AnalyticsFilters>(
@@ -148,11 +149,17 @@ export default function AnalyticsPanel({ users, channels }: Props) {
const pricingModelOptions = useMemo(() => {
const names = new Set<string>();
const sourceChannels = channels.filter((channel) => channel.enabled !== false);
const sourceChannels = channels.filter(
(channel) =>
channel.enabled !== false &&
(!pricingChannelId || channel.id === pricingChannelId),
);
sourceChannels.forEach((channel) => channel.models?.forEach((name) => names.add(name)));
if (editingPricing?.model) names.add(editingPricing.model);
if (editingPricing?.model && (!pricingChannelId || editingPricing.channelId === pricingChannelId)) {
names.add(editingPricing.model);
}
return [...names].sort().map((name) => ({ label: name, value: name }));
}, [channels, editingPricing?.model]);
}, [channels, editingPricing?.channelId, editingPricing?.model, pricingChannelId]);
const preparePricingForm = (pricing: ModelPricing | null) => {
setEditingPricing(pricing);