fix(rate-limits): treat empty policies as unlimited
This commit is contained in:
@@ -343,10 +343,10 @@ export function PlatformManagementPanel(props: {
|
||||
</FormSection>
|
||||
|
||||
<FormSection icon={<ShieldCheck size={16} />} title="限流策略">
|
||||
<Label>RPM / 分钟请求数<Input value={form.rpmLimit} placeholder="不填则不限制" inputMode="numeric" onChange={(event) => setForm({ ...form, rpmLimit: event.target.value })} /></Label>
|
||||
<Label>RPS / 每秒请求数<Input value={form.rpsLimit} placeholder="不填则不限制" inputMode="numeric" onChange={(event) => setForm({ ...form, rpsLimit: event.target.value })} /></Label>
|
||||
<Label>TPM / 分钟 Token<Input value={form.tpmLimit} placeholder="不填则不限制" inputMode="numeric" onChange={(event) => setForm({ ...form, tpmLimit: event.target.value })} /></Label>
|
||||
<Label>并发请求<Input value={form.concurrencyLimit} placeholder="不填则不限制" inputMode="numeric" onChange={(event) => setForm({ ...form, concurrencyLimit: event.target.value })} /></Label>
|
||||
<Label>RPM / 分钟请求数<Input value={form.rpmLimit} placeholder="不填或负数为不限" inputMode="numeric" onChange={(event) => setForm({ ...form, rpmLimit: event.target.value })} /></Label>
|
||||
<Label>RPS / 每秒请求数<Input value={form.rpsLimit} placeholder="不填或负数为不限" inputMode="numeric" onChange={(event) => setForm({ ...form, rpsLimit: event.target.value })} /></Label>
|
||||
<Label>TPM / 分钟 Token<Input value={form.tpmLimit} placeholder="不填或负数为不限" inputMode="numeric" onChange={(event) => setForm({ ...form, tpmLimit: event.target.value })} /></Label>
|
||||
<Label>并发请求<Input value={form.concurrencyLimit} placeholder="不填或负数为不限" inputMode="numeric" onChange={(event) => setForm({ ...form, concurrencyLimit: event.target.value })} /></Label>
|
||||
<div className="platformTogglePair">
|
||||
<ToggleField checked={form.supportBase64Input} label="支持 Base64 输入" onChange={(checked) => setForm({ ...form, supportBase64Input: checked })} />
|
||||
<ToggleField checked={form.supportUrlInput} label="支持 URL 输入" onChange={(checked) => setForm({ ...form, supportUrlInput: checked })} />
|
||||
@@ -1172,13 +1172,13 @@ function formatDiscountFactor(value: number | undefined) {
|
||||
function platformRateLimitSummary(policy: IntegrationPlatform['rateLimitPolicy']) {
|
||||
const rules = Array.isArray(policy?.rules) ? policy.rules : [];
|
||||
if (!rules.length) {
|
||||
return { title: '未设置', subtitle: '跟随全局或模型策略' };
|
||||
return { title: '不限', subtitle: '未配置限流上限' };
|
||||
}
|
||||
const labels = rules
|
||||
.filter((rule) => typeof rule.limit === 'number' && Number.isFinite(rule.limit))
|
||||
.filter((rule) => typeof rule.limit === 'number' && Number.isFinite(rule.limit) && rule.limit > 0)
|
||||
.map((rule) => `${rateLimitMetricText(rule.metric)} ${formatLimit(rule.limit)}`);
|
||||
if (!labels.length) {
|
||||
return { title: '未设置', subtitle: '跟随全局或模型策略' };
|
||||
return { title: '不限', subtitle: '未配置限流上限' };
|
||||
}
|
||||
return {
|
||||
title: labels.slice(0, 2).join(' · '),
|
||||
|
||||
Reference in New Issue
Block a user