Coordinate AI retries and recover shared provider outages
Development CI / check-and-build (push) Successful in 3m3s
GitHub Git mirror / mirror (push) Successful in 6s
Development CI / deploy-development (push) Successful in 2m29s

Retry transient requests after one and three minutes and coordinate provider recovery across processes with bounded probe intervals. Preserve completed results when recovery bookkeeping fails, keep concurrent failure accounting accurate, and expose retry state in the UI.
This commit is contained in:
eezd committed 2026-11-06 16:25:16 +08:00
1 parent 3fcd4c7fb8
commit 8766e829f9
27 files changed
+670 -108

No files matched your search

@@ -0,0 +1,40 @@
<script setup lang="ts">
import type { ProviderAvailability } from "@@/apis/settings"
import { listProviderAvailabilityApi } from "@@/apis/settings"
import { useSessionScope } from "@@/composables/useSessionScope"
const scope = useSessionScope()
const states = ref<ProviderAvailability[]>([])
const failed = ref(false)
let timer: ReturnType<typeof setTimeout> | undefined
let closed = false
async function refresh() {
try {
const rows = await listProviderAvailabilityApi()
if (closed) return
scope.assertCurrent()
states.value = rows.filter(row => row.state !== "normal")
failed.value = false
} catch (error) {
if (!closed) {
failed.value = true
console.error(error)
}
} finally {
if (!closed) timer = setTimeout(refresh, 5000)
}
}
onMounted(refresh)
onBeforeUnmount(() => {
closed = true
clearTimeout(timer)
})
</script>
<template>
<el-alert v-if="failed" class="mb-3" type="warning" :closable="false" title="模型接入状态读取失败" />
<el-alert v-for="row in states" :key="row.provider_id" class="mb-3" type="warning" :closable="false">
{{ row.name }}:{{ row.state === 'probing' ? '正在单请求试探恢复' : '接入暂时不可用,等待恢复' }}。
下次尝试 {{ row.retry_at ? new Date(row.retry_at).toLocaleString() : '—' }};等待期间保留任务。
</el-alert>
</template>