fix(aia,ssa,asl,infra): harden SSE transport and stabilize attachment context

Deliver SSE protocol hardening for SAE/HTTP2 paths, add graceful shutdown health behavior, and improve SSA retry UX for transient stream failures. For AIA, persist attachment extraction results in database with cache read-through fallback, plus production cache safety guard to prevent memory-cache drift in multi-instance deployments; also restore ASL SR page scrolling behavior.

Made-with: Cursor
This commit is contained in:
2026-03-09 18:45:12 +08:00
parent 50657dd81f
commit 5c5fec52c1
27 changed files with 807 additions and 100 deletions

View File

@@ -43,11 +43,10 @@ export default async function chatRoutes(app: FastifyInstance) {
return reply.status(400).send({ error: '消息内容不能为空' });
}
// SSE 响应头
// SSE 响应头(不设置 ConnectionHTTP/2 中为禁止头部)
reply.raw.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Access-Control-Allow-Origin': '*',
'X-Accel-Buffering': 'no',
});

View File

@@ -266,8 +266,8 @@ export default async function sessionRoutes(app: FastifyInstance) {
reply.raw.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Access-Control-Allow-Origin': '*',
'X-Accel-Buffering': 'no',
});
const send = (type: string, data: any) => {

View File

@@ -276,8 +276,8 @@ export default async function workflowRoutes(app: FastifyInstance) {
reply.raw.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Access-Control-Allow-Origin': '*'
'Access-Control-Allow-Origin': '*',
'X-Accel-Buffering': 'no',
});
// 发送初始连接确认