Memory: add configurable FTS5 tokenizer for CJK text support (openclaw#56707)

Verified:
- pnpm build
- pnpm check
- pnpm test -- extensions/memory-core/src/memory/manager-search.test.ts packages/memory-host-sdk/src/host/query-expansion.test.ts
- pnpm test -- extensions/memory-core/src/memory/index.test.ts -t "reindexes when extraPaths change"
- pnpm test -- src/config/schema.base.generated.test.ts
- pnpm test -- src/media-understanding/image.test.ts
- pnpm test

Co-authored-by: Mitsuyuki Osabe <24588751+carrotRakko@users.noreply.github.com>
This commit is contained in:
Tak Hoffman
2026-03-28 20:53:29 -05:00
committed by GitHub
parent 6f7ff545dd
commit 3ce48aff66
12 changed files with 310 additions and 24 deletions

View File

@@ -2033,6 +2033,24 @@ export const GENERATED_BASE_CONFIG_SCHEMA = {
path: {
type: "string",
},
fts: {
type: "object",
properties: {
tokenizer: {
anyOf: [
{
type: "string",
const: "unicode61",
},
{
type: "string",
const: "trigram",
},
],
},
},
additionalProperties: false,
},
vector: {
type: "object",
properties: {
@@ -3596,6 +3614,24 @@ export const GENERATED_BASE_CONFIG_SCHEMA = {
path: {
type: "string",
},
fts: {
type: "object",
properties: {
tokenizer: {
anyOf: [
{
type: "string",
const: "unicode61",
},
{
type: "string",
const: "trigram",
},
],
},
},
additionalProperties: false,
},
vector: {
type: "object",
properties: {

View File

@@ -379,6 +379,10 @@ export type MemorySearchConfig = {
store?: {
driver?: "sqlite";
path?: string;
fts?: {
/** FTS5 tokenizer (default: "unicode61"). Use "trigram" for CJK text support. */
tokenizer?: "unicode61" | "trigram";
};
vector?: {
/** Enable sqlite-vec extension for vector search (default: true). */
enabled?: boolean;

View File

@@ -653,6 +653,12 @@ export const MemorySearchSchema = z
.object({
driver: z.literal("sqlite").optional(),
path: z.string().optional(),
fts: z
.object({
tokenizer: z.union([z.literal("unicode61"), z.literal("trigram")]).optional(),
})
.strict()
.optional(),
vector: z
.object({
enabled: z.boolean().optional(),