From 1d79a19981fa86690512cb0f097ff437e49d4291 Mon Sep 17 00:00:00 2001 From: Josako Date: Tue, 21 Oct 2025 11:00:26 +0200 Subject: [PATCH] - Refinenement of improved RAG_SPECIALIST - Changed label of RetrieverType in Retriever form --- common/utils/security_utils.py | 7 ------- config/agents/globals/RAG_AGENT/1.2.0.yaml | 2 +- .../globals/PROFESSIONAL_CONTACT_FORM/1.0.0.yaml | 2 +- eveai_app/__init__.py | 1 - eveai_app/views/document_forms.py | 2 +- .../specialists/globals/RAG_SPECIALIST/1_2.py | 11 ++++++++++- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/common/utils/security_utils.py b/common/utils/security_utils.py index 68c1918..567112d 100644 --- a/common/utils/security_utils.py +++ b/common/utils/security_utils.py @@ -140,21 +140,17 @@ def enforce_tenant_consent_ui(): """Check if the user has consented to the terms of service""" path = getattr(request, 'path', '') or '' if path.startswith('/healthz') or path.startswith('/_healthz'): - current_app.logger.debug(f'Health check request, bypassing consent guard: {path}') return None if not current_user.is_authenticated: - current_app.logger.debug('Not authenticated, bypassing consent guard') return None endpoint = request.endpoint or '' if is_exempt_endpoint(endpoint) or request.method == 'OPTIONS': - current_app.logger.debug(f'Endpoint exempt from consent guard: {endpoint}') return None # Global bypass: Super User and Partner Admin always allowed if current_user.has_roles('Super User') or current_user.has_roles('Partner Admin'): - current_app.logger.debug('Global bypass: Super User or Partner Admin') return None tenant_id = getattr(current_user, 'tenant_id', None) @@ -176,16 +172,13 @@ def enforce_tenant_consent_ui(): status = ConsentStatus.NOT_CONSENTED if status == ConsentStatus.CONSENTED: - current_app.logger.debug('User has consented') return None if status == ConsentStatus.NOT_CONSENTED: - current_app.logger.debug('User has not consented') if current_user.has_roles('Tenant Admin'): return redirect(prefixed_url_for('user_bp.tenant_consent', for_redirect=True)) return redirect(prefixed_url_for('user_bp.no_consent', for_redirect=True)) if status == ConsentStatus.RENEWAL_REQUIRED: - current_app.logger.debug('Consent renewal required') if current_user.has_roles('Tenant Admin'): flash( "You need to renew your consent to our DPA or T&Cs. Failing to do so in time will stop you from accessing our services.", diff --git a/config/agents/globals/RAG_AGENT/1.2.0.yaml b/config/agents/globals/RAG_AGENT/1.2.0.yaml index da3a801..86d2d6a 100644 --- a/config/agents/globals/RAG_AGENT/1.2.0.yaml +++ b/config/agents/globals/RAG_AGENT/1.2.0.yaml @@ -1,4 +1,4 @@ -version: "1.1.0" +version: "1.2.0" name: "Rag Agent" role: > {tenant_name}'s Spokesperson. {custom_role} diff --git a/config/specialist_forms/globals/PROFESSIONAL_CONTACT_FORM/1.0.0.yaml b/config/specialist_forms/globals/PROFESSIONAL_CONTACT_FORM/1.0.0.yaml index b894cb3..d1c9409 100644 --- a/config/specialist_forms/globals/PROFESSIONAL_CONTACT_FORM/1.0.0.yaml +++ b/config/specialist_forms/globals/PROFESSIONAL_CONTACT_FORM/1.0.0.yaml @@ -11,7 +11,7 @@ fields: email: name: "Email" type: "str" - description: "Your Name" + description: "Your Email" required: true phone: name: "Phone Number" diff --git a/eveai_app/__init__.py b/eveai_app/__init__.py index 5bcacec..5f1bd73 100644 --- a/eveai_app/__init__.py +++ b/eveai_app/__init__.py @@ -113,7 +113,6 @@ def create_app(config_file=None): # Register global consent guard via extension @app.before_request def enforce_tenant_consent(): - app.logger.debug("Enforcing tenant consent") return enforce_tenant_consent_ui() # @app.before_request diff --git a/eveai_app/views/document_forms.py b/eveai_app/views/document_forms.py index 9c11cab..8d7de25 100644 --- a/eveai_app/views/document_forms.py +++ b/eveai_app/views/document_forms.py @@ -155,7 +155,7 @@ class EditRetrieverForm(DynamicFormBase): description = TextAreaField('Description', validators=[Optional()]) # Select Field for Retriever Type (Uses the RETRIEVER_TYPES defined in config) - type = StringField('Processor Type', validators=[DataRequired()], render_kw={'readonly': True}) + type = StringField('Retriever Type', validators=[DataRequired()], render_kw={'readonly': True}) type_version = StringField('Retriever Type Version', validators=[DataRequired()], render_kw={'readonly': True}) tuning = BooleanField('Enable Tuning', default=False) diff --git a/eveai_chat_workers/specialists/globals/RAG_SPECIALIST/1_2.py b/eveai_chat_workers/specialists/globals/RAG_SPECIALIST/1_2.py index 634e160..3392708 100644 --- a/eveai_chat_workers/specialists/globals/RAG_SPECIALIST/1_2.py +++ b/eveai_chat_workers/specialists/globals/RAG_SPECIALIST/1_2.py @@ -1,4 +1,5 @@ import json +import random from os import wait from typing import Optional, List, Dict, Any @@ -117,7 +118,7 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor): self.log_tuning("RAG Specialist rag_state execution started", {}) insufficient_info_message = TranslationServices.translate(self.tenant_id, - INSUFFICIENT_INFORMATION_MESSAGE, + random.choice(INSUFFICIENT_INFORMATION_MESSAGES), arguments.language) formatted_context, citations = self._retrieve_context(arguments) @@ -175,6 +176,14 @@ class RAGSpecialistInput(BaseModel): history: Optional[str] = Field(None, alias="history") name: Optional[str] = Field(None, alias="name") welcome_message: Optional[str] = Field(None, alias="welcome_message") + tone_of_voice: Optional[str] = Field(None, alias="tone_of_voice") + tone_of_voice_context: Optional[str] = Field(None, alias="tone_of_voice_context") + language_level: Optional[str] = Field(None, alias="language_level") + language_level_context: Optional[str] = Field(None, alias="language_level_context") + response_depth: Optional[str] = Field(None, alias="response_depth") + response_depth_context: Optional[str] = Field(None, alias="response_depth_context") + conversation_purpose: Optional[str] = Field(None, alias="conversation_purpose") + conversation_purpose_context: Optional[str] = Field(None, alias="conversation_purpose_context") class RAGSpecialistResult(SpecialistResult):