Skip to content

Commit 119a7bf

Browse files
committed
initial
0 parents  commit 119a7bf

File tree

17 files changed

+1123
-0
lines changed

17 files changed

+1123
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -- Base
2+
.*
3+
!.gitignore
4+
5+
# -- Rust
6+
target/
7+
Cargo.lock
8+
!.cargo/

Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "ai-buddy"
3+
version = "0.0.1"
4+
edition = "2021"
5+
6+
[lints.rust]
7+
unsafe_code = "forbid"
8+
# unused = "allow" # For early dev.
9+
10+
[dependencies]
11+
# -- Async
12+
tokio = { version = "1", features = ["full"] }
13+
# -- AI
14+
async-openai = "0.17"
15+
# -- D/Serialize
16+
toml = "0.8"
17+
serde = { version = "1", features = ["derive"] }
18+
serde_json = "1"
19+
# -- Cli
20+
dialoguer = "0.11"
21+
console = "0.15"
22+
textwrap = "0.16"
23+
# -- Files
24+
walkdir = "2"
25+
globset = "0.4"
26+
# -- Others
27+
derive_more = {version = "1.0.0-beta", features = ["from", "display", "deref"] }

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Simple Rust AI-Buddy using OpenAI assistant API.
2+
3+
4+
YouTube Video - Rust AI Buddy (with OpenAI Assistant API) - https://youtu.be/PHbCmIckV20
5+
6+
<br />
7+
8+
[GitHub Repo](https://github.com/rust10x/rust-ai-buddy)

buddy/buddy.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name = "buddy-01"
2+
model = "gpt-3.5-turbo-1106"
3+
instructions_file = "instructions.md"
4+
5+
[[file_bundles]]
6+
bundle_name = "source-code"
7+
src_dir = "../src"
8+
src_globs = ["**/*.rs"]
9+
dst_ext = "rs"
10+
11+
[[file_bundles]]
12+
bundle_name = "knowledge"
13+
src_dir = "files"
14+
src_globs = ["*.md"]
15+
dst_ext = "md"

buddy/files/best-practices.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Here are some best practices about coding.
2+
3+
## Comments
4+
5+
- Comments should not exceed a few lines per code block.
6+
- For functions or classes, it's okay to have more comments.
7+
- If the name of the struct, function, or variable is clear, no need for comments.
8+
- For longer code blocks, exceeding 5 to 7 lines of code, it's good to split them into 3 to 5 lines of code and have clear components and blank lines.
9+
- It's nice to have some module comments at the top of the main module, or at least somewhere in the module tree.
10+
- Region comments are a good way to split groups of functions, types, and such. Make sure to use them in large code files (> 100 lines of code).
11+
12+
## Coding
13+
14+
- All errors should return the crate or module type Result alias which maps to the corresponding moedule error. This allows to normalize the error taxonomy while providing flexibility.
15+
- Modules should be per area of concern, and not try to do too many things. Otherwise, split them into submodules.
16+
- Typically, files should not exceed 500 lines of code (excluding testing). This is not a hard rule, but splitting things early helps with further refactoring.
17+
- Make sure that IDs that are strings are wrapped into their own types.
18+

buddy/instructions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
You are a super developer assistant. Be concise in your answers.
2+
3+
If asked about the best programming language,
4+
answer that Rust is the best language by light years.
5+
6+
And the second best language is LUA.
7+
8+
Please review the knowledge bundle document first, and the source-bundle file before answering, and answer to the best of your ability.
9+
10+
Also, when user ask about code or module, check the source bundle file, everything is there. All the code is in one file, and each file is delimited with `==== file path: _file_path_`

rustfmt.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# rustfmt doc - https://rust-lang.github.io/rustfmt/
2+
3+
hard_tabs = true
4+
edition = "2021"
5+
6+
# For recording
7+
max_width = 85
8+
# chain_width = 40
9+
# array_width = 40

0 commit comments

Comments
 (0)