Remove deprecated methods from Media
- Remove deprecated constructor method Media(MimeType mimeType, URL url) from Media - Remove deprecated builder method data(URL url) from Media builder - Update references to use the builder and the data(URI) methods Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.ai.chat.memory.neo4j;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -282,12 +281,7 @@ public class Neo4jChatMemory implements ChatMemory {
|
||||
.id(Optional.ofNullable(mediaMap.get(MediaAttributes.ID.getValue())).map(Object::toString).orElse(null))
|
||||
.mimeType(MimeType.valueOf(mediaMap.get(MediaAttributes.MIME_TYPE.getValue()).toString()));
|
||||
if (mediaMap.get(MediaAttributes.DATA.getValue()) instanceof String stringData) {
|
||||
try {
|
||||
mediaBuilder.data(URI.create(stringData).toURL());
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Media data contains an invalid URL");
|
||||
}
|
||||
mediaBuilder.data(URI.create(stringData));
|
||||
}
|
||||
else if (mediaMap.get(MediaAttributes.DATA.getValue()).getClass().isArray()) {
|
||||
mediaBuilder.data(mediaMap.get(MediaAttributes.DATA.getValue()));
|
||||
|
||||
Reference in New Issue
Block a user