diff --git a/eveai_chat_client/static/assets/js/chat-app.js b/eveai_chat_client/static/assets/js/chat-app.js
index 94ad30b..b7439de 100644
--- a/eveai_chat_client/static/assets/js/chat-app.js
+++ b/eveai_chat_client/static/assets/js/chat-app.js
@@ -509,7 +509,8 @@ export const ChatApp = {
description: fieldDef.description || '',
required: fieldDef.required || false,
default: fieldDef.default || '',
- allowedValues: fieldDef.allowed_values || null
+ allowedValues: fieldDef.allowed_values || null,
+ context: fieldDef.context || null
}));
} else if (Array.isArray(formRequest.fields)) {
// Als het al een array is, zorg dat alle velden correct zijn
@@ -520,7 +521,8 @@ export const ChatApp = {
description: field.description || '',
required: field.required || false,
default: field.default || field.defaultValue || '',
- allowedValues: field.allowed_values || field.allowedValues || null
+ allowedValues: field.allowed_values || field.allowedValues || null,
+ context: field.context || null
}));
} else {
// Fallback naar lege array als er geen velden zijn
diff --git a/eveai_chat_client/static/assets/js/components/DynamicForm.js b/eveai_chat_client/static/assets/js/components/DynamicForm.js
index 163cead..c44e973 100644
--- a/eveai_chat_client/static/assets/js/components/DynamicForm.js
+++ b/eveai_chat_client/static/assets/js/components/DynamicForm.js
@@ -160,6 +160,9 @@ export const DynamicForm = {
{{ localFormValues[field.id || field.name] || field.default || '-' }}
+
+ {{ localFormValues[field.id || field.name] || field.default || '-' }}
+
{{ localFormValues[field.id || field.name] ? 'Ja' : 'Nee' }}
@@ -180,6 +183,9 @@ export const DynamicForm = {
{{ localFormValues[fieldId] || field.default || '-' }}
+
+ {{ localFormValues[fieldId] || field.default || '-' }}
+
{{ localFormValues[fieldId] ? 'Ja' : 'Nee' }}
diff --git a/eveai_chat_client/static/assets/js/components/FormField.js b/eveai_chat_client/static/assets/js/components/FormField.js
index e78b07d..7a25b11 100644
--- a/eveai_chat_client/static/assets/js/components/FormField.js
+++ b/eveai_chat_client/static/assets/js/components/FormField.js
@@ -46,6 +46,7 @@ export const FormField = {
'float': 'number',
'text': 'textarea',
'enum': 'select',
+ 'options': 'radio',
'boolean': 'checkbox'
};
return typeMap[this.field.type] || this.field.type;
@@ -75,6 +76,10 @@ export const FormField = {
+
+
+
+ {{ field.context }}
+
+
`
diff --git a/eveai_chat_workers/specialists/specialist_typing.py b/eveai_chat_workers/specialists/specialist_typing.py
index ebc4605..9962537 100644
--- a/eveai_chat_workers/specialists/specialist_typing.py
+++ b/eveai_chat_workers/specialists/specialist_typing.py
@@ -102,18 +102,11 @@ class SpecialistResult(BaseModel):
}
# Structural optional fields available for all specialists
- answer: Optional[str] = Field(
- None,
- description="Optional textual answer from the specialist"
- )
- detailed_query: Optional[str] = Field(
- None,
- description="Optional detailed query for the specialist"
- )
- form_request: Optional[Dict[str, Any]] = Field(
- None,
- description="Optional form definition to request user input"
- )
+ answer: Optional[str] = Field(None, description="Optional textual answer from the specialist")
+ detailed_query: Optional[str] = Field(None, description="Optional detailed query for the specialist")
+ form_request: Optional[Dict[str, Any]] = Field(None, description="Optional form definition to request user input")
+ phase: Optional[str] = Field(None, description="Phase of the specialist's workflow")
+ citations: Optional[Dict[str, Any]] = Field(None, description="Citations for the specialist's answer")
@model_validator(mode='after')
def validate_required_results(self) -> 'SpecialistResult':
diff --git a/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py b/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py
index 5b7e9af..03b6083 100644
--- a/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py
+++ b/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py
@@ -95,16 +95,63 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor):
sleep(1)
self.ept.send_update(self.task_id, "Traicie Selection Specialist Processing", {"name": f"Processing Iteration {i}"})
- # flow_results = asyncio.run(self.flow.kickoff_async(inputs=arguments.model_dump()))
- # flow_state = self.flow.state
- # results = RoleDefinitionSpecialistResult.create_for_type(self.type, self.type_version)
- contact_form = cache_manager.specialist_forms_config_cache.get_config("PERSONAL_CONTACT_FORM", "1.0")
- current_app.logger.debug(f"Contact form: {contact_form}")
- results = SpecialistResult.create_for_type(self.type, self.type_version,
- answer=f"Antwoord op uw vraag: {arguments.question}",
- form_request=contact_form)
+ if not self._cached_session.interactions:
+ specialist_phase = "initial"
+ else:
+ specialist_phase = self._cached_session.interactions[-1].specialist_results.get('phase', 'initial')
- self.log_tuning(f"Traicie Selection Specialist execution ended", {"Results": results.model_dump()})
+ results = None
+
+ match specialist_phase:
+ case "initial":
+ ko_form = form_definition = {
+ "type": "KO_CRITERIA_FORM",
+ "version": "1.0.0",
+ "name": "KO Criteria Form",
+ "icon": "verified",
+ "fields": {
+ "weekend_werk": {
+ "name": "Weekend Werk",
+ "description": "Werken in het weekend",
+ "context": "Ben je bereid om in het weekend te werken?",
+ "type": "options",
+ "required": True,
+ "allowed_values": ["Ja, geen probleem", "Nee, liever niet"]
+ },
+ "fysisch_werk": {
+ "name": "Fysische Activiteit",
+ "description": "Fysisch werken",
+ "context": "In onze winkels is het belangrijk dat je 8u kan rechtstaan in een iets koeler omgeving. Is dit voor jou haalbaar?",
+ "type": "options",
+ "required": True,
+ "allowed_values": ["Ja, prima haalbaar", "Neen, mogelijks een probleem"]
+ },
+ "nabijheid_werk": {
+ "name": "Nabijheid Werk",
+ "description": "Afstand Woon-Werk",
+ "context": "We hebben gemerkt dat tevreden collega’s in de buurt van de winkel wonen. Hoe ver wil jij je verplaatsen?",
+ "type": "options",
+ "required": True,
+ "allowed_values": ["Meer dan 15 km", "Minder dan 15 km"]
+ },
+ }
+ }
+ results = SpecialistResult.create_for_type(self.type, self.type_version,
+ answer=f"We starten met een aantal KO Criteria vragen",
+ form_request=ko_form,
+ phase="ko_questions")
+ case "ko_questions":
+ contact_form = cache_manager.specialist_forms_config_cache.get_config("PERSONAL_CONTACT_FORM", "1.0")
+ results = SpecialistResult.create_for_type(self.type, self.type_version,
+ answer=f"We hebben de antwoorden op de KO criteria verwerkt. Je bent een geschikte kandidaat. Kan je je contactegevens doorgeven?",
+ form_request=contact_form,
+ phase="personal_contact_data")
+ case "personal_contact_data":
+ results = SpecialistResult.create_for_type(self.type, self.type_version,
+ answer=f"We hebben de contactgegevens verwerkt. We nemen zo snel mogelijk contact met je op.",
+ phase="candidate_selected")
+
+ self.log_tuning(f"Traicie Selection Specialist execution ended", {"Results": results.model_dump() if results else "No info"})
return results