feat: enable Markdown (.md) file upload in KB Accelerator

Moved md from Phase 2 extensions to allowed formats, added extraction
handler (reuses txt handler), and updated plan_limits defaults to
include md for all plans.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-11 23:29:51 -04:00
parent fe3c651115
commit 03390ed59f
4 changed files with 49 additions and 4 deletions

View File

@@ -0,0 +1,44 @@
"""Add md to kb_allowed_formats defaults
Revision ID: 056
Revises: 055
Create Date: 2026-03-12
"""
from alembic import op
import sqlalchemy as sa
revision = "056"
down_revision = "055"
branch_labels = None
depends_on = None
def upgrade() -> None:
# Update server default for new rows
op.alter_column(
"plan_limits",
"kb_allowed_formats",
server_default=sa.text("'[\"txt\",\"paste\",\"md\"]'::jsonb"),
)
# Add "md" to existing rows that have the old default ["txt","paste"]
op.execute(
"""
UPDATE plan_limits
SET kb_allowed_formats = kb_allowed_formats || '["md"]'::jsonb
WHERE NOT kb_allowed_formats @> '"md"'::jsonb
"""
)
def downgrade() -> None:
op.alter_column(
"plan_limits",
"kb_allowed_formats",
server_default=sa.text("'[\"txt\",\"paste\"]'::jsonb"),
)
op.execute(
"""
UPDATE plan_limits
SET kb_allowed_formats = kb_allowed_formats - 'md'
"""
)