changed variable name
This commit is contained in:
@@ -21,17 +21,16 @@ public class EmbeddingService {
|
|||||||
this.vectorStore = vectorStore;
|
this.vectorStore = vectorStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void vectorizeData(List<ServiceItem> responses, ServiceType serviceType,
|
public void vectorizeData(List<ServiceItem> items, ServiceType serviceType, Long connectionId) {
|
||||||
Long connectionId) {
|
|
||||||
|
|
||||||
List<Document> mappedResponse = new ArrayList<>();
|
List<Document> mappedResponse = new ArrayList<>();
|
||||||
|
|
||||||
for (ServiceItem response : responses) {
|
for (ServiceItem item : items) {
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder();
|
StringBuilder data = new StringBuilder();
|
||||||
|
|
||||||
if (response.extraData() != null) {
|
if (item.extraData() != null) {
|
||||||
for (Map.Entry<String, Object> entry : response.extraData().entrySet()) {
|
for (Map.Entry<String, Object> entry : item.extraData().entrySet()) {
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
data.append(" \n");
|
data.append(" \n");
|
||||||
}
|
}
|
||||||
@@ -44,15 +43,13 @@ public class EmbeddingService {
|
|||||||
Map<String, Object> metadata = new HashMap<>();
|
Map<String, Object> metadata = new HashMap<>();
|
||||||
metadata.put("connectionId", connectionId);
|
metadata.put("connectionId", connectionId);
|
||||||
metadata.put("serviceType", serviceType.name());
|
metadata.put("serviceType", serviceType.name());
|
||||||
metadata.put("id", response.id());
|
metadata.put("itemId", item.id());
|
||||||
metadata.put("title", response.title());
|
metadata.put("title", item.title());
|
||||||
metadata.put("description", response.description());
|
metadata.put("description", item.description());
|
||||||
metadata.put("extraData", data.toString());
|
metadata.put("extraData", data.toString());
|
||||||
|
|
||||||
mappedResponse.add(new Document(connectionId + ":" + response.id(), "Title: "
|
mappedResponse.add(new Document(connectionId + ":" + item.id(), "Title: " + item.title()
|
||||||
+ response.title()
|
+ (item.description() != null ? "\n Description: " + item.description() : "")
|
||||||
+ (response.description() != null ? "\n Description: " + response.description()
|
|
||||||
: "")
|
|
||||||
+ (!data.isEmpty() ? "\n Extradata: " + data.toString() : ""), metadata));
|
+ (!data.isEmpty() ? "\n Extradata: " + data.toString() : ""), metadata));
|
||||||
}
|
}
|
||||||
vectorStore.add(mappedResponse);
|
vectorStore.add(mappedResponse);
|
||||||
|
|||||||
Reference in New Issue
Block a user