Notes
Notes mémorielles des agents IA via @ziwako/ai — CRUD.
La ressource Notes gère les notes mémorielles rattachées à un agent ou un workspace : elles permettent de conserver du contexte (préférences client, décisions, faits marquants) réutilisable par l'IA lors des générations.
- Factory :
getNotes()(@ziwako/ai/axios) - Types :
Note,NoteResponse,NoteListResponse,CreateNotesBody,UpdateNoteBody,ListNoteParams - Endpoints :
GET /notes,POST /notes,GET /notes/{id},DELETE /notes/{id},PATCH /notes/{id}
import { configure, getNotes } from '@ziwako/ai/axios';
configure({ accessToken: '...' });
const notes = getNotes();listNote
Liste paginée des notes.
Signature : listNote(params?: ListNoteParams) → Promise<NoteListResponse>
const list = await notes.listNote({ page: 1, limit: 20, filter: { agentId: agentId } });
console.log(list.data?.docs);import { useListNote } from '@ziwako/ai/react-query';
const { data } = useListNote({ page: 1, limit: 20 });createNotes
Crée une note. Le corps est requis.
Signature : createNotes(createNotesBody: CreateNotesBody) → Promise<NoteResponse>
const response = await notes.createNotes({
agentId: '64b8f2...',
title: 'Préférences du client X',
content: 'Le client préfère être contacté par email, jamais par téléphone.',
});
console.log(response.data?.id);import { useCreateNotes } from '@ziwako/ai/react-query';
const mutation = useCreateNotes();
mutation.mutate({
data: {
agentId: '64b8f2...',
title: 'Préférences du client X',
content: 'Le client préfère être contacté par email.',
},
});getNote
Récupère une note par son id.
Signature : getNote(id: string) → Promise<NoteResponse>
const response = await notes.getNote('64b8f2...');
console.log(response.data?.title);import { useGetNote } from '@ziwako/ai/react-query';
const { data } = useGetNote(noteId, { query: { enabled: !!noteId } });deleteNote
Supprime une note.
Signature : deleteNote(id: string) → Promise<DeleteNote200>
await notes.deleteNote(noteId);import { useDeleteNote } from '@ziwako/ai/react-query';
const mutation = useDeleteNote();
mutation.mutate({ id: noteId });updateNote
Met à jour une note.
Signature : updateNote(id: string, updateNoteBody: UpdateNoteBody) → Promise<NoteResponse>
await notes.updateNote(noteId, { content: 'Le client préfère WhatsApp.' });import { useUpdateNote } from '@ziwako/ai/react-query';
const mutation = useUpdateNote();
mutation.mutate({ id: noteId, data: { content: 'Le client préfère WhatsApp.' } });