Refactor agent function names and streamline imports
Unified the naming convention for agent functions across modules to `agent` for consistency. Adjusted relevant imports and cleaned up unused imports in `webhooks.rs` to improve readability and maintainability.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::utils::utils::run_agent;
|
||||
use tokio::process::Child;
|
||||
|
||||
pub async fn image_generator(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
pub async fn agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
tracing::debug!(
|
||||
"Running image generator, \ninput: {}",
|
||||
input
|
||||
|
@@ -1,4 +1,4 @@
|
||||
pub mod news;
|
||||
pub mod scrape;
|
||||
pub mod search;
|
||||
pub mod image_generator;
|
||||
pub(crate) mod news;
|
||||
pub(crate) mod scrape;
|
||||
pub(crate) mod search;
|
||||
pub(crate) mod image_generator;
|
@@ -1,6 +1,6 @@
|
||||
use crate::utils::utils::run_agent;
|
||||
use tokio::process::Child;
|
||||
|
||||
pub async fn news_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
pub async fn agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/news-search.genai.mts", 10).await
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
use crate::utils::utils::run_agent;
|
||||
use tokio::process::Child;
|
||||
|
||||
pub async fn scrape_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
pub async fn agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/web-scrape.genai.mts", 10).await
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ use tracing;
|
||||
|
||||
use crate::utils::utils::run_agent;
|
||||
|
||||
pub async fn search_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
pub async fn agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/web-search.genai.mts", 10).await
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ pub async fn search_agent(stream_id: &str, input: &str) -> Result<Child, String>
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fmt::Debug;
|
||||
use crate::agents::search::search_agent;
|
||||
use crate::agents::search::agent;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_search_execution() {
|
||||
let input = "Who won the 2024 presidential election?";
|
||||
|
||||
let mut command = search_agent("test-stream", input).await.unwrap();
|
||||
let mut command = agent("test-stream", input).await.unwrap();
|
||||
|
||||
// command.stdout.take().unwrap().read_to_string(&mut String::new()).await.unwrap();
|
||||
// Optionally, you can capture and inspect stdout if needed:
|
||||
|
Reference in New Issue
Block a user