From 60aeb77847b48f0dea72d101643523563cf1fd5e Mon Sep 17 00:00:00 2001 From: Ethan Zhang Date: Wed, 25 Dec 2024 11:06:59 +0800 Subject: [PATCH] feat: add extension doc (#463) --- docs/SUMMARY.md | 1 + docs/ten_agent/project_structure/extension.md | 29 +++++++++++++++++++ .../project_structure/property_json.md | 6 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 docs/ten_agent/project_structure/extension.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 131e51553d..40cd115e41 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -11,6 +11,7 @@ * [Getting Started](ten_agent/getting_started.md) * [Project Structure](ten_agent/project_structure/overview.md) * [Understand property.json](ten_agent/project_structure/property_json.md) + * [Understand extension folder](ten_agent/project_structure/extension.md) * [Run Demo](ten_agent/demo/quickstart.md) * [Run Playground](ten_agent/playground/quickstart.md) * [Configure Modules](ten_agent/playground/configure_modules.md) diff --git a/docs/ten_agent/project_structure/extension.md b/docs/ten_agent/project_structure/extension.md new file mode 100644 index 0000000000..2b24d37c6d --- /dev/null +++ b/docs/ten_agent/project_structure/extension.md @@ -0,0 +1,29 @@ +# Understand extension folder + +The `ten_packages/extension` folder contains the extension modules. Each extension module is a separate Python/Golang/C++ package. + +The extension folder name is often the same as the extension module name, while you can also find the extension module name in the `manifest.json` file under the extension folder. The module name shall be used in the `addon` property of the `property.json` file. + +Below is a sample structure of the extension folder: + +![Extension Folder Structure](https://github.com/TEN-framework/docs/blob/main/assets/png/extension_folder_struct.png?raw=true) + +## Extension Common Files + +- manifest.json: This file contains the metadata of the extension. It includes the extension name, version, properties, and apis (data, audio_frame, video_frame). +- property.json: This file contains the default properties of the extension. It is used to define the default configuration of the extension. + +## Python Extension + +- extension.py: This file contains the main logic of the extension. It usually contains the core implementation of the extension. +- requirements.txt: This file contains the Python dependencies required by the extension. Dependencies specified in this file will be installed automatically when you run `task use`. + +## Golang Extension + +- _extension.go: This file contains the main logic of the extension. It usually contains the core implementation of the extension. +- go.mod: This file contains the Go module definition. It specifies the module name and the dependencies of the extension. + +## C++ Extension + +- src/main.cc: This file contains the main logic of the extension. It usually contains the core implementation of the extension. +- BUILD.gn: This file contains the build configuration of the extension. It specifies the target name and dependencies of the extension. \ No newline at end of file diff --git a/docs/ten_agent/project_structure/property_json.md b/docs/ten_agent/project_structure/property_json.md index c8e5022c2e..0216eabc9e 100644 --- a/docs/ten_agent/project_structure/property_json.md +++ b/docs/ten_agent/project_structure/property_json.md @@ -35,7 +35,7 @@ The `property` section of a node contains the configuration of the extension. It } ``` -![Property JSON nodes](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_nodes.png?raw=true) +![Property JSON nodes](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_connections.png?raw=true) #### Read environment variables @@ -71,6 +71,6 @@ The `connections` section contains the list of connections between nodes. Each c } ``` -![Property JSON Connections](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_connections.png?raw=true) +![Property JSON Connections](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_nodes.png?raw=true) -In the above example, we are connecting `agora_rtc` extension to `deepgram_asr` extension. The `agora_rtc` extension is sending `pcm_frame` data to `deepgram_asr` extension. \ No newline at end of file +In the above example, we are connecting `agora_rtc` extension to `deepgram_asr` extension. The `agora_rtc` extension is sending `pcm_frame` data to `deepgram_asr` extension.