feat: 调整 AI 规格解析等待时间 (#286)

This commit is contained in:
chengma
2026-08-21 10:31:17 +08:00
parent 7d9d83d2fa
commit dc808e2a95
6 changed files with 8 additions and 7 deletions
+2 -1
View File
@@ -15,7 +15,8 @@ func TestAIConfigTemplate_密钥不回显且表单语义完整(t *testing.T) {
for _, want := range []string{
`action="/settings/ai/save"`, `action="/settings/ai/secret"`,
`action="/settings/ai/test"`, `action="/settings/ai/enable"`,
`type="password"`, `autocomplete="new-password"`, "连接测试", "置信度%",
`type="password"`, `autocomplete="new-password"`, `name="timeout_seconds"`,
`min="1" max="120" value="66"`, "连接测试", "置信度%",
} {
if !strings.Contains(source, want) {
t.Errorf("AI 配置模板缺少 %q", want)
+1 -1
View File
@@ -26,7 +26,7 @@ const (
MaxPurchaseSpecResolutionBodyBytes = 64 << 10
PurchaseSpecRulesVersion = "purchase_rules_v1"
purchaseSpecSchemaVersion = 1
purchaseSpecResolutionAITimeout = 30 * time.Second
purchaseSpecResolutionAITimeout = 66 * time.Second
)
var (
@@ -132,7 +132,7 @@ func (client *stubAIModelClient) Match(ctx context.Context, _ model.AIProviderCo
return client.response, client.err
}
func TestMatchPurchaseSpecWithRuntimeAI_限制30秒并继承更早取消(t *testing.T) {
func TestMatchPurchaseSpecWithRuntimeAI_限制66秒并继承更早取消(t *testing.T) {
req, _, _ := validRuntimeSpecRequest(t, "cg257-timeout", "L码", "M码", "XL码")
client := &runtimeDeadlineAIClient{}
loader := func(context.Context, *sql.DB, AISecretStore, AIEndpointPolicy) (AIMatchSnapshot, error) {
@@ -151,7 +151,7 @@ func TestMatchPurchaseSpecWithRuntimeAI_限制30秒并继承更早取消(t *test
t.Fatal("运行时 AI 上下文缺少截止时间")
}
budget := client.deadline.Sub(startedAt)
if budget < 29*time.Second || budget > purchaseSpecResolutionAITimeout {
if budget < 65*time.Second || budget > purchaseSpecResolutionAITimeout {
t.Fatalf("运行时 AI 时间预算=%s,期望不超过 %s", budget, purchaseSpecResolutionAITimeout)
}
+1 -1
View File
@@ -11,7 +11,7 @@
<label for="ai-model">模型</label>
<input id="ai-model" name="model" maxlength="191" required placeholder="模型名称">
<label for="ai-timeout">超时</label>
<input id="ai-timeout" class="input-short" name="timeout_seconds" type="number" min="1" max="120" value="30" required aria-describedby="ai-create-help">
<input id="ai-timeout" class="input-short" name="timeout_seconds" type="number" min="1" max="120" value="66" required aria-describedby="ai-create-help">
<label for="ai-concurrency">并发</label>
<input id="ai-concurrency" class="input-short" name="max_concurrency" type="number" min="1" max="16" value="2" required>
<label for="ai-threshold">置信度%</label>