1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.llm;
17
18 /**
19 * Represents the intent type detected from a user's chat message.
20 */
21 public enum ChatIntent {
22
23 /** User wants to search for documents in Fess */
24 SEARCH("search"),
25
26 /** User wants a summary of a specific document */
27 SUMMARY("summary"),
28
29 /** User is asking a FAQ-type question */
30 FAQ("faq"),
31
32 /** Intent is unclear - need to ask user for clarification */
33 UNCLEAR("unclear");
34
35 private final String value;
36
37 ChatIntent(final String value) {
38 this.value = value;
39 }
40
41 /**
42 * Returns the string value of this intent.
43 *
44 * @return the intent value
45 */
46 public String getValue() {
47 return value;
48 }
49
50 /**
51 * Parses a string value to ChatIntent enum.
52 *
53 * @param value the string value to parse
54 * @return the corresponding ChatIntent, defaults to UNCLEAR if not found
55 */
56 public static ChatIntent fromValue(final String value) {
57 if (value == null) {
58 return UNCLEAR;
59 }
60 for (final ChatIntent intent : values()) {
61 if (intent.value.equalsIgnoreCase(value.trim())) {
62 return intent;
63 }
64 }
65 return UNCLEAR;
66 }
67 }