Working on librarian flow

This commit is contained in:
Cyber MacGeddon 2025-05-04 19:17:46 +01:00
parent bae112ee99
commit 385b02021f
8 changed files with 106 additions and 87 deletions

View file

@ -4,6 +4,7 @@ import requests
import json
import sys
import base64
import time
url = "http://localhost:8088/api/v1/"
@ -11,13 +12,17 @@ url = "http://localhost:8088/api/v1/"
id = "http://trustgraph.ai/doc/12345678"
with open("docs/README.cats") as f:
doc = base64.b64encode(f.read().encode("utf-8")).decode("utf-8")
with open("docs/README.cats", "rb") as f:
doc = base64.b64encode(f.read()).decode("utf-8")
input = {
"operation": "add",
"document": {
"operation": "add-document",
"document-metadata": {
"id": id,
"time": int(time.time()),
"kind": "text/plain",
"title": "Mark's cats",
"comments": "Test doc taken from the TrustGraph repo",
"metadata": [
{
"s": {
@ -46,13 +51,10 @@ input = {
},
},
],
"document": doc,
"kind": "text/plain",
"user": "trustgraph",
"collection": "default",
"title": "Mark's cats",
"comments": "Test doc taken from the TrustGraph repo",
}
"tags": ["mark", "cats"],
},
"content": doc,
}
resp = requests.post(

View file

@ -4,6 +4,7 @@ import requests
import json
import sys
import base64
import time
url = "http://localhost:8088/api/v1/"
@ -17,9 +18,13 @@ with open(source, "rb") as f:
doc = base64.b64encode(f.read()).decode("utf-8")
input = {
"operation": "add",
"id": id,
"document": {
"operation": "add-document",
"document-metadata": {
"id": id,
"time": int(time.time()),
"kind": "application/pdf",
"title": "Application of SAE ARP4754A to Flight Critical Systems",
"comments": "Application of federal safety standards to NASA spacecraft",
"metadata": [
{
"s": {
@ -61,11 +66,10 @@ input = {
},
},
],
"document": doc,
"kind": "application/pdf",
"user": "trustgraph",
"collection": "default",
}
"tags": ["nasa", "safety-engineering"],
},
"content": doc,
}
resp = requests.post(