-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: address stable diffusion events (#76)
* first commit * resolve a set of bugs for stable diffusion * fmt * remove unnecessary print lines, and improve code readability * address PR comments
- Loading branch information
1 parent
9d740f8
commit dd7829d
Showing
6 changed files
with
193 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,50 @@ | ||
use std::str::FromStr; | ||
|
||
use subscriber::SuiSubscriberError; | ||
|
||
pub mod config; | ||
pub mod subscriber; | ||
|
||
pub enum AtomaEvent { | ||
DisputeEvent, | ||
FirstSubmissionEvent, | ||
NewlySampledNodesEvent, | ||
NodeRegisteredEvent, | ||
NodeSubscribedToModelEvent, | ||
SettledEvent, | ||
Text2ImagePromptEvent, | ||
Text2TextPromptEvent, | ||
} | ||
|
||
impl FromStr for AtomaEvent { | ||
type Err = SuiSubscriberError; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
"DisputeEvent" => Ok(Self::DisputeEvent), | ||
"FirstSubmissionEvent" => Ok(Self::FirstSubmissionEvent), | ||
"NewlySampledNodesEvent" => Ok(Self::NewlySampledNodesEvent), | ||
"NodeRegisteredEvent" => Ok(Self::NodeRegisteredEvent), | ||
"NodeSubscribedToModelEvent" => Ok(Self::NodeSubscribedToModelEvent), | ||
"SettledEvent" => Ok(Self::SettledEvent), | ||
"Text2ImagePromptEvent" => Ok(Self::Text2ImagePromptEvent), | ||
"Text2TextPromptEvent" => Ok(Self::Text2TextPromptEvent), | ||
_ => panic!("Invalid `AtomaEvent` string"), | ||
} | ||
} | ||
} | ||
|
||
impl ToString for AtomaEvent { | ||
fn to_string(&self) -> String { | ||
match self { | ||
Self::DisputeEvent => "DisputeEvent".into(), | ||
Self::FirstSubmissionEvent => "FirstSubmissionEvent".into(), | ||
Self::NewlySampledNodesEvent => "NewlySampledNodesEvent".into(), | ||
Self::NodeRegisteredEvent => "NodeRegisteredEvent".into(), | ||
Self::NodeSubscribedToModelEvent => "NodeSubscribedToModelEvent".into(), | ||
Self::SettledEvent => "SettledEvent".into(), | ||
Self::Text2ImagePromptEvent => "Text2ImagePromptEvent".into(), | ||
Self::Text2TextPromptEvent => "Text2TextPromptEvent".into(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.