mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-20 02:31:02 +02:00
Fix invalid variable name invocation
This commit is contained in:
parent
21e7b856c4
commit
4672c6a0c7
1 changed files with 7 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from .. schema import Document
|
from .. schema import Document, Metadata
|
||||||
from .. schema import document_ingest_queue
|
from .. schema import document_ingest_queue
|
||||||
|
|
||||||
from . sender import ServiceSender
|
from . sender import ServiceSender
|
||||||
|
|
@ -18,25 +18,24 @@ class DocumentLoadSender(ServiceSender):
|
||||||
|
|
||||||
def to_request(self, body):
|
def to_request(self, body):
|
||||||
|
|
||||||
if "metadata" in data:
|
if "metadata" in body:
|
||||||
metadata = to_subgraph(data["metadata"])
|
metadata = to_subgraph(body["metadata"])
|
||||||
else:
|
else:
|
||||||
metadata = []
|
metadata = []
|
||||||
|
|
||||||
# Doing a base64 decoe/encode here to make sure the
|
# Doing a base64 decoe/encode here to make sure the
|
||||||
# content is valid base64
|
# content is valid base64
|
||||||
doc = base64.b64decode(data["data"])
|
doc = base64.b64decode(body["data"])
|
||||||
|
|
||||||
print("Document received")
|
print("Document received")
|
||||||
|
|
||||||
return Document(
|
return Document(
|
||||||
metadata=Metadata(
|
metadata=Metadata(
|
||||||
id=data.get("id"),
|
id=body.get("id"),
|
||||||
metadata=metadata,
|
metadata=metadata,
|
||||||
user=data.get("user", "trustgraph"),
|
user=body.get("user", "trustgraph"),
|
||||||
collection=data.get("collection", "default"),
|
collection=body.get("collection", "default"),
|
||||||
),
|
),
|
||||||
data=base64.b64encode(doc).decode("utf-8")
|
data=base64.b64encode(doc).decode("utf-8")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue