Skip to content

Commit 4e76d29

Browse files
committed
some rfks and logs
1 parent 68d5659 commit 4e76d29

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

src/commands/coordinator.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,21 @@ pub async fn run_oracle(
9292
}
9393

9494
// handle new tasks with subscription
95-
let event_poller = node
96-
.subscribe_to_tasks()
97-
.await
98-
.wrap_err("could not subscribe to tasks")?;
9995
log::info!(
100-
"Subscribed to LLMOracleCoordinator ({}) as {}",
96+
"Subscribing to LLMOracleCoordinator ({}) as {}",
10197
node.addresses.coordinator,
10298
kinds
10399
.iter()
104100
.map(|kind| kind.to_string())
105101
.collect::<Vec<String>>()
106102
.join(", ")
107103
);
104+
let event_poller = node
105+
.subscribe_to_tasks()
106+
.await
107+
.wrap_err("could not subscribe to tasks")?;
108108

109+
log::info!("Listening for events...");
109110
event_poller
110111
.into_stream()
111112
.for_each(|log| async {

src/compute/workflows/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
mod chat;
21
mod postprocess;
32

4-
mod request;
5-
pub use request::Request;
3+
mod presets;
4+
5+
mod requests;
6+
pub use requests::Request;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use dkn_workflows::Workflow;
2+
use lazy_static::lazy_static;
3+
4+
lazy_static! {
5+
pub static ref GENERATION_WORKFLOW: Workflow = {
6+
serde_json::from_str(include_str!("generation.json"))
7+
.expect("could not parse generation workflow")
8+
};
9+
}
File renamed without changes.

src/compute/workflows/request.rs renamed to src/compute/workflows/requests/mod.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
use alloy::primitives::{Bytes, U256};
22
use dkn_workflows::{Entry, Executor, Model, ProgramMemory, Workflow};
33
use eyre::{eyre, Context, Result};
4-
use lazy_static::lazy_static;
54

6-
use super::{chat::*, postprocess::*};
5+
mod chat;
6+
use chat::*;
7+
8+
use super::{postprocess::*, presets::GENERATION_WORKFLOW};
79
use crate::{
810
bytes_to_string,
911
data::{Arweave, OracleExternalData},
1012
DriaOracle,
1113
};
1214

13-
lazy_static! {
14-
static ref GENERATION_WORKFLOW: Workflow = {
15-
serde_json::from_str(include_str!("presets/generation.json"))
16-
.expect("could not parse generation workflow")
17-
};
18-
}
19-
2015
/// An oracle request.
2116
#[derive(Debug)]
2217
pub enum Request {
@@ -53,13 +48,15 @@ impl Request {
5348
.execute(None, workflow, &mut memory)
5449
.await
5550
.wrap_err("could not execute worfklow input"),
51+
5652
Self::String(input) => {
5753
let entry = Entry::String(input.clone());
5854
executor
5955
.execute(Some(&entry), &GENERATION_WORKFLOW, &mut memory)
6056
.await
6157
.wrap_err("could not execute worfklow for string input")
6258
}
59+
6360
Self::ChatHistory(chat_history) => {
6461
if let Some(node) = node {
6562
// if task id is zero, there is no prior history
@@ -170,7 +167,7 @@ mod tests {
170167

171168
#[tokio::test]
172169
async fn test_parse_input_workflow() {
173-
let workflow_str = include_str!("presets/generation.json");
170+
let workflow_str = include_str!("../presets/generation.json");
174171
let expected_workflow = serde_json::from_str::<Workflow>(&workflow_str).unwrap();
175172

176173
let entry = Request::try_parse_bytes(&workflow_str.as_bytes().into()).await;

0 commit comments

Comments
 (0)