## 新增功能 - 文件管理模块:分类树 + 文件上传/下载/删除 - 文件上传支持拖拽(Dragger)+ 手动上传(customRequest 模式) ## 页面布局统一(参照评测执行页) - 仪表盘/评测对象/评测场景/评测报告 全部改为全高 flex 布局 - 统一内联页头样式(h2 + 竖线分隔 + 描述) - 表格撑满高度、overflow 处理 - 每页添加刷新按钮 ## Bug 修复 - 分类树操作按钮 hover 不可见(CSS 规则缺失) - 文件上传失败(multipart boundary 缺失) - LLM API 响应 content blocks 数组格式支持(_extract_content_from_api_response) - response_time_max_ms 被静默忽略(隐式规则传空 params) - 空 messages 导致 IndexError 崩溃 - poll_reply 异常中止整个 run(缺 try/catch) - engine finally 未关闭 session - 3 个页面 UTC 时间戳解析偏差 8 小时 ## 后端 - EvalEngine: poll_reply 异常保护、空 dialog 保护、session 关闭 - LLM API 响应解析支持 content-block-array 格式 - 隐式 response_time 规则正确传递 max_ms 参数 ## 前端 - api.ts: 移除手动 Content-Type(让浏览器自动添加 boundary) - Files.tsx: customRequest 替代 beforeUpload、布局优化 - index.css: 分类树 hover 规则 - Targets/Scenarios/Home/Reports: 全高布局改造 - 3 个页面时间戳改用 formatDateTime()(修复 UTC 偏差) Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
3.3 KiB
Python
91 lines
3.3 KiB
Python
"""add file management tables
|
|
|
|
Revision ID: df320ecde84f
|
|
Revises: 15c107310eea
|
|
Create Date: 2026-07-15 02:58:18.116905
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'df320ecde84f'
|
|
down_revision: Union[str, Sequence[str], None] = '15c107310eea'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('file_categories',
|
|
sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('parent_id', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['parent_id'], ['file_categories.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('file_records',
|
|
sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('original_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('storage_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('category_id', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
sa.Column('file_size', sa.Integer(), nullable=False),
|
|
sa.Column('mime_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('file_ext', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['category_id'], ['file_categories.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('eval_results', schema=None) as batch_op:
|
|
batch_op.alter_column('run_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
|
|
with op.batch_alter_table('eval_runs', schema=None) as batch_op:
|
|
batch_op.alter_column('target_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
batch_op.alter_column('scenario_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
|
|
with op.batch_alter_table('turns', schema=None) as batch_op:
|
|
batch_op.alter_column('run_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('turns', schema=None) as batch_op:
|
|
batch_op.alter_column('run_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
|
|
with op.batch_alter_table('eval_runs', schema=None) as batch_op:
|
|
batch_op.alter_column('scenario_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
batch_op.alter_column('target_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
|
|
with op.batch_alter_table('eval_results', schema=None) as batch_op:
|
|
batch_op.alter_column('run_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
|
|
op.drop_table('file_records')
|
|
op.drop_table('file_categories')
|
|
# ### end Alembic commands ###
|