Skip to content

Commit 515196e

Browse files
committed
feat: add H2 database configuration and update MemoryItem to ignore embedding property in JSON serialization
1 parent 0637bef commit 515196e

26 files changed

+13
-3705
lines changed

example-usage/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
<artifactId>mem4j-spring-boot-starter</artifactId>
3535
<version>0.1.0</version>
3636
</dependency>
37+
<dependency>
38+
<groupId>com.h2database</groupId>
39+
<artifactId>h2</artifactId>
40+
<version>2.3.232</version>
41+
<scope>compile</scope>
42+
</dependency>
3743
</dependencies>
3844

3945
<build>

example-usage/src/main/resources/application.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ spring:
77
ai:
88
dashscope:
99
api-key: ${DASHSCOPE_API_KEY:test-key}
10-
10+
datasource:
11+
url: jdbc:h2:mem:memdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
12+
driver-class-name: org.h2.Driver
13+
username: sa
14+
password: sa
1115
# Mem4j Configuration
1216
mem4j:
1317
# 使用内存向量存储(适合演示)

mem4j-core/src/main/java/com/github/mem4j/memory/MemoryItem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.github.mem4j.memory;
1818

19+
import com.fasterxml.jackson.annotation.JsonIgnore;
1920
import com.fasterxml.jackson.annotation.JsonProperty;
2021

2122
import java.time.Instant;
@@ -55,7 +56,7 @@ public class MemoryItem {
5556
@JsonProperty("updated_at")
5657
private Instant updatedAt;
5758

58-
@JsonProperty("embedding")
59+
@JsonIgnore
5960
private Double[] embedding;
6061

6162
public MemoryItem() {

src/main/java/com/github/mem4j/Mem4jApplication.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/main/java/com/github/mem4j/autoconfigure/MemoryAutoConfiguration.java

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)