diff --git a/pages/2_user.py b/pages/2_user.py index 09e5132..e4aa541 100644 --- a/pages/2_user.py +++ b/pages/2_user.py @@ -8,7 +8,7 @@ sys.path.append("./") sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) -from config import DATA_DIR, IMG_PATH, path +from config import DATA_DIR, IMG_PATH, path, CSS_PATH from loguru import logger as _logger from src.logger import DevConfig from src.util import (check_essential, get_image_base64, local_css, @@ -48,7 +48,7 @@ st.title("안녕하세요, " + st.session_state.nickname + "님!") # 사용자 이름을 받아서 화면에 출력합니다. -local_css(os.path.join(path, "front", "css", "background.css")) +local_css(os.path.join(CSS_PATH, "background.css")) # local_css("css/1_user.css") @@ -237,7 +237,7 @@ ## read job info tb -job_info, JOBS = read_job_info_tb(path + "/data/samples/job_info_tb.parquet") +job_info, JOBS = read_job_info_tb(os.path.join(DATA_DIR, "samples", "job_info_tb.parquet")) st.session_state.job_info = job_info st.session_state.logger.info("read job tb") st.session_state.logger.info(f"job info is ... {JOBS}") diff --git a/pages/3_gene_question.py b/pages/3_gene_question.py index 64b735c..05fd6d6 100644 --- a/pages/3_gene_question.py +++ b/pages/3_gene_question.py @@ -137,7 +137,7 @@ ### JD 사용하여 JD 추출용 프롬프트 만들기 st.session_state.logger.info("prompt JD start") - prompt_template_jd = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_JD_template.txt")) + prompt_template_jd = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_JD_template.txt")) st.session_state.prompt_JD = create_prompt_with_jd(prompt_template_jd) # prompt_JD 생성완료 @@ -163,7 +163,7 @@ # prompt_qa_template ####################################### st.session_state.logger.info("prompt resume start") - prompt_template_resume = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_resume_template.txt")) + prompt_template_resume = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_resume_template.txt")) st.session_state.logger.info("create prompt resume template") st.session_state.prompt_resume = create_prompt_with_resume(prompt_template_resume) @@ -192,7 +192,7 @@ ## step3 : st.session_state.logger.info("prompt question start") - prompt_template_question = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_question_template.txt")) + prompt_template_question = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_question_template.txt")) st.session_state.logger.info("create prompt question template") st.session_state.prompt_question = create_prompt_with_question(prompt_template_question) diff --git a/pages/3_gene_question_no_resume.py b/pages/3_gene_question_no_resume.py index 92f10a4..bfeb6dc 100644 --- a/pages/3_gene_question_no_resume.py +++ b/pages/3_gene_question_no_resume.py @@ -128,7 +128,7 @@ ### JD 사용하여 JD 추출용 프롬프트 만들기 st.session_state.logger.info("prompt JD start") - prompt_template_jd = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_JD_template.txt")) + prompt_template_jd = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_JD_template.txt")) st.session_state.prompt_JD = create_prompt_with_jd(prompt_template_jd) # prompt_JD 생성완료 @@ -148,7 +148,7 @@ ## step2 JD 만을 이용해 질문 6개를 생성합니다 : st.session_state.logger.info("prompt question start") - prompt_noResume_question_template = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_noResume_question_template.txt")) + prompt_noResume_question_template = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_noResume_question_template.txt")) st.session_state.logger.info("create no resume prompt question template") st.session_state.prompt_question = create_prompt_with_no_resume(prompt_noResume_question_template) diff --git a/pages/4_interview.py b/pages/4_interview.py index 4bba826..27b5b49 100644 --- a/pages/4_interview.py +++ b/pages/4_interview.py @@ -83,7 +83,7 @@ def next_tail_question(): # 대화내역 파일로 저장 st.session_state.interview_script_download = "\n\n".join(st.session_state.interview_script) -with open(st.session_state['save_dir'] + "/interview_history.txt", "w") as file: +with open(os.path.join(st.session_state['save_dir'], "interview_history.txt"), "w") as file: file.write(st.session_state.interview_script_download) ##################################### 여기서부터 모의 면접 시작 ############################################ diff --git a/pages/4_show_questions_hint.py b/pages/4_show_questions_hint.py index 2c524a4..e644298 100644 --- a/pages/4_show_questions_hint.py +++ b/pages/4_show_questions_hint.py @@ -48,8 +48,8 @@ st.title(f"{st.session_state.user_name}님의 기술면접 예상 질문입니다.🤗 ") -st.session_state.prompt_template_fb = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_feedback.txt")) -st.session_state.prompt_template_ht = read_prompt_from_txt(os.path.join(DATA_DIR, "test/prompt_hint.txt")) +st.session_state.prompt_template_fb = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_feedback.txt")) +st.session_state.prompt_template_ht = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "prompt_hint.txt")) # 각 질문에 대해 번호를 매기고 토글 위젯 생성 @@ -140,7 +140,7 @@ switch_page("user") st.session_state.question_history = "\n\n".join(st.session_state.questions_showhint) -with open(st.session_state['save_dir'] + "/question_history.txt", "w") as file: +with open(os.path.join(st.session_state['save_dir'], "question_history.txt"), "w") as file: file.write(st.session_state.question_history) # 생성된 질문을 파일로 저장 # 다운로드 버튼 생성 diff --git a/src/util.py b/src/util.py index deb3afb..38c8e88 100644 --- a/src/util.py +++ b/src/util.py @@ -12,7 +12,7 @@ from langchain.memory.buffer_window import ConversationBufferWindowMemory from langchain.prompts.prompt import PromptTemplate from PIL import Image -from dotenv import load_dotenv +from config import DATA_DIR sys.path.append("./") load_dotenv() # OPENAI_API_KEY 불러오기 @@ -214,9 +214,7 @@ def load_chain(question): # Load OpenAI chat model llm = ChatOpenAI(temperature=0) - template = read_prompt_from_txt( - os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", "test", "tail_question_template.txt") - ) + template = read_prompt_from_txt(os.path.join(DATA_DIR, "test", "tail_question_template.txt")) # Create memory 'chat_history' memory = ConversationBufferWindowMemory(human_prefix="면접자 답변", ai_prefix="answer")