change home output
parent
db853e6604
commit
d259740d97
|
|
@ -259,26 +259,14 @@ async def _crawling_logic(url:str):
|
||||||
# marketing_analysis = MarketingAnalysis(**parsed)
|
# marketing_analysis = MarketingAnalysis(**parsed)
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"[crawling] structured_report 구조 확인:\n"
|
f"structured_report = {structured_report.model_dump()}"
|
||||||
f"{'='*60}\n"
|
|
||||||
f"[report] type: {type(structured_report.get('report'))}\n"
|
|
||||||
f"{'-'*60}\n"
|
|
||||||
f"{structured_report.get('report')}\n"
|
|
||||||
f"{'='*60}\n"
|
|
||||||
f"[tags] type: {type(structured_report.get('tags'))}\n"
|
|
||||||
f"{'-'*60}\n"
|
|
||||||
f"{structured_report.get('tags')}\n"
|
|
||||||
f"{'='*60}\n"
|
|
||||||
f"[selling_points] type: {type(structured_report.get('selling_points'))}\n"
|
|
||||||
f"{'-'*60}\n"
|
|
||||||
f"{structured_report.get('selling_points')}\n"
|
|
||||||
f"{'='*60}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
marketing_analysis = MarketingAnalysis(
|
marketing_analysis = MarketingAnalysis(
|
||||||
report=structured_report["report"],
|
report = structured_report
|
||||||
tags=structured_report["tags"],
|
# report = structured_report["report"],
|
||||||
selling_points = structured_report["selling_points"]# list([sp['keywords'] for sp in structured_report["selling_points"]])# [json.dumps(structured_report["selling_points"])] # 나중에 Selling Points로 변수와 데이터구조 변경할 것
|
# tags=structured_report["tags"],
|
||||||
|
# selling_points = structured_report["selling_points"]# list([sp['keywords'] for sp in structured_report["selling_points"]])# [json.dumps(structured_report["selling_points"])] # 나중에 Selling Points로 변수와 데이터구조 변경할 것
|
||||||
)
|
)
|
||||||
# Selling Points 구조
|
# Selling Points 구조
|
||||||
# print(sp['category'])
|
# print(sp['category'])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Literal, Optional
|
from typing import Literal, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, ConfigDict, Field
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
from app.utils.prompts.schemas import MarketingPromptOutput
|
||||||
|
|
||||||
class AttributeInfo(BaseModel):
|
class AttributeInfo(BaseModel):
|
||||||
"""음악 속성 정보"""
|
"""음악 속성 정보"""
|
||||||
|
|
@ -147,21 +147,21 @@ class ProcessedInfo(BaseModel):
|
||||||
detail_region_info: str = Field(..., description="상세 지역 정보 (roadAddress)")
|
detail_region_info: str = Field(..., description="상세 지역 정보 (roadAddress)")
|
||||||
|
|
||||||
|
|
||||||
class MarketingAnalysisDetail(BaseModel):
|
# class MarketingAnalysisDetail(BaseModel):
|
||||||
detail_title : str = Field(..., description="디테일 카테고리 이름")
|
# detail_title : str = Field(..., description="디테일 카테고리 이름")
|
||||||
detail_description : str = Field(..., description="해당 항목 설명")
|
# detail_description : str = Field(..., description="해당 항목 설명")
|
||||||
|
|
||||||
class MarketingAnalysisReport(BaseModel):
|
# class MarketingAnalysisReport(BaseModel):
|
||||||
"""마케팅 분석 리포트 스키마"""
|
# """마케팅 분석 리포트 스키마"""
|
||||||
summary : str = Field(..., description="비즈니스 한 줄 요약")
|
# summary : str = Field(..., description="비즈니스 한 줄 요약")
|
||||||
details : list[MarketingAnalysisDetail] = Field(default_factory=list, description="개별 디테일")
|
# details : list[MarketingAnalysisDetail] = Field(default_factory=list, description="개별 디테일")
|
||||||
|
|
||||||
class MarketingAnalysis(BaseModel):
|
class MarketingAnalysis(BaseModel):
|
||||||
"""마케팅 분석 결과 스키마"""
|
"""마케팅 분석 결과 스키마"""
|
||||||
|
|
||||||
report: MarketingAnalysisReport = Field(..., description="마케팅 분석 리포트")
|
report: MarketingPromptOutput = Field(..., description = "마케팅 분석 결과")# MarketingAnalysisReport = Field(..., description="마케팅 분석 리포트")
|
||||||
tags: list[str] = Field(default_factory=list, description="추천 태그 목록")
|
# tags: list[str] = Field(default_factory=list, description="추천 태그 목록")
|
||||||
selling_points: list[str] = Field(default_factory=list, description="추천 부대시설 목록")
|
# selling_points: list[str] = Field(default_factory=list, description="추천 부대시설 목록")
|
||||||
|
|
||||||
|
|
||||||
class CrawlingResponse(BaseModel):
|
class CrawlingResponse(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class ChatgptService:
|
||||||
if response.status == "completed":
|
if response.status == "completed":
|
||||||
logger.debug(f"[ChatgptService] Response output_text: {response.output_text[:200]}..." if len(response.output_text) > 200 else f"[ChatgptService] Response output_text: {response.output_text}")
|
logger.debug(f"[ChatgptService] Response output_text: {response.output_text[:200]}..." if len(response.output_text) > 200 else f"[ChatgptService] Response output_text: {response.output_text}")
|
||||||
structured_output = response.output_parsed
|
structured_output = response.output_parsed
|
||||||
return structured_output.model_dump() or {}
|
return structured_output #.model_dump() or {}
|
||||||
|
|
||||||
# 에러 상태 처리
|
# 에러 상태 처리
|
||||||
if response.status == "failed":
|
if response.status == "failed":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue