diff --git a/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleSourceEnum.java b/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleSourceEnum.java index 388640f423..877da17bab 100644 --- a/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleSourceEnum.java +++ b/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleSourceEnum.java @@ -23,4 +23,14 @@ public enum ChatRoleSourceEnum { private String type; private String name; + + + public static ChatRoleSourceEnum valueOfType(String type) { + for (ChatRoleSourceEnum itemEnum : ChatRoleSourceEnum.values()) { + if (itemEnum.getType().equals(type)) { + return itemEnum; + } + } + throw new IllegalArgumentException("Invalid MessageType value: " + type); + } } diff --git a/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleVisibilityEnum.java b/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleVisibilityEnum.java index eef31935a1..c8b09aedbe 100644 --- a/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleVisibilityEnum.java +++ b/yudao-module-ai/yudao-module-ai-api/src/main/java/cn/iocoder/yudao/module/ai/enums/ChatRoleVisibilityEnum.java @@ -22,4 +22,15 @@ public enum ChatRoleVisibilityEnum { private String type; private String name; + + + public static ChatRoleVisibilityEnum valueOfType(String type) { + for (ChatRoleVisibilityEnum itemEnum : ChatRoleVisibilityEnum.values()) { + if (itemEnum.getType().equals(type)) { + return itemEnum; + } + } + throw new IllegalArgumentException("Invalid MessageType value: " + type); + } + }