shawnmclean/sovoli

Update Knowledge API

Closed this issue · 1 comments

Sometimes ChatGPT will not do a good job on the first pass.

So we need to provide it with an update ability.

Spec

Update Endpoint (PUT /knowledge/
Method: PUT
Endpoint: /knowledge/:knowledgeId
Purpose: This endpoint is used to update an existing knowledge entry and its associated connections.
Request Body (Update)

{
  "title": "Updated Collection of Science Books",  // Updated title
  "description": "An updated list of books on physics, biology, and astronomy.",
  "content": "This collection includes updated insights on various fields of science.",
  "connections": [
    {
      "connectionId": "conn1",  // Use the connectionId to identify the connection being updated
      "notes": "Updated notes on modern physics and quantum mechanics.",
      "order": 1,  // Reordering connections
      "targetKnowledge": {
        "query": "A Brief History of Time Stephen Hawking",
        "type": "Book"
      }
    }
  ],
  "removeConnections": [
    {
      "connectionId": "conn2"  // Remove a connection using connectionId
    }
  ]
}

Errors (Update)
400 Bad Request: Missing or invalid required fields in the request body.
404 Not Found: The specified knowledgeId or connectionId does not exist.
409 Conflict: Conflict when updating a resource (e.g., duplicate entries).

Questions

How to ensure that only the chat session can update the knowledge created in that session?

This is mostly finished, need to implement order in the connections.

Everything else works.