class_name ConversationIntentDefinition extends Resource @export var intent_id: StringName @export var response_intent_ids: Array[StringName] = [] @export var template_catalog_id: StringName func validate() -> Array[String]: var errors: Array[String] = [] if not ConversationSemantic.is_valid_id(intent_id): errors.append("intent_id is invalid") if template_catalog_id.is_empty(): errors.append("template_catalog_id is empty for '%s'" % intent_id) var seen: Dictionary = {} for response_intent_id in response_intent_ids: if not ConversationSemantic.is_valid_id(response_intent_id): errors.append("response intent ID is invalid for '%s'" % intent_id) elif seen.has(response_intent_id): errors.append( "duplicate response intent '%s' for '%s'" % [response_intent_id, intent_id] ) else: seen[response_intent_id] = true return errors func duplicate_definition() -> ConversationIntentDefinition: var copy := ConversationIntentDefinition.new() copy.intent_id = intent_id copy.response_intent_ids = response_intent_ids.duplicate() copy.template_catalog_id = template_catalog_id return copy