智教助手平台:完整初始化
- 前端: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:
@@ -0,0 +1,67 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from typing import Any, Optional
|
||||
|
||||
|
||||
class CommunityAuthorOut(BaseModel):
|
||||
id: int
|
||||
name: str = ""
|
||||
avatar: str = ""
|
||||
subject: str = ""
|
||||
school: str = ""
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class PostCreate(BaseModel):
|
||||
title: str = Field(..., min_length=1, max_length=200)
|
||||
content: str = Field(..., min_length=1)
|
||||
post_type: str = "discussion"
|
||||
tags: list[str] = Field(default_factory=list)
|
||||
attachments: list[dict[str, Any]] = Field(default_factory=list)
|
||||
|
||||
|
||||
class PostUpdate(BaseModel):
|
||||
title: Optional[str] = Field(None, min_length=1, max_length=200)
|
||||
content: Optional[str] = Field(None, min_length=1)
|
||||
post_type: Optional[str] = None
|
||||
tags: Optional[list[str]] = None
|
||||
attachments: Optional[list[dict[str, Any]]] = None
|
||||
|
||||
|
||||
class PostOut(BaseModel):
|
||||
id: int
|
||||
user_id: int
|
||||
title: str
|
||||
content: str = ""
|
||||
post_type: str = "discussion"
|
||||
tags: list = Field(default_factory=list)
|
||||
attachments: list = Field(default_factory=list)
|
||||
views: int = 0
|
||||
likes: int = 0
|
||||
comments_count: int = 0
|
||||
is_pinned: int = 0
|
||||
is_favorited: bool = False
|
||||
author: CommunityAuthorOut | None = None
|
||||
created_at: datetime | None = None
|
||||
updated_at: datetime | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class CommentCreate(BaseModel):
|
||||
content: str = Field(..., min_length=1)
|
||||
parent_id: Optional[int] = None
|
||||
|
||||
|
||||
class CommentOut(BaseModel):
|
||||
id: int
|
||||
post_id: int
|
||||
user_id: int
|
||||
content: str
|
||||
parent_id: Optional[int] = None
|
||||
likes: int = 0
|
||||
author: CommunityAuthorOut | None = None
|
||||
created_at: datetime | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user