From aeee22b3059f5e297b7d98ed94b082f6c61ec33a Mon Sep 17 00:00:00 2001 From: Josako Date: Fri, 3 Oct 2025 11:50:59 +0200 Subject: [PATCH] - Allowing additional_positive_answer and additional_positive_answer in KOQuestions asset & selection specialist interaction. --- .../knockout_questions_v1_0.py | 2 ++ .../traicie/TRAICIE_SELECTION_SPECIALIST/1_5.py | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/eveai_chat_workers/outputs/traicie/knockout_questions/knockout_questions_v1_0.py b/eveai_chat_workers/outputs/traicie/knockout_questions/knockout_questions_v1_0.py index 5754b31..9b83ed5 100644 --- a/eveai_chat_workers/outputs/traicie/knockout_questions/knockout_questions_v1_0.py +++ b/eveai_chat_workers/outputs/traicie/knockout_questions/knockout_questions_v1_0.py @@ -7,7 +7,9 @@ class KOQuestion(BaseModel): title: str = Field(..., description="The title of the knockout criterium.") question: str = Field(..., description="The corresponding question asked to the candidate.") answer_positive: Optional[str] = Field(None, description="The answer to the question, resulting in a positive outcome.") + additional_answer_positive: Optional[str] = Field(None, description="2nd answer to the question, resulting in a positive outcome.") answer_negative: Optional[str] = Field(None, description="The answer to the question, resulting in a negative outcome.") + additional_answer_negative: Optional[str] = Field(None, description="2nd answer to the question, resulting in a negative outcome.") @classmethod def from_json(cls, json_str: str) -> 'KOQuestion': diff --git a/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_5.py b/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_5.py index f49851e..e244003 100644 --- a/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_5.py +++ b/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_5.py @@ -388,8 +388,11 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor): # Evaluate KO Criteria evaluation = "positive" criterium, answer = next(iter(self.arguments.form_values.items())) - if TranslationServices.translate(self.tenant_id, previous_ko_question.answer_positive, self.arguments.language) != answer: + if TranslationServices.translate(self.tenant_id, previous_ko_question.answer_negative, self.arguments.language) == answer: evaluation = "negative" + if previous_ko_question.additional_answer_negative: + if TranslationServices.translate(self.tenant_id, previous_ko_question.additional_answer_negative, self.arguments.language) == answer: + evaluation = "negative" score = SelectionKOCriteriumScore( criterium=criterium, @@ -616,13 +619,23 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor): -> Dict[str, Any]: fields = {} ko_question = ko_questions.get_by_title(current_ko_criterium) + current_app.logger.debug(f"Preparing form for ko_question: {ko_question.to_json()}") + allowed_values = [ko_question.answer_positive, ko_question.answer_negative] + if ko_question.additional_answer_positive: + current_app.logger.debug(f"Additional answer positive found for question {ko_question.title}") + allowed_values.append(ko_question.additional_answer_positive) + if ko_question.additional_answer_negative: + current_app.logger.debug(f"Additional answer negative found for question {ko_question.title}") + allowed_values.append(ko_question.additional_answer_negative) + + current_app.logger.debug(f"Allowed values: {allowed_values}") fields[ko_question.title] = { "name": ko_question.title, "description": ko_question.title, "context": ko_question.question, "type": "options", "required": True, - "allowed_values": [ko_question.answer_positive, ko_question.answer_negative] + "allowed_values": allowed_values } ko_form = {