Skip to content

feat(document-analysis): use separate APIs for document actions

zakariae yahya a demandé de fusionner feauture/anir-integration vers develop

Summary

  • Refactored document action system to use dedicated API endpoints
  • Document actions (compare, summarize, analyze) now call separate APIs instead of sending everything through the chat messages endpoint
  • Frontend sends indexed document IDs, backend retrieves content from database

Changes

Store (document-analysis-store.ts)

  • Added DocumentActionRequest interface
  • Added compareIndexedDocuments() -> POST /chat/actions/compare
  • Added summarizeIndexedDocument() -> POST /chat/actions/summarize
  • Added analyzeIndexedDocument() -> POST /chat/actions/analyze
  • Added addLocalMessages() for displaying results in chat

Components

  • NewChatInterface.tsx: Modified handleModalSubmit to call appropriate APIs
  • view.tsx: Added onActionResult callback handling
  • DocumentActionModal.tsx: Fixed TypeScript type errors

Hook (use-document-analysis-chat.ts)

  • Added addActionMessages() function
  • Fixed Message type to include 'audio'

API Format

// POST /chat/actions/compare
{ "document_ids": ["uuid-1", "uuid-2"], "query": "..." }

// POST /chat/actions/summarize
{ "document_id": "uuid-1", "options": ["short"] }

// POST /chat/actions/analyze
{ "document_id": "uuid-1", "query": "..." }

Rapports de requête de fusion