Fix deprecated Pydantic features: replace dict() with model_dump(), orm_mode with from_attributes, and schema_extra with json_schema_extra
This commit is contained in:
parent
42eb59bdfe
commit
39d270fbec
|
@ -38,7 +38,7 @@ async def execute_search(
|
|||
"""
|
||||
try:
|
||||
search_results = await search_service.execute_search(
|
||||
search_in.structured_query,
|
||||
search_in.structured_query.model_dump(),
|
||||
search_in.search_engines,
|
||||
search_in.num_results,
|
||||
search_in.timeout,
|
||||
|
@ -142,7 +142,7 @@ async def delete_search(
|
|||
search_id: str,
|
||||
current_user: User = Depends(get_current_active_user),
|
||||
db: Session = Depends(get_db),
|
||||
) -> Any:
|
||||
) -> None:
|
||||
"""
|
||||
Delete a search from history.
|
||||
|
||||
|
@ -166,5 +166,3 @@ async def delete_search(
|
|||
|
||||
db.delete(search)
|
||||
db.commit()
|
||||
|
||||
return None
|
||||
|
|
|
@ -62,7 +62,7 @@ class ProcessedQuery(BaseModel):
|
|||
class Config:
|
||||
"""Pydantic config."""
|
||||
|
||||
schema_extra = {
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"original_query": "What are the latest advancements in quantum computing?",
|
||||
"structured_query": {
|
||||
|
|
|
@ -50,7 +50,7 @@ class ReportInDBBase(ReportBase):
|
|||
class Config:
|
||||
"""Pydantic config."""
|
||||
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class Report(ReportInDBBase):
|
||||
|
|
|
@ -65,7 +65,7 @@ class SearchHistory(BaseModel):
|
|||
class Config:
|
||||
"""Pydantic config."""
|
||||
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class SearchHistoryList(BaseModel):
|
||||
|
|
|
@ -37,9 +37,7 @@ class UserInDBBase(UserBase):
|
|||
id: Optional[str] = None
|
||||
|
||||
class Config:
|
||||
"""Pydantic config."""
|
||||
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class User(UserInDBBase):
|
||||
|
|
Loading…
Reference in New Issue