Files
AIclinicalresearch/backend/prisma/manual-migrations/001_add_postgres_cache_and_checkpoint.sql
HaHafeng 98d862dbd4 feat(aia): Complete AIA V2.0 and sync all changes
AIA V2.0 Major Updates:
- Add StreamingService with OpenAI Compatible format (backend/common/streaming)
- Upgrade Chat component V2 with Ant Design X deep integration
- Implement 12 intelligent agents (5 phases: topic/design/review/data/writing)
- Create AgentHub with 100% prototype V11 restoration
- Create ChatWorkspace with fullscreen immersive experience
- Add ThinkingBlock for deep thinking display
- Add useAIStream Hook for stream handling
- Add ConversationList for conversation management

Backend (~1300 lines):
- common/streaming: OpenAI adapter and streaming service
- modules/aia: 12 agents config, conversation service, attachment service
- Unified API routes to /api/v1 (RVW, PKB, AIA modules)
- Update authentication and permission helpers

Frontend (~3500 lines):
- modules/aia: AgentHub + ChatWorkspace + AgentCard components
- shared/Chat: AIStreamChat, ThinkingBlock, useAIStream, useConversations
- Update all modules API endpoints to v1
- Modern design with theme colors (blue/yellow/teal/purple)

Documentation (~2500 lines):
- AIA module status and development guide
- Universal capabilities catalog (11 services)
- Quick reference card
- System overview updates
- All module documentation synchronization

Other Updates:
- DC Tool C: Python operations and frontend components
- IIT Manager: session memory and wechat service
- PKB/RVW/ASL: API route updates
- Docker configs and deployment scripts
- Database migrations and scripts
- Test files and documentation

Tested: AIA streaming verified, authentication working, core features functional
Status: AIA V2.0 completed (85%), all changes synchronized
2026-01-14 19:19:00 +08:00

114 lines
2.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ==================== Postgres-Only 改造:手动迁移 ====================
-- 文件: 001_add_postgres_cache_and_checkpoint.sql
-- 目的: 添加缓存表和断点续传字段
-- 日期: 2025-12-13
-- 说明: 避免Prisma migrate的shadow database问题手动添加所需表和字段
-- ==================== 1. 创建缓存表 (AppCache) ====================
CREATE TABLE IF NOT EXISTS platform_schema.app_cache (
id SERIAL PRIMARY KEY,
key VARCHAR(500) UNIQUE NOT NULL,
value JSONB NOT NULL,
expires_at TIMESTAMP NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
-- 创建索引优化过期查询和key查询
CREATE INDEX IF NOT EXISTS idx_app_cache_expires
ON platform_schema.app_cache(expires_at);
CREATE INDEX IF NOT EXISTS idx_app_cache_key_expires
ON platform_schema.app_cache(key, expires_at);
-- ==================== 2. 为AslScreeningTask添加新字段 ====================
-- 任务拆分支持字段
ALTER TABLE asl_schema.screening_tasks
ADD COLUMN IF NOT EXISTS total_batches INTEGER DEFAULT 1,
ADD COLUMN IF NOT EXISTS processed_batches INTEGER DEFAULT 0,
ADD COLUMN IF NOT EXISTS current_batch_index INTEGER DEFAULT 0;
-- 断点续传支持字段
ALTER TABLE asl_schema.screening_tasks
ADD COLUMN IF NOT EXISTS current_index INTEGER DEFAULT 0,
ADD COLUMN IF NOT EXISTS last_checkpoint TIMESTAMP,
ADD COLUMN IF NOT EXISTS checkpoint_data JSONB;
-- ==================== 3. 验证创建结果 ====================
-- 查看app_cache表结构
SELECT
column_name,
data_type,
is_nullable,
column_default
FROM information_schema.columns
WHERE table_schema = 'platform_schema'
AND table_name = 'app_cache'
ORDER BY ordinal_position;
-- 查看screening_tasks新增字段
SELECT
column_name,
data_type,
is_nullable,
column_default
FROM information_schema.columns
WHERE table_schema = 'asl_schema'
AND table_name = 'screening_tasks'
AND column_name IN (
'total_batches', 'processed_batches', 'current_batch_index',
'current_index', 'last_checkpoint', 'checkpoint_data'
)
ORDER BY ordinal_position;
-- ==================== 完成 ====================
-- ✅ 缓存表已创建
-- ✅ 任务拆分字段已添加
-- ✅ 断点续传字段已添加