Skip to content
Open
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
10 changes: 10 additions & 0 deletions backend/helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from eval_ai import JudgeAI
from graph import Graph


def summarize_answers(graph: Graph, judge: JudgeAI):
answers: str = graph.get_answers()
print("ANSWERS: ", answers)
summary: str = judge.summarize(answers)

return summary
19 changes: 14 additions & 5 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from fastapi import FastAPI, HTTPException, status, Query
from fastapi.middleware.cors import CORSMiddleware

from helper import summarize_answers
from dto import Node, NodeStatus, NodeLevel, NodeEditPayload, ApiKeyRequest, SkillsResponse
from graph import Graph
from eval_ai import JudgeAI
Expand Down Expand Up @@ -186,10 +187,18 @@ def chat_answer(answer: str):
Receive user's answer and return next question.
"""
global last_node

if answer == "I want to stop the interview":
summary = summarize_answers(graph, judge)
return {
"message": summary
}

score: int = judge.eval(question=last_node.question, answer=answer)

graph.eval(last_node, score)
last_node = graph.next()
if last_node is not None:

if last_node := graph.next():
return {
"question": last_node.question,
"completed": False,
Expand All @@ -206,9 +215,9 @@ def chat_stop():
"""
Stop the interview.
"""
answers: str = graph.get_answers()
print("ANSWERS: ", answers)
summary: str = judge.summarize(answers)

summary = summarize_answers(graph, judge)

return {
"message": summary
}
Expand Down