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:
@@ -0,0 +1,30 @@
|
||||
-- AIA 附件持久化:数据库真相源 + 缓存加速
|
||||
CREATE TABLE IF NOT EXISTS "aia_schema"."attachments" (
|
||||
"id" TEXT NOT NULL,
|
||||
"user_id" TEXT NOT NULL,
|
||||
"conversation_id" TEXT NOT NULL,
|
||||
"filename" TEXT NOT NULL,
|
||||
"mime_type" TEXT,
|
||||
"size" INTEGER NOT NULL,
|
||||
"oss_url" TEXT NOT NULL,
|
||||
"text_content" TEXT,
|
||||
"extract_status" TEXT NOT NULL DEFAULT 'success',
|
||||
"extract_error" TEXT,
|
||||
"token_count" INTEGER NOT NULL DEFAULT 0,
|
||||
"truncated" BOOLEAN NOT NULL DEFAULT false,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
CONSTRAINT "attachments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "idx_aia_attachments_conversation_id"
|
||||
ON "aia_schema"."attachments"("conversation_id");
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "idx_aia_attachments_user_id"
|
||||
ON "aia_schema"."attachments"("user_id");
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "idx_aia_attachments_extract_status"
|
||||
ON "aia_schema"."attachments"("extract_status");
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "idx_aia_attachments_created_at"
|
||||
ON "aia_schema"."attachments"("created_at");
|
||||
@@ -127,6 +127,31 @@ model Message {
|
||||
@@schema("aia_schema")
|
||||
}
|
||||
|
||||
/// AIA 附件持久化(数据库真相源,缓存仅加速)
|
||||
model AiaAttachment {
|
||||
id String @id
|
||||
userId String @map("user_id")
|
||||
conversationId String @map("conversation_id")
|
||||
filename String
|
||||
mimeType String? @map("mime_type")
|
||||
size Int
|
||||
ossUrl String @map("oss_url")
|
||||
textContent String? @map("text_content") @db.Text
|
||||
extractStatus String @default("success") @map("extract_status") // success | failed | empty
|
||||
extractError String? @map("extract_error")
|
||||
tokenCount Int @default(0) @map("token_count")
|
||||
truncated Boolean @default(false)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@index([conversationId], map: "idx_aia_attachments_conversation_id")
|
||||
@@index([userId], map: "idx_aia_attachments_user_id")
|
||||
@@index([extractStatus], map: "idx_aia_attachments_extract_status")
|
||||
@@index([createdAt], map: "idx_aia_attachments_created_at")
|
||||
@@map("attachments")
|
||||
@@schema("aia_schema")
|
||||
}
|
||||
|
||||
model KnowledgeBase {
|
||||
id String @id @default(uuid())
|
||||
userId String @map("user_id")
|
||||
|
||||
Reference in New Issue
Block a user