Update app.py
Browse files
app.py
CHANGED
|
@@ -306,33 +306,3 @@ if st.session_state.setup_complete and not st.session_state.feedback_shown and n
|
|
| 306 |
if st.session_state.chat_complete and not st.session_state.feedback_shown:
|
| 307 |
if st.button("Get Feedback", on_click=show_feedback):
|
| 308 |
st.write("Fetching feedback...")
|
| 309 |
-
|
| 310 |
-
# Show feedback screen
|
| 311 |
-
if st.session_state.feedback_shown:
|
| 312 |
-
st.subheader("Feedback")
|
| 313 |
-
|
| 314 |
-
conversation_history = "\n".join([f"{msg['role']}: {msg['content']}" for msg in st.session_state.messages])
|
| 315 |
-
|
| 316 |
-
# Initialize new OpenAI client instance for feedback
|
| 317 |
-
feedback_client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
|
| 318 |
-
|
| 319 |
-
# Generate feedback using the stored messages and write a system prompt for the feedback
|
| 320 |
-
feedback_completion = feedback_client.chat.completions.create(
|
| 321 |
-
model="gpt-4o",
|
| 322 |
-
messages=[
|
| 323 |
-
{"role": "system", "content": """You are a helpful tool that provides feedback on an interviewee performance.
|
| 324 |
-
Before the Feedback give a score of 1 to 10.
|
| 325 |
-
Follow this format:
|
| 326 |
-
Overal Score: //Your score
|
| 327 |
-
Feedback: //Here you put your feedback
|
| 328 |
-
Give only the feedback do not ask any additional questins.
|
| 329 |
-
"""},
|
| 330 |
-
{"role": "user", "content": f"This is the interview you need to evaluate. Keep in mind that you are only a tool. And you shouldn't engage in any converstation: {conversation_history}"}
|
| 331 |
-
]
|
| 332 |
-
)
|
| 333 |
-
|
| 334 |
-
st.write(feedback_completion.choices[0].message.content)
|
| 335 |
-
|
| 336 |
-
# Button to restart the interview
|
| 337 |
-
if st.button("Restart Interview", type="primary"):
|
| 338 |
-
streamlit_js_eval(js_expressions="parent.window.location.reload()")
|
|
|
|
| 306 |
if st.session_state.chat_complete and not st.session_state.feedback_shown:
|
| 307 |
if st.button("Get Feedback", on_click=show_feedback):
|
| 308 |
st.write("Fetching feedback...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|