- FastAPI backend with SQLAlchemy ORM and SQLite - AI chatbot with OpenAI-compatible LLM integration (SSE streaming) - Admin panel for content management, LLM config, token management - Anonymous access with 3-question limit, token-based access control - Recruiter intent detection with admin notification - Resume generator (JD-based, Markdown to Word export) - Chinese localized public interface Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
115 lines
3.7 KiB
Python
115 lines
3.7 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import Column, Integer, String, Text, Float, Boolean, DateTime
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Profile(Base):
|
|
__tablename__ = "profile"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(50), default="")
|
|
phone = Column(String(20), default="")
|
|
location = Column(String(100), default="")
|
|
birthday = Column(String(20), default="")
|
|
party = Column(String(20), default="")
|
|
education_level = Column(String(50), default="")
|
|
email = Column(String(100), default="")
|
|
photo_url = Column(String(500), nullable=True)
|
|
self_summary = Column(Text, default="")
|
|
|
|
|
|
class Skill(Base):
|
|
__tablename__ = "skills"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
category = Column(String(50), default="")
|
|
content = Column(Text, default="")
|
|
sort_order = Column(Integer, default=0)
|
|
|
|
|
|
class Education(Base):
|
|
__tablename__ = "education"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
start_date = Column(String(20), default="")
|
|
end_date = Column(String(20), default="")
|
|
school = Column(String(100), default="")
|
|
major = Column(String(100), default="")
|
|
degree = Column(String(50), default="")
|
|
details = Column(Text, default="")
|
|
sort_order = Column(Integer, default=0)
|
|
|
|
|
|
class WorkExperience(Base):
|
|
__tablename__ = "work_experience"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
start_date = Column(String(20), default="")
|
|
end_date = Column(String(20), default="")
|
|
company = Column(String(100), default="")
|
|
position = Column(String(100), default="")
|
|
company_intro = Column(Text, default="")
|
|
responsibilities = Column(Text, default="")
|
|
achievements = Column(Text, default="")
|
|
sort_order = Column(Integer, default=0)
|
|
|
|
|
|
class AdminUser(Base):
|
|
__tablename__ = "admin_user"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
email = Column(String(100), unique=True, index=True)
|
|
password_hash = Column(String(200))
|
|
|
|
|
|
class AccessToken(Base):
|
|
__tablename__ = "access_token"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
token = Column(String(100), unique=True, index=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
is_active = Column(Boolean, default=True)
|
|
note = Column(String(200), nullable=True)
|
|
max_questions = Column(Integer, default=9)
|
|
used_questions = Column(Integer, default=0)
|
|
|
|
|
|
class LLMConfig(Base):
|
|
__tablename__ = "llm_config"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
api_url = Column(String(500), default="")
|
|
api_key = Column(String(500), default="")
|
|
model_name = Column(String(100), default="")
|
|
max_tokens = Column(Integer, default=2048)
|
|
temperature = Column(Float, default=0.7)
|
|
system_prompt = Column(Text, nullable=True)
|
|
is_active = Column(Boolean, default=True)
|
|
max_questions_per_session = Column(Integer, default=10)
|
|
|
|
|
|
class ChatHistory(Base):
|
|
__tablename__ = "chat_history"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
session_id = Column(String(100), index=True)
|
|
role = Column(String(20))
|
|
content = Column(Text)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
|
|
|
|
class RecruiterMessage(Base):
|
|
__tablename__ = "recruiter_message"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
session_id = Column(String(100), index=True)
|
|
visitor_label = Column(String(200), default="")
|
|
company = Column(String(200), default="")
|
|
contact = Column(String(200), default="")
|
|
intent = Column(String(100), default="")
|
|
summary = Column(Text, default="")
|
|
is_read = Column(Boolean, default=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|