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

feat:프로젝트이름 생성 로직 #43

Merged
merged 4 commits into from
Dec 6, 2024
Merged

feat:프로젝트이름 생성 로직 #43

merged 4 commits into from
Dec 6, 2024

Conversation

Oh-JunTaek
Copy link
Collaborator

@Oh-JunTaek Oh-JunTaek commented Dec 5, 2024

브랜치 명은 플젝네임이지만 실제 함수는 project_title로 작업함
-> 기존 플젝네임함수 버리지 않고 교차검증용으로 사용

#️⃣연관된 이슈

#42

📝작업 내용

프로젝트 제목을 생성하는 로직을 리뉴얼 함.

  • 기존 로직으로 하면 너무 터무니없는 결과값을 내놓는 경우가 있음.
    image
    작업 목적
  • 이력서 템플릿 별로 서비스를 제공할 경우 각 항목에 해당하는 값을 보내야 하는데 정확성을 높이기 위한 고도화 작업 중 일부

파일별 설명

  1. settings : str 값 주었음
  2. dto : dto 값 넣음. llm을 호출하지 않는 결과도 같은 형식을 반환하도록 함
  3. github_service : 토큰을 활용(레포네임, 레포리드미 첫 줄, 토픽) -> gpt 서비스에서 호출해서 사용하기 위함
  4. gpt_service : 대략 다음 순서로 작동
    • 깃허브 토큰에서 제목 후보를 가져옴(후보1 = 레포 네임, 후보2 = 레포리드미 1번째 줄, 후보3 = 깃허브 토픽->이건 사실상 후보라기보단 추가 정보)
    • 후보1과 후보2가 같으면 빼박 플젝 제목이니 llm 호출도 안하고 그냥 리턴하고 끝냄
    • 다를 경우 후보 1, 후보2, 후보3을 gpt에게 줘서 후보3을 토대로 1,2를 비교해서 생성하게 함 ->프롬프트
    • 일단은 위 로직으로 끝을 내는데 최악의 시나리오가 남아있음.[후보1 = 의미없는 레포네임(ex_asdf), 리드미 없음, 토픽없음] 이 경우에는 기존 '프로젝트네임' 함수를 사용하는게 좋을 것 같은데 아직 반영은 안함. -> 놀랍게도 나의 레포 중 이런게 있음 ㅋ

💬리뷰 요구사항(선택)

마지막 최악의 시나리오에 대한 대처 방안에 대한 조언이 있다면 해줘!!!! 기존 플젝네임 함수를 그냥 쓸건지, 아님 참신한 띵킹이 있다던지

브랜치 명은 플젝네임이지만 실제 함수는 project_title로 작업함
-> 기존 플젝네임함수 버리지 않고 교차검증용으로 사용
@Oh-JunTaek Oh-JunTaek self-assigned this Dec 5, 2024
Copy link
Member

@speardragon speardragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아주 좋습니다! 코멘트 한 번만 봐주세요!

Comment on lines 301 to 307
try:
topics = repo.get_topics() # 토픽 리스트 가져오기
title_candidate_3 = ", ".join(topics) if topics else "No topics available"
print(f"Title Candidate 3 (Topics): {title_candidate_3}")
except Exception as e:
print(f"Error fetching topics: {e}")
title_candidate_3 = "No topics available"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 마찬가지로 topics가 없으면 빈 문자열을 넣어주는 건 어떨까요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿아이디어!

def create_project_title(openai_api_key, gh_token, repo_url, prompt=settings.project_title_prompt):
try:
# 제목 후보 1과 후보 2 가져오기
title_candidate_1, title_candidate_2, title_candidate_3 = project_title_candidate(gh_token, repo_url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 만약에 except가 실행돼서 "프로젝트 제목을 생성할 수 없습니다."가 반환되면 3개를 리턴하는 게 아니라 오류 뜰 것 같아요!

이 경우에 두 가지 방법이 있을 것 같은데

  1. 반환을 딕셔너리로 한다. (return {title_candidate_1: title_candidate_1, ...}
  2. except의 반환도 세 개로 맞춘다. (return "", "", "")

제 생각엔 1번 방식이 더 맞는 것 같아요. 이렇게 하면 변수 하나로 받고 이름을 title_cadidate_dict 같은 걸로 받아서 그 다음에 title_candidate_1, 2, 3으로 나눠서 사용하면 될 것 같습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오케이 그 부분 공부해보고 코드변경 반영해보겠읍니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
image

반영하여보았읍니다

pr을 받고 제목후보 처리 과정에서 오류가 발생할 수 있음을 인지.
@Oh-JunTaek Oh-JunTaek merged commit e8be85c into develop Dec 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants