一、软件介绍
文末提供程序和源码下载
Shinkai开源程序 允许您在不接触代码的情况下创建 AI 代理。定义任务、计划作,并让 Shinkai 为您编写自定义代码。包括原生加密支持。
二、安装 (本地编译)
Prerequisites 先决条件
- Rust version >= 1.85 (required for
std::fs::exists
functionality)
Rust 版本 >= 1.85(功能std::fs::exists
所需)
Easy Build 轻松构建
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>sh scripts/run_node_localhost.sh
</code></span></span></span></span>
if you want to restart the node, you can delete the folder storage
and run the build again. More information at Welcome to Shinkai - Shinkai Docs.
如果要重新启动节点,可以删除该文件夹 storage
并再次运行构建。有关更多信息,请访问 https://docs.shinkai.com/getting-started。
Build Shinkai Rust Node 构建 Shinkai Rust Node
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>cargo build
</code></span></span></span></span>
Note: You must run this command from the root directory of this repo and make sure that you have set the required ENV variables.
注意:您必须从此存储库的根目录运行此命令,并确保已设置所需的 ENV 变量。
OpenAPI 开放API
Generate schemas 生成架构
Run the following command to generate the schema files:
执行以下命令,生成 Schema 文件。
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>cargo run --example generate_openapi_docs
</code></span></span></span></span>
The result will be placed in the folder docs/openapi
.
结果将放置在文件夹 docs/openapi
.
Swagger UI 招摇 UI
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>http://{NODE_IP}:{NODE_API_PORT}/v2/swagger-ui/
</code></span></span></span></span>
三、Tests 测试
Note: You must run these tests from the root directory of this repo.
注意:您必须从此存储库的根目录运行这些测试。
Test Shinkai Rust Node Only
仅测试 Shinkai Rust 节点
Simply use the following to run all rust node tests:
只需使用以下命令运行所有 Rust 节点测试:
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>IS_TESTING=1 cargo test -- --test-threads=1
</code></span></span></span></span>
For running a specific test (useful for debugging) you can use:
要运行特定测试(用于调试),您可以使用:
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>IS_TESTING=1 cargo test tcp_node_test -- --nocapture --test-threads=1
</code></span></span></span></span>
Running Dockerized Tests 运行 Docker 化测试
Main tests 主要检查
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code># Build testing image
docker build -t testing_image -f .github/Dockerfile .
# Run tests main cargo tests
docker run --entrypoint /entrypoints/run-main-cargo-tests.sh testing_image
</code></span></span></span></span>
Further CI Development 进一步的 CI 开发
Use act -j test-wasm -P self-hosted=nektos/act-environments-ubuntu:18.04 --container-architecture linux/amd64
to run the tests locally in a docker container. This is useful for debugging CI issues.
用于 act -j test-wasm -P self-hosted=nektos/act-environments-ubuntu:18.04 --container-architecture linux/amd64
在 Docker 容器中本地运行测试。这对于调试 CI 问题非常有用。