Skip to content

Commit 7bf1977

Browse files
committed
add project structure
1 parent cb4548b commit 7bf1977

File tree

12 files changed

+97
-3
lines changed

12 files changed

+97
-3
lines changed

Cargo.toml

+17
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,21 @@ name = "auto_gpt_agent"
33
version = "0.1.0"
44
edition = "2021"
55

6+
[lib]
7+
proc-macro = true
8+
69
[dependencies]
10+
dotenv = "0.15.0"
11+
reqwest = {version = "0.11.17",features = ["json"]}
12+
serde = {version = "1.0.160",features = ["derive"]}
13+
serde_json = "1.0.96"
14+
tokio = {version = "1.28.0",features = ["full"]}
15+
crossterm = "0.26.1"
16+
async-trait = "0.1.68"
17+
webbrowser = "0.8.9"
18+
strum = "0.24.1"
19+
strum_macros = "0.24.3"
20+
ai_functions = "0.1.1"
21+
syn = "2.0.90"
22+
quote = "1.0.37"
23+
proc-macro2 = "1.0.92"

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Auto GPT Agent
22

3-
✅ blazingly fast, memory-safe, modern and robust.
4-
* Developing an automated ChatGPT agent that not only writes code, but also tests and rewrites code if necessary to achieve the best result.
3+
🚀 blazingly fast
4+
🌍 memory-safe
5+
🌟 modern and robust
6+
7+
* Develop an automated OpenAI agent that not only writes code, but also tests and rewrites code if necessary to achieve the best result.
58
* Creating web servers based on Actix Web, full stack SAAS websites end-to-end and other similar challenges.
69
* In fact, it should be available to perform work of almost any complexity.
710

src/ai_functions/mod.rs

Whitespace-only changes.

src/api_handler/call_request.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use crate::models::general::llm::{Message};
2+
3+
use dotenv::dotenv;
4+
use std::env;
5+
6+
use reqwest::Client;
7+
8+
9+
//call LLM GPT
10+
pub async fn call_gpt(message: Vec<Message>) {
11+
dotenv().ok();
12+
13+
//extract api keys
14+
let api_keys: String = env::var("GPT_API_KEY").expect("GPT_API_KEY");
15+
16+
}

src/api_handler/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod call_request;

src/helpers/command_lines.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use crossterm::{style::{Color, ResetColor, SetForegroundColor}, ExecutableCommand};
2+
use std::io::stdin;
3+
4+
// get user request
5+
pub fn get_user_response(question: &str) -> String {
6+
let mut stdout: std::io::Stdout = std::io::stdout();
7+
8+
// print the questions in a specific color
9+
stdout.execute(SetForegroundColor(Color::Blue)).unwrap();
10+
println!("");
11+
println!("{}", question);
12+
13+
// reset color
14+
stdout.execute(ResetColor).unwrap();
15+
let mut user_response = String::new();
16+
stdin().read_line(&mut user_response).expect("Failed to read response");
17+
return user_response.trim().to_string();
18+
}

src/helpers/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod command_lines;

src/lib.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
extern crate proc_macro;
2+
3+
use proc_macro::TokenStream;
4+
use quote::{quote, ToTokens};
5+
use syn::{parse_macro_input, ItemFn};
6+
7+
#[proc_macro_attribute]
8+
pub fn function_to_string(_attr: TokenStream, item: TokenStream) -> TokenStream {
9+
let input_fn: ItemFn = parse_macro_input!(item as ItemFn);
10+
let function_str: String = format!("{}", input_fn.to_token_stream());
11+
let fn_ident: proc_macro2::Ident = input_fn.sig.ident;
12+
let fn_inputs: syn::punctuated::Punctuated<syn::FnArg, syn::token::Comma> = input_fn.sig.inputs;
13+
let fn_generics: syn::Generics = input_fn.sig.generics;
14+
let output: proc_macro2::TokenStream = quote! {
15+
pub fn #fn_ident #fn_generics(#fn_inputs) -> &'static str {
16+
#function_str
17+
}
18+
};
19+
output.into()
20+
}

src/main.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
mod ai_functions;
2+
mod api_handler;
3+
mod models;
4+
mod helpers;
5+
6+
use helpers::command_lines::get_user_response;
7+
8+
19
fn main() {
2-
println!("Hello, world!");
10+
let user_req: String = get_user_response("What are we building today?");
11+
dbg!(user_req);
312
}

src/models/general/llm.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
#[derive(Debug, Serialize, Deserialize, Clone)]
4+
pub struct Message {
5+
pub role: String,
6+
pub content: String,
7+
}

src/models/general/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod llm;

src/models/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod general;

0 commit comments

Comments
 (0)