diff --git a/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.2.0.yaml b/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.2.0.yaml index 2541004..99cd14f 100644 --- a/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.2.0.yaml +++ b/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.2.0.yaml @@ -11,9 +11,9 @@ arguments: type: "str" required: true specialist_name: - name: "Specialist Name" - description: "The name the specialist will be called upon" - type: str + name: "Chatbot Name" + description: "The name of the chatbot." + type: "str" required: true role_reference: name: "Role Reference" diff --git a/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.3.0.yaml b/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.3.0.yaml index c1e1d4d..5e36f75 100644 --- a/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.3.0.yaml +++ b/config/specialists/traicie/TRAICIE_ROLE_DEFINITION_SPECIALIST/1.3.0.yaml @@ -11,8 +11,8 @@ arguments: type: "str" required: true specialist_name: - name: "Specialist Name" - description: "The name the specialist will be called upon" + name: "Chatbot Name" + description: "The name of the chatbot." type: "str" required: true make: diff --git a/eveai_app/views/document_forms.py b/eveai_app/views/document_forms.py index ec2fa91..27eb73d 100644 --- a/eveai_app/views/document_forms.py +++ b/eveai_app/views/document_forms.py @@ -6,6 +6,7 @@ from wtforms.validators import DataRequired, Length, Optional, URL, ValidationEr from flask_wtf.file import FileField, FileRequired import json +from wtforms.widgets.core import HiddenInput from wtforms_sqlalchemy.fields import QuerySelectField from common.extensions import cache_manager @@ -20,11 +21,12 @@ from .dynamic_form_base import DynamicFormBase def validate_catalog_name(form, field): # Controleer of een catalog met deze naam al bestaat existing_catalog = Catalog.query.filter_by(name=field.data).first() - if existing_catalog: + if existing_catalog and (not hasattr(form, 'id') or form.id.data != existing_catalog.id): raise ValidationError(f'A Catalog with name "{field.data}" already exists. Choose another name.') class CatalogForm(FlaskForm): + id = IntegerField('ID', widget=HiddenInput()) name = StringField('Name', validators=[DataRequired(), Length(max=50), validate_catalog_name]) description = TextAreaField('Description', validators=[Optional()]) @@ -48,6 +50,7 @@ class CatalogForm(FlaskForm): class EditCatalogForm(DynamicFormBase): + id = IntegerField('ID', widget=HiddenInput()) name = StringField('Name', validators=[DataRequired(), Length(max=50), validate_catalog_name]) description = TextAreaField('Description', validators=[Optional()])