feat(platform-service): allow memory-items to store blob media refs
This commit is contained in:
parent
759fd78f3e
commit
e64bba258f
@ -40,6 +40,21 @@ describe('CreateMemoryItemSchema', () => {
|
|||||||
expect(result.data.captureSurface).toBe('app');
|
expect(result.data.captureSurface).toBe('app');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('accepts media refs', () => {
|
||||||
|
const result = CreateMemoryItemSchema.safeParse({
|
||||||
|
rawContent: 'voice transcript',
|
||||||
|
sourceType: 'voice',
|
||||||
|
media: {
|
||||||
|
audio: {
|
||||||
|
container: 'audio',
|
||||||
|
blobName: 'lysnrai/usr_1/audio/test.caf',
|
||||||
|
contentType: 'audio/x-caf',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(result.success).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ReassignMemoryItemSchema', () => {
|
describe('ReassignMemoryItemSchema', () => {
|
||||||
@ -60,4 +75,3 @@ describe('PatchMemoryItemSchema', () => {
|
|||||||
expect(result.success).toBe(false);
|
expect(result.success).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,7 @@ export async function memoryRoutes(app: FastifyInstance) {
|
|||||||
rawContent: input.rawContent,
|
rawContent: input.rawContent,
|
||||||
triageResult: triage,
|
triageResult: triage,
|
||||||
brainIds,
|
brainIds,
|
||||||
|
...(input.media && { media: input.media }),
|
||||||
...(input.reminderAt && { reminderAt: input.reminderAt }),
|
...(input.reminderAt && { reminderAt: input.reminderAt }),
|
||||||
actedOn: false,
|
actedOn: false,
|
||||||
actedOnAt: null,
|
actedOnAt: null,
|
||||||
|
|||||||
@ -33,6 +33,18 @@ export const TriageResultSchema = z.object({
|
|||||||
suggestedActions: z.array(z.string().min(1).max(256)).default([]),
|
suggestedActions: z.array(z.string().min(1).max(256)).default([]),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const BlobRefSchema = z.object({
|
||||||
|
container: z.string().min(1).max(64),
|
||||||
|
blobName: z.string().min(1).max(1024),
|
||||||
|
contentType: z.string().min(1).max(128).optional(),
|
||||||
|
size: z.number().int().min(0).optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const MediaRefsSchema = z.object({
|
||||||
|
audio: BlobRefSchema.optional(),
|
||||||
|
image: BlobRefSchema.optional(),
|
||||||
|
});
|
||||||
|
|
||||||
export const ListMemoryItemsQuerySchema = z.object({
|
export const ListMemoryItemsQuerySchema = z.object({
|
||||||
productId: z.string().min(1).max(64).optional(),
|
productId: z.string().min(1).max(64).optional(),
|
||||||
brainId: z.string().min(1).max(128).optional(),
|
brainId: z.string().min(1).max(128).optional(),
|
||||||
@ -48,6 +60,7 @@ export const CreateMemoryItemSchema = z.object({
|
|||||||
rawContent: z.string().min(1).max(50_000),
|
rawContent: z.string().min(1).max(50_000),
|
||||||
triageResult: TriageResultSchema.optional(),
|
triageResult: TriageResultSchema.optional(),
|
||||||
brainIds: z.array(z.string().min(1).max(128)).optional(),
|
brainIds: z.array(z.string().min(1).max(128)).optional(),
|
||||||
|
media: MediaRefsSchema.optional(),
|
||||||
isSensitive: z.boolean().optional(),
|
isSensitive: z.boolean().optional(),
|
||||||
reminderAt: z
|
reminderAt: z
|
||||||
.string()
|
.string()
|
||||||
@ -68,6 +81,8 @@ export const PatchMemoryItemSchema = z.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export type TriageResult = z.infer<typeof TriageResultSchema>;
|
export type TriageResult = z.infer<typeof TriageResultSchema>;
|
||||||
|
export type BlobRef = z.infer<typeof BlobRefSchema>;
|
||||||
|
export type MediaRefs = z.infer<typeof MediaRefsSchema>;
|
||||||
|
|
||||||
export type MemoryItemDoc = {
|
export type MemoryItemDoc = {
|
||||||
id: string;
|
id: string;
|
||||||
@ -78,6 +93,7 @@ export type MemoryItemDoc = {
|
|||||||
rawContent: string;
|
rawContent: string;
|
||||||
triageResult: TriageResult;
|
triageResult: TriageResult;
|
||||||
brainIds: string[];
|
brainIds: string[];
|
||||||
|
media?: MediaRefs;
|
||||||
reminderAt?: string;
|
reminderAt?: string;
|
||||||
actedOn: boolean;
|
actedOn: boolean;
|
||||||
actedOnAt: string | null;
|
actedOnAt: string | null;
|
||||||
@ -87,4 +103,3 @@ export type MemoryItemDoc = {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user