feat: plan deterministic generated conversations
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class_name ConversationIntentDefinition
|
||||
extends Resource
|
||||
|
||||
@export var intent_id: StringName
|
||||
@export var response_intent_ids: Array[StringName] = []
|
||||
|
||||
|
||||
func validate() -> Array[String]:
|
||||
var errors: Array[String] = []
|
||||
if not ConversationSemantic.is_valid_id(intent_id):
|
||||
errors.append("intent_id is invalid")
|
||||
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
|
||||
Reference in New Issue
Block a user