Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 이력서 생성과 수정이 충돌하는 현상 수정 #49

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions app/dto/resume_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ class Project(BaseModel):
projectEndedAt: str # YYYY-MM-DD 형식
skillSet: str
roleAndTask: List[str] # BASIC 템플릿에서 사용
repoLink: str
repoLink: Union[HttpUrl, str]


class ProjectUpdate(BaseModel):
# type: str
type: Literal['BASIC'] = "BASIC"
projectName: str
projectStartedAt: str # YYYY-MM-DD 형식
projectEndedAt: str # YYYY-MM-DD 형식
skillSet: str
roleAndTask: List[str] # BASIC 템플릿에서 사용
repoLink: str

class StarDto(BaseModel):
situation: str
task: str
Expand All @@ -48,11 +59,21 @@ class StarProject(Project):
type: Literal['STAR'] = "STAR"
star: StarDto

class StarProjectUpdate(ProjectUpdate):
# type: str = "STAR"
type: Literal['STAR'] = "STAR"
star: StarDto

class GitfolioProject(Project):
# type: str = "GITFOLIO"
type: Literal['GITFOLIO'] = "GITFOLIO"
troubleShooting: TroubleShootingDto

class GitfolioProjectUpdate(ProjectUpdate):
# type: str = "GITFOLIO"
type: Literal['GITFOLIO'] = "GITFOLIO"
troubleShooting: TroubleShootingDto

# gpt 프로젝트 요약문, json형태
class GptProject(BaseModel):
projectName: str
Expand Down Expand Up @@ -86,7 +107,7 @@ class ProjectResponse(BaseModel):
projectEndedAt: str # YYYY.MM 형식
skillSet: str
projectDescription: str
repoLink: str
repoLink: Union[HttpUrl, str]

class Link(BaseModel):
linkTitle: str
Expand Down Expand Up @@ -120,7 +141,7 @@ class ResumeResponseDto(BaseModel):
tags: Optional[List[str]] # null 가능
workExperiences: List[WorkExperience]
# projects: List[ProjectResponse]
projects: List[Union[Project, StarProject, GitfolioProject]]
projects: List[Union[ProjectUpdate, StarProjectUpdate, GitfolioProjectUpdate]]
links: Optional[List[Link]] # null 가능
educations: List[Education]
certificates: List[Certificate]
Expand Down
9 changes: 7 additions & 2 deletions app/services/api_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from app.dto.resume_dto import Project, StarProject, GitfolioProject
from app.services.github_service import get_combined_pr_text, get_combined_commit_diffs, get_commit_dates, clone_and_extract_files, delete_cloned_repo_from_url, get_issues_data, get_repository_data
from app.services.gpt_service import slice_and_summarize, final_summarization, generate_project_summary, generate_project_summary_byJson, simplify_project_summary_byJson, generate_role_and_task, generate_star_summary, generate_trouble_shooting
from app.services.gpt_service import slice_and_summarize, final_summarization, generate_project_summary, generate_project_summary_byJson, simplify_project_summary_byJson, generate_role_and_task, generate_star_summary, generate_trouble_shooting, generate_project_title
from app.services.data_service import save_summaries_to_file
from app.config.settings import settings
from concurrent.futures import ThreadPoolExecutor, as_completed
Expand Down Expand Up @@ -35,6 +35,7 @@ def process_repository(template, repo_url, githubID, githubName, requirements):
project_summary = create_project_summary(final_code_summary, final_pr_summary, final_commit_summary, githubID, repo_url, requirements)
simplified_summary = simplify_project_info(project_summary, requirements)
first_commit_date, latest_commit_date = create_repo_start_end_date(repo_url)
# project_title = create_project_title(settings.openai_api_key, settings.gh_token, repo_url, requirements)

# STAR 템플릿인 경우에만 추가 데이터 가져오기
if template == "STAR":
Expand All @@ -48,7 +49,6 @@ def process_repository(template, repo_url, githubID, githubName, requirements):

# 내가 한 작업
role_and_task = create_role_and_task(settings.openai_api_key, final_code_summary, final_pr_summary, final_commit_summary, requirements)
# star = create_star_summary(settings.openai_api_key,repo_data, issues_data, final_pr_summary, final_commit_summary, requirements)
trouble_shooting = create_trouble_shooting(settings.openai_api_key, final_code_summary, final_pr_summary, final_commit_summary, requirements)

delete_cloned_repo_from_url(repo_url)
Expand All @@ -69,6 +69,7 @@ def process_repository(template, repo_url, githubID, githubName, requirements):
elif template == "STAR":
project_data = StarProject(
projectName=simplified_summary.projectName,
# projectName=project_title,
projectStartedAt=first_commit_date,
projectEndedAt=latest_commit_date,
skillSet=simplified_summary.skillSet,
Expand Down Expand Up @@ -148,3 +149,7 @@ def create_trouble_shooting(openai_api_key, code_summary, pr_summary, commit_sum
trouble_shooting = generate_trouble_shooting(openai_api_key, code_summary, pr_summary, commit_summary, requirements)
return trouble_shooting

# # 프로젝트 제목 생성
# def create_project_title(openai_api_key, gh_token, repo_url, requirements):
# project_title = generate_project_title(openai_api_key, gh_token, repo_url, requirements)
# return project_title
Loading