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