智教助手平台:完整初始化

- 前端:Vue3 + TS + Element Plus,24 个页面路由(课件/组题/教案/动画/思维导图/作文批改/命题/课堂/资源/社区等)
- 后端:FastAPI + SQLAlchemy + SQLite,17 个路由模块,AI 服务层含降级模板
- AI:glm-5.x 推理模型已禁用思维链,确保输出真实内容
- 修复:ai_service 两处请求体注入 enable_thinking/thinking disabled
- 测试账号:13900999999 / test1234
This commit is contained in:
Zhang Jing Xuan
2026-07-29 16:29:10 +08:00
commit 0841b1a103
193 changed files with 44995 additions and 0 deletions
@@ -0,0 +1,28 @@
"""initial schema
Revision ID: 97e0aa47c003
Revises:
Create Date: 2026-07-21 11:38:09.510081
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = '97e0aa47c003'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
@@ -0,0 +1,44 @@
"""add audit logs table
Revision ID: a1b2c3d4e5f6
Revises: 97e0aa47c003
Create Date: 2026-07-21 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = 'a1b2c3d4e5f6'
down_revision: Union[str, None] = '97e0aa47c003'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'audit_logs',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('username', sa.String(length=100), nullable=False, server_default=''),
sa.Column('action', sa.String(length=64), nullable=False),
sa.Column('target_type', sa.String(length=32), nullable=False, server_default=''),
sa.Column('target_id', sa.String(length=64), nullable=False, server_default=''),
sa.Column('detail', sa.Text(), nullable=False, server_default=''),
sa.Column('ip', sa.String(length=64), nullable=False, server_default=''),
sa.Column('user_agent', sa.String(length=255), nullable=False, server_default=''),
sa.Column('status', sa.String(length=16), nullable=False, server_default='success'),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_audit_logs_id', 'audit_logs', ['id'])
op.create_index('ix_audit_logs_user_id', 'audit_logs', ['user_id'])
op.create_index('ix_audit_logs_action', 'audit_logs', ['action'])
def downgrade() -> None:
op.drop_index('ix_audit_logs_action', table_name='audit_logs')
op.drop_index('ix_audit_logs_user_id', table_name='audit_logs')
op.drop_index('ix_audit_logs_id', table_name='audit_logs')
op.drop_table('audit_logs')
@@ -0,0 +1,39 @@
"""add mind maps table
Revision ID: b2c3d4e5f6a7
Revises: a1b2c3d4e5f6
Create Date: 2026-07-22 09:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = 'b2c3d4e5f6a7'
down_revision: Union[str, None] = 'a1b2c3d4e5f6'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'mind_maps',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=200), nullable=False),
sa.Column('subject', sa.String(length=50), nullable=False, server_default='综合'),
sa.Column('nodes', sa.JSON(), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id']),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_mind_maps_id', 'mind_maps', ['id'])
op.create_index('ix_mind_maps_user_id', 'mind_maps', ['user_id'])
def downgrade() -> None:
op.drop_index('ix_mind_maps_user_id', table_name='mind_maps')
op.drop_index('ix_mind_maps_id', table_name='mind_maps')
op.drop_table('mind_maps')
@@ -0,0 +1,37 @@
"""add reset codes table
Revision ID: c3d4e5f6a7b8
Revises: b2c3d4e5f6a7
Create Date: 2026-07-22 10:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = 'c3d4e5f6a7b8'
down_revision: Union[str, None] = 'b2c3d4e5f6a7'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'reset_codes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('phone', sa.String(length=20), nullable=False),
sa.Column('code', sa.String(length=6), nullable=False),
sa.Column('consumed', sa.Integer(), nullable=False, server_default='0'),
sa.Column('expires_at', sa.DateTime(), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_reset_codes_id', 'reset_codes', ['id'])
op.create_index('ix_reset_codes_phone', 'reset_codes', ['phone'])
def downgrade() -> None:
op.drop_index('ix_reset_codes_phone', table_name='reset_codes')
op.drop_index('ix_reset_codes_id', table_name='reset_codes')
op.drop_table('reset_codes')
@@ -0,0 +1,41 @@
"""add notifications table
Revision ID: d4e5f6a7b8c9
Revises: c3d4e5f6a7b8
Create Date: 2026-07-22 11:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = 'd4e5f6a7b8c9'
down_revision: Union[str, None] = 'c3d4e5f6a7b8'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'notifications',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('actor_id', sa.Integer(), nullable=True),
sa.Column('ntype', sa.String(length=32), nullable=False, server_default='comment'),
sa.Column('title', sa.String(length=200), nullable=False),
sa.Column('content', sa.String(length=500), nullable=False, server_default=''),
sa.Column('link', sa.String(length=255), nullable=False, server_default=''),
sa.Column('is_read', sa.Boolean(), nullable=False, server_default=sa.text('0')),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id']),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_notifications_id', 'notifications', ['id'])
op.create_index('ix_notifications_user_id', 'notifications', ['user_id'])
def downgrade() -> None:
op.drop_index('ix_notifications_user_id', table_name='notifications')
op.drop_index('ix_notifications_id', table_name='notifications')
op.drop_table('notifications')