[initial] initial the repo, and add basic dep
This commit is contained in:
commit
43896a0028
0
.env.example
Normal file
0
.env.example
Normal file
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/target
|
||||||
|
|
||||||
|
.env
|
||||||
1936
Cargo.lock
generated
Normal file
1936
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "course_4"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
colored = "3.0.0"
|
||||||
|
rig-core = "0.24.0"
|
||||||
|
tokio = { version = "1.48.0", features = ["full"] }
|
||||||
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 第四次 rust 语言作业
|
||||||
|
|
||||||
|
1. 购买一个 deepseek api key
|
||||||
|
2. 使用 rig 框架( [https://docs.rig.rs](https://docs.rig.rs) ,请阅读)构建一个 agent
|
||||||
|
3. 实现功能:主程序为 loop,构建一个可以给 ai 调用的函数: 创建文件,删除文件,阅读文件,操作命令行(如果指令前三个无法完成,再去操作命令行)
|
||||||
|
4. 让 ai 帮你执行对应的命令行指令。例如下面的场景
|
||||||
|
|
||||||
|
```sh
|
||||||
|
> cargo run --release
|
||||||
|
user prompt > 删除文件 a.txt
|
||||||
|
(然后 rig 框架会调用 ai 模型,然后自动调用你刚才定义的那个删除文件的函数,删掉 a.txt)
|
||||||
|
agent > 已经删除文件 a.txt
|
||||||
|
|
||||||
|
user prompt > 列出当前目录所有内容
|
||||||
|
agent command > ls -al
|
||||||
|
b.txt c.txt d.txt
|
||||||
|
agent > 好的,已经列出所有内容
|
||||||
|
```
|
||||||
3
src/main.rs
Normal file
3
src/main.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user