Merge branch 'pr-506'

This commit is contained in:
fawney19
2026-05-19 18:36:36 +08:00
16 changed files with 2079 additions and 38 deletions

View File

@@ -48,6 +48,7 @@ function normalizeProviderSummary(
...provider,
chat_pii_redaction: normalizeChatPiiRedactionProvider(provider.chat_pii_redaction),
pool_advanced: normalizePoolAdvanced(provider.pool_advanced),
kiro_simulated_cache_enabled: provider.kiro_simulated_cache_enabled ?? false,
}
}

View File

@@ -684,6 +684,7 @@ export interface ProviderWithEndpointsSummary {
failover_rules?: FailoverRulesConfig | null
ops_configured: boolean // 是否配置了扩展操作(余额监控等)
ops_architecture_id?: string // 扩展操作使用的架构 ID如 cubence, anyrouter
kiro_simulated_cache_enabled?: boolean
created_at: string
updated_at: string
}

View File

@@ -275,6 +275,22 @@
/>
</div>
<div
v-if="form.provider_type === 'kiro'"
class="flex items-center justify-between p-3 border rounded-lg bg-muted/50"
>
<div class="space-y-0.5">
<span class="text-sm font-medium">模拟缓存模式</span>
<p class="text-xs text-muted-foreground leading-relaxed">
启用后仅对 Kiro 请求模拟 prompt cache 读写计量。
</p>
</div>
<Switch
:model-value="form.kiro_simulated_cache_enabled"
@update:model-value="(v: boolean) => form.kiro_simulated_cache_enabled = v"
/>
</div>
<div class="flex items-center justify-between gap-4 p-3 border rounded-lg bg-muted/50">
<div class="space-y-0.5">
<span class="text-sm font-medium">敏感信息保护</span>
@@ -383,6 +399,8 @@ const form = ref({
request_timeout: undefined as number | undefined,
// 号池模式
pool_mode_enabled: false,
// Kiro 专属配置
kiro_simulated_cache_enabled: false,
})
// 重置表单
@@ -409,6 +427,8 @@ function resetForm() {
request_timeout: undefined,
// 号池模式
pool_mode_enabled: false,
// Kiro 专属配置
kiro_simulated_cache_enabled: false,
}
}
@@ -439,6 +459,8 @@ function loadProviderData() {
request_timeout: props.provider.request_timeout ?? undefined,
// 号池模式
pool_mode_enabled: poolAdvanced !== null,
// Kiro 专属配置
kiro_simulated_cache_enabled: props.provider.kiro_simulated_cache_enabled ?? false,
}
}
@@ -457,6 +479,9 @@ watch(() => form.value.provider_type, () => {
if (!isEditMode.value) {
form.value.pool_mode_enabled = false
}
if (form.value.provider_type !== 'kiro') {
form.value.kiro_simulated_cache_enabled = false
}
})
// 提交表单
@@ -506,6 +531,15 @@ const handleSubmit = async () => {
pool_advanced: form.value.pool_mode_enabled
? (currentPoolAdvanced ?? {})
: null,
...(form.value.provider_type === 'kiro'
? {
config: {
kiro: {
simulated_cache_enabled: form.value.kiro_simulated_cache_enabled,
},
},
}
: {}),
}
if (isEditMode.value && props.provider) {