- Introduction of TRACIE_KO_INTERVIEW_DEFINITION_SPECIALIST

- Re-introduction of EveAIAsset
- Make translation services resistent for situation with and without current_event defined.
- Ensure first question is asked in eveai_chat_client
- Start of version 1.4.0 of TRAICIE_SELECTION_SPECIALIST
This commit is contained in:
Josako
2025-07-02 16:58:43 +02:00
parent fbc9f44ac8
commit 51d029d960
34 changed files with 1292 additions and 302 deletions

View File

@@ -121,6 +121,8 @@ export const ChatApp = {
// Load historical messages from server
this.loadHistoricalMessages();
console.log('Nr of messages:', this.allMessages.length);
// Add welcome message if no history
if (this.allMessages.length === 0) {
this.addWelcomeMessage();
@@ -157,12 +159,52 @@ export const ChatApp = {
}
},
addWelcomeMessage() {
this.addMessage(
'Hallo! Ik ben je AI assistant. Vraag gerust om een formulier zoals "contactformulier" of "bestelformulier"!',
'ai',
'text'
);
async addWelcomeMessage() {
console.log('Sending initialize message to backend');
// Toon typing indicator
this.isTyping = true;
this.isLoading = true;
try {
// Verzamel gegevens voor de API call
const apiData = {
message: 'Initialize',
conversation_id: this.conversationId,
user_id: this.userId,
language: this.currentLanguage
};
const response = await this.callAPI('/api/send_message', apiData);
// Verberg typing indicator
this.isTyping = false;
// Voeg AI response toe met task_id voor tracking
const aiMessage = this.addMessage(
'',
'ai',
'text'
);
// Voeg task_id toe als beschikbaar
if (response.task_id) {
console.log('Monitoring Initialize Task ID: ', response.task_id);
aiMessage.taskId = response.task_id;
}
} catch (error) {
console.error('Error sending initialize message:', error);
this.isTyping = false;
// Voeg standaard welkomstbericht toe als fallback
this.addMessage(
'Hallo! Ik ben je AI assistant. Vraag gerust om een formulier zoals "contactformulier" of "bestelformulier"!',
'ai',
'text'
);
} finally {
this.isLoading = false;
}
},
setupEventListeners() {

View File

@@ -111,14 +111,26 @@ def chat(magic_link_code):
if isinstance(specialist_config, str):
specialist_config = json.loads(specialist_config)
welcome_message = specialist_config.get('welcome_message', 'Hello! How can I help you today?')
# # Send a first 'empty' message to the specialist, in order to receive a starting message
# Database(tenant_id).switch_schema()
# specialist_args = session['magic_link'].get('specialist_args', {})
# specialist_args['question'] = ''
# result = SpecialistServices.execute_specialist(
# tenant_id=tenant_id,
# specialist_id=specialist.id,
# specialist_arguments=specialist_args,
# session_id=session['chat_session_id'],
# user_timezone=specialist_config.get('timezone', 'UTC')
# )
#
# welcome_message = result.get('answer')
return render_template('chat.html',
tenant=tenant,
tenant_make=tenant_make,
specialist=specialist,
customisation=customisation,
messages=[welcome_message],
messages=[],
settings=settings,
config=current_app.config
)