NIMSDK-AOS  9.21.10
NIMAIRAGInfo.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.ai.model;
2 
3 import com.netease.nimlib.log.NimLog;
4 import com.netease.nimlib.util.EncryptUtil;
5 import java.io.Serializable;
6 import java.util.Objects;
7 
8 /**
9  * NIMAIRAGInfo类
10  * <p>
11  * 用于表示RAG(检索增强生成)信息,存储与引用资源相关的数据。
12  * </p>
13  *
14  * @author jintao
15  * @version 1.0
16  */
17 public class NIMAIRAGInfo implements Serializable {
18 
19  private String name = "";
20 
21  private String icon = "";
22 
23  /**
24  * 引用资源的标题
25  * <p>
26  * 该字段存储引用资源的标题信息,必须存在。
27  * </p>
28  */
29  private String title = "";
30 
31  /**
32  * 引用资源的描述
33  * <p>
34  * 该字段存储引用资源的描述信息,必须存在。
35  * 默认值为空字符串("")。
36  * </p>
37  */
38  private String description = "";
39 
40  /**
41  * 引用资源的时间戳
42  * <p>
43  * 该字段表示引用资源的时间信息,以毫秒为单位,必须存在。
44  * </p>
45  */
46  private long time = 0L;
47 
48  /**
49  * 引用资源的URL链接
50  * <p>
51  * 该字段存储引用资源的网络地址,必须存在。
52  * </p>
53  */
54  private String url = "";
55 
56  /**
57  * 默认构造函数
58  */
59  private NIMAIRAGInfo() {
60  }
61 
62  /**
63  * 完整参数构造函数
64  *
65  * @param name rag的名称
66  * @param icon rag的icon
67  * @param title 引用资源的标题
68  * @param description 引用资源的描述
69  * @param time 引用资源的时间戳
70  * @param url 引用资源的URL链接
71  */
72  public NIMAIRAGInfo(String name,String icon,String title, String description, long time, String url) {
73  this.name = name;
74  this.icon = icon;
75  this.title = title;
76  this.description = description;
77  this.time = time;
78  this.url = url;
79  }
80  /**
81  * 获取rag的名称
82  *
83  * @return rag的名称
84  */
85  public String getName() {
86  return name;
87  }
88 
89  /**
90  * 获取rag的icon
91  * @return rag的icon
92  */
93  public String getIcon() {
94  return icon;
95  }
96 
97  /**
98  * 获取引用资源的标题
99  *
100  * @return 引用资源的标题
101  */
102  public String getTitle() {
103  return title;
104  }
105 
106  /**
107  * 获取引用资源的描述
108  *
109  * @return 引用资源的描述
110  */
111  public String getDescription() {
112  return description;
113  }
114 
115  /**
116  * 获取引用资源的时间戳
117  *
118  * @return 引用资源的时间戳
119  */
120  public long getTime() {
121  return time;
122  }
123 
124  /**
125  * 获取引用资源的URL链接
126  *
127  * @return 引用资源的URL链接
128  */
129  public String getUrl() {
130  return url;
131  }
132 
133  @Override
134  public boolean equals(Object o) {
135  if (!(o instanceof NIMAIRAGInfo)) {
136  return false;
137  }
138  NIMAIRAGInfo that = (NIMAIRAGInfo) o;
139  return time == that.time && Objects.equals(name, that.name) && Objects.equals(icon, that.icon) && Objects.equals(title, that.title)
140  && Objects.equals(description, that.description) && Objects.equals(url, that.url);
141  }
142 
143  @Override
144  public int hashCode() {
145  return Objects.hash(name, icon, title, description, time, url);
146  }
147 
148  /**
149  * 重写toString方法,用于调试和日志输出
150  *
151  * @return 对象的字符串表示形式
152  */
153  @Override
154  public String toString() {
155  if(NimLog.isDebugLog()){
156  return "NIMAIRAGInfo{" +
157  "name='" + name + '\'' +
158  ", icon='" + icon + '\'' +
159  ", title='" + title + '\'' +
160  ", description='" + description + '\'' +
161  ", time=" + time +
162  ", url='" + url + '\'' +
163  '}';
164  }else{
165  return "NIMAIRAGInfo{" +
166  "name='" + EncryptUtil.encryptBase64(name) + '\'' +
167  ", icon='" + EncryptUtil.encryptBase64(icon) + '\'' +
168  ", title='" + EncryptUtil.encryptBase64(title) + '\'' +
169  ", description='" + EncryptUtil.encryptBase64(description) + '\'' +
170  ", time=" + time +
171  ", url='" + EncryptUtil.encryptBase64(url) + '\'' +
172  '}';
173  }
174 
175  }
176 }
String toString()
重写toString方法,用于调试和日志输出
String getDescription()
获取引用资源的描述
String getTitle()
获取引用资源的标题
String getUrl()
获取引用资源的URL链接
long getTime()
获取引用资源的时间戳
NIMAIRAGInfo(String name, String icon, String title, String description, long time, String url)
完整参数构造函数