API finalised

This commit is contained in:
Cyber MacGeddon 2025-04-16 16:11:18 +01:00
parent 91d28e9d56
commit b94b4b7389
10 changed files with 87 additions and 133 deletions

View file

@ -59,7 +59,7 @@ class Processor(FlowProcessor):
print("Chunker initialised", flush=True)
async def on_message(self, msg, consumer):
async def on_message(self, msg, consumer, flow):
v = msg.value()
print(f"Chunking {v.metadata.id}...", flush=True)
@ -81,7 +81,7 @@ class Processor(FlowProcessor):
id=consumer.id, flow=consumer.flow
).observe(len(chunk.page_content))
await consumer.q["output"].send(r)
await flow.producer["output"].send(r)
print("Done.", flush=True)

View file

@ -58,7 +58,7 @@ class Processor(FlowProcessor):
print("Chunker initialised", flush=True)
async def on_message(self, msg, consumer):
async def on_message(self, msg, consumer, flow):
v = msg.value()
print(f"Chunking {v.metadata.id}...", flush=True)
@ -80,7 +80,7 @@ class Processor(FlowProcessor):
id=consumer.id, flow=consumer.flow
).observe(len(chunk.page_content))
await consumer.q["output"].send(r)
await flow.producer["output"].send(r)
print("Done.", flush=True)

View file

@ -74,6 +74,7 @@ class Processor(AsyncProcessor):
)
self.subs = self.subscribe(
flow = None,
queue = request_queue,
subscriber = subscriber,
schema = request_schema,
@ -105,7 +106,7 @@ class Processor(AsyncProcessor):
print("Pushed version ", self.config.version)
async def on_message(self, msg, consumer):
async def on_message(self, msg, consumer, flow):
try:

View file

@ -44,7 +44,7 @@ class Processor(FlowProcessor):
print("PDF inited", flush=True)
async def on_message(self, msg, consumer):
async def on_message(self, msg, consumer, flow):
print("PDF message received", flush=True)
@ -71,7 +71,7 @@ class Processor(FlowProcessor):
text=page.page_content.encode("utf-8"),
)
await consumer.q["output"].send(r)
await flow.producer["output"].send(r)
print("Done.", flush=True)