feat: builder 简历生成 + 轻度优化 + 简历导入交付副本

自内部仓库剥离深度优化与 RAG 知识库后的交付版本:
- Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强)
- 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护
- 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏
- PostgreSQL 运行时 + Alembic 迁移链

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
hyp
2026-08-05 11:08:30 +08:00
co-authored by Claude
commit ae2d9b128d
191 changed files with 27719 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
from __future__ import annotations
from alembic import context
from sqlalchemy import engine_from_config, pool
from app.db.schema import build_session_tables
config = context.config
schema = config.get_main_option("resume_agent.schema", "resume_agent")
target_metadata, _ = build_session_tables(schema)
def run_migrations_offline() -> None:
context.configure(
url=config.get_main_option("sqlalchemy.url"),
target_metadata=target_metadata,
include_schemas=True,
version_table_schema=schema,
literal_binds=True,
)
with context.begin_transaction():
context.run_migrations()
def run_migrations_online() -> None:
connectable = engine_from_config(
config.get_section(config.config_ini_section, {}),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
with connectable.connect() as connection:
connection.exec_driver_sql(f'CREATE SCHEMA IF NOT EXISTS "{schema}"')
connection.commit()
context.configure(
connection=connection,
target_metadata=target_metadata,
include_schemas=True,
version_table_schema=schema,
)
with context.begin_transaction():
context.run_migrations()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
@@ -0,0 +1,25 @@
"""Create the PostgreSQL core persistence schema."""
from __future__ import annotations
from alembic import op
from app.db.schema import build_session_tables
revision = "20260724_01"
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
op.execute(f'CREATE SCHEMA IF NOT EXISTS "{schema}"')
metadata, _ = build_session_tables(schema)
metadata.create_all(op.get_bind())
def downgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
op.execute(f'DROP SCHEMA IF EXISTS "{schema}" CASCADE')
@@ -0,0 +1,46 @@
"""Add durable reviewable resume import metadata to PostgreSQL."""
from __future__ import annotations
from alembic import op
revision = "20260724_03"
down_revision = "20260724_01"
branch_labels = None
depends_on = None
def upgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
bind = op.get_bind()
bind.exec_driver_sql(
f'''
CREATE TABLE IF NOT EXISTS "{schema}".resume_imports (
id VARCHAR(128) PRIMARY KEY,
session_id VARCHAR(128) NOT NULL
REFERENCES "{schema}".sessions(id) ON DELETE CASCADE,
file_name VARCHAR(512) NOT NULL,
mime_type VARCHAR(128) NOT NULL,
size_bytes INTEGER NOT NULL CHECK (size_bytes >= 0),
sha256 VARCHAR(64) NOT NULL,
object_key VARCHAR(512) NOT NULL,
status VARCHAR(32) NOT NULL,
document JSONB,
field_reviews JSONB NOT NULL DEFAULT '[]'::jsonb,
error_code VARCHAR(128),
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL,
CONSTRAINT uq_resume_import_session_sha256 UNIQUE (session_id, sha256)
)
'''
)
bind.exec_driver_sql(
f'''CREATE INDEX IF NOT EXISTS ix_resume_imports_session_created
ON "{schema}".resume_imports (session_id, created_at)'''
)
def downgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
op.get_bind().exec_driver_sql(f'DROP TABLE IF EXISTS "{schema}".resume_imports')
@@ -0,0 +1,42 @@
"""Add durable optimization workflow state to PostgreSQL."""
from __future__ import annotations
from alembic import op
revision = "20260730_05"
down_revision = "20260724_03"
branch_labels = None
depends_on = None
def upgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
bind = op.get_bind()
bind.exec_driver_sql(
f'''
CREATE TABLE IF NOT EXISTS "{schema}".optimization_runs (
id VARCHAR(128) PRIMARY KEY,
session_id VARCHAR(128) NOT NULL
REFERENCES "{schema}".sessions(id) ON DELETE CASCADE,
entry_id VARCHAR(128) NOT NULL,
mode VARCHAR(32) NOT NULL,
status VARCHAR(32) NOT NULL,
source_revision INTEGER NOT NULL CHECK (source_revision >= 1),
state JSONB NOT NULL,
proposal JSONB,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL
)
'''
)
bind.exec_driver_sql(
f'''CREATE INDEX IF NOT EXISTS ix_optimization_runs_active
ON "{schema}".optimization_runs (session_id, entry_id, status)'''
)
def downgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
op.get_bind().exec_driver_sql(f'DROP TABLE IF EXISTS "{schema}".optimization_runs')