From 157fbfe29ba98c9fc3474e5d1c08c406e75afc36 Mon Sep 17 00:00:00 2001 From: Eric BREHAULT Date: Thu, 18 Jan 2024 12:01:54 +0100 Subject: [PATCH] Allow to set remote files field at creation --- CHANGELOG.md | 2 +- docs/03-kb.md | 2 ++ nuclia/sdk/resource.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b2d88..02f8eb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 1.2.4 (unreleased) -- Nothing changed yet. +- Allow to set remote files field at creation ## 1.2.3 (2024-01-16) diff --git a/docs/03-kb.md b/docs/03-kb.md index 541c9fe..57b0302 100644 --- a/docs/03-kb.md +++ b/docs/03-kb.md @@ -69,6 +69,7 @@ You can also set the contents of the resource, as fields: - Text fields in `texts` - Link fields in `links` - Conversation fields in `conversations` +- File fields in `files` if they are provided as an URI (passing a binary file is not supported, you need to use the [`upload` command](./04-upload.md)). Note: you cannot set File fields when creating a resource, you need to use the [`upload` command](./04-upload.md). @@ -80,6 +81,7 @@ Examples: nuclia kb resource create --slug=my-resource nuclia kb resource create --origin='{"collaborators":["THE_AUTHOR"]}' --usermetadata='{"classifications": [{"labelset": "SOME_CATEGORY", "label": "SOME_VALUE"}]}' nuclia kb resource create --texts='{"chapter-1": {"body": "here is a test", "format": "PLAIN"}' + nuclia kb resource create --files='{"chapter-1": {"file": {"uri": "https://somewhere.com/file.pdf", "filename": "file.pdf", "contenttype": "application/pdf"}}}' ``` IMPORTANT: when using the CLI on Windows, you need to escape the double quotes in the JSON strings, like: diff --git a/nuclia/sdk/resource.py b/nuclia/sdk/resource.py index e173be1..fb7a9b3 100644 --- a/nuclia/sdk/resource.py +++ b/nuclia/sdk/resource.py @@ -15,6 +15,7 @@ "conversations", "links", "texts", + "files", "usermetadata", "fieldmetadata", "title",