memory.ts 462 B

12345678910111213141516171819202122
  1. import api from './index'
  2. export interface MemoryEntry {
  3. date: string
  4. filename: string
  5. content: string
  6. preview: string
  7. }
  8. export interface MemoryListResponse {
  9. memories: MemoryEntry[]
  10. total: number
  11. }
  12. export const memoryApi = {
  13. list: async () => {
  14. return api.get<MemoryListResponse>('/memory/list')
  15. },
  16. get: async (filename: string) => {
  17. return api.get<{ filename: string; date: string; content: string }>(`/memory/${filename}`)
  18. },
  19. }