Skip to content

Commit

Permalink
Feature/debugging (#271)
Browse files Browse the repository at this point in the history
* feat: upgrade to ten 0.2

* feat: disable auto_start

* feat: allow customize build type

* feat: add debugging tools

* feat: add debugging and build configs

* fix: go debugging launch

* feat: update image

* feat: update version

* fix: greeting missed

* test: build docker

* Revert "test: build docker"

This reverts commit 06a4269.

---------

Co-authored-by: Jay Zhang <[email protected]>
  • Loading branch information
plutoless and wangyoucao577 authored Sep 9, 2024
1 parent 31cb2be commit fa411b4
Show file tree
Hide file tree
Showing 31 changed files with 145 additions and 69 deletions.
8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "astra",
"image": "ghcr.io/ten-framework/astra_agents_build:0.4.0",
"image": "ghcr.io/ten-framework/astra_agents_build:0.5.2",
"customizations": {
"vscode": {
"extensions": [
"golang.go"
"golang.go",
"ms-vscode.cpptools"
]
}
},
Expand All @@ -19,6 +20,7 @@
],
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {}
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/python:1": {}
}
}
47 changes: 47 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "debug go",
"type": "go",
"request": "launch",
"mode": "exec",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/agents/bin/worker",
"env": {
"LD_LIBRARY_PATH": "${workspaceFolder}/agents/ten_packages/system/ten_runtime_go/lib:${workspaceFolder}/agents/ten_packages/system/agora_rtc_sdk/lib:${workspaceFolder}/agents/ten_packages/system/azure_speech_sdk/lib",
"TEN_APP_BASE_DIR": "${workspaceFolder}/agents"
}
},
{
"name": "debug python",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"preLaunchTask": "start app"
},
{
"name": "debug cpp",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/agents/bin/worker",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "LD_LIBRARY_PATH",
"value": "${workspaceFolder}/agents/ten_packages/system/agora_rtc_sdk/lib:${workspaceFolder}/agents/ten_packages/system/azure_speech_sdk/lib"
},
{
"name": "CGO_LDFLAGS",
"value": "-L${workspaceFolder}/agents/ten_packages/system/ten_runtime_go/lib -lten_runtime_go -Wl,-rpath,@loader_path/lib -Wl,-rpath,@loader_path/../lib"
}
]
}
]
}
22 changes: 22 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "build",
"command": "make build",
"args": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "start app",
"type": "shell",
"command": "export TEN_ENABLE_PYTHON_DEBUG=true; export TEN_PYTHON_DEBUG_PORT=5678; ./agents/bin/start",
"group": "none",
"isBackground": true
},
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ten-framework/astra_agents_build:0.4.0 AS builder
FROM ghcr.io/ten-framework/astra_agents_build:0.5.2 AS builder

ARG SESSION_CONTROL_CONF=session_control.conf

Expand Down
1 change: 0 additions & 1 deletion agents/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func startAppBlocking(cfg *appConfig) {

appInstance.Run(true)
appInstance.Wait()
ten.UnloadAllAddons()

ten.EnsureCleanupWhenProcessExit()
}
Expand Down
62 changes: 30 additions & 32 deletions agents/manifest-lock.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"version": 1,
"packages": [
{
"type": "system",
"name": "ten_runtime_go",
"version": "0.1.0",
"hash": "ab66a8ed40c744a52cce36f26a233e669d989d9f620876156e3cc7187f214977",
"version": "0.2.0",
"hash": "8b582de5dfaa38983104143fbb6c530b3aeb463ad9e9ef51f2c72fba9862b8cc",
"dependencies": [
{
"type": "system",
Expand All @@ -21,8 +22,8 @@
{
"type": "extension",
"name": "py_init_extension_cpp",
"version": "0.1.0",
"hash": "b39c4dddbec58e1a756b7e71f41ab0ec419ab0043525ba94e6ed98b7ef634697",
"version": "0.2.0",
"hash": "e1858dfd83d18a69901cefb2edfd52e57ee326a3d306e799ff1d661f3195bb6b",
"dependencies": [
{
"type": "system",
Expand All @@ -43,8 +44,8 @@
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0",
"hash": "cfadaf8f951de42965e92becc67a597501196bc3bd6f17f39a64260836393c64",
"version": "0.2.0",
"hash": "117ed3e747654fc1282129a160eaecc2cd16548e70aa22128efee21f10e185c8",
"dependencies": [
{
"type": "system",
Expand All @@ -61,8 +62,8 @@
{
"type": "extension",
"name": "agora_rtc",
"version": "0.5.1",
"hash": "de8bb179155f6a329072be87ccd624177e9bbe795956a9a275e7886a3dc31cb7",
"version": "0.7.0-rc2",
"hash": "89d7af8f84d06afbd79901e0057182280f3f430227ad6fae98ec154067ffa82c",
"dependencies": [
{
"type": "system",
Expand All @@ -72,10 +73,6 @@
"type": "system",
"name": "agora_rtc_sdk"
},
{
"type": "system",
"name": "azure_speech_sdk"
},
{
"type": "system",
"name": "nlohmann_json"
Expand All @@ -88,11 +85,23 @@
}
]
},
{
"type": "system",
"name": "azure_speech_sdk",
"version": "1.38.0",
"hash": "66a50ef361f8190fa0595d8298c135e13b73796d57174a0802631263a8f15806",
"supports": [
{
"os": "linux",
"arch": "x64"
}
]
},
{
"type": "extension",
"name": "azure_tts",
"version": "0.4.0",
"hash": "4f25e8c2a9c82f2a699a4e8378d11d2fbb31c90ec5df1718271ebfe6377a5389",
"hash": "c8f838754aaae7ed4598e99fb94b6e251382ade08fa23dbf85e91e9864d018ef",
"dependencies": [
{
"type": "system",
Expand All @@ -107,20 +116,8 @@
{
"type": "system",
"name": "ten_runtime",
"version": "0.1.0",
"hash": "b630f52ef9787132dc854fb4e90f962336be3f836baba137ca3b6dc132df0b86",
"supports": [
{
"os": "linux",
"arch": "x64"
}
]
},
{
"type": "system",
"name": "azure_speech_sdk",
"version": "1.38.0",
"hash": "66a50ef361f8190fa0595d8298c135e13b73796d57174a0802631263a8f15806",
"version": "0.2.0",
"hash": "7effdb036d5bf91894060a9230775ff8ec2598f202b8238578f99a14dbf11632",
"supports": [
{
"os": "linux",
Expand All @@ -131,8 +128,8 @@
{
"type": "system",
"name": "agora_rtc_sdk",
"version": "4.1.35+build328115",
"hash": "fd33989f9913d77e05970eb2b265fa5e08322141b7e0f8f9fd3e521f87929b3b",
"version": "4.1.36+build331418",
"hash": "74115dd35822dc3b09fbadb577b31146af704d60435ca401c0b305cce80b2ba4",
"supports": [
{
"os": "linux",
Expand All @@ -144,13 +141,14 @@
"type": "system",
"name": "nlohmann_json",
"version": "3.11.2",
"hash": "72b15822c7ea9deef5e7ad96216ac55e93f11b00466dd1943afd5ee276e99d19"
"hash": "72b15822c7ea9deef5e7ad96216ac55e93f11b00466dd1943afd5ee276e99d19",
"supports": []
},
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1.0",
"hash": "a8980c39ba0cf1f21b38490c3167950f750403b1b29d756cfbacc5c5147becd7",
"version": "0.2.0",
"hash": "b44d3767f364583f8bb8e8995f6f7f49e3af27b3c9a8ddf62fa319f1fc39910e",
"dependencies": [
{
"type": "system",
Expand Down
13 changes: 9 additions & 4 deletions agents/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
{
"type": "system",
"name": "ten_runtime_go",
"version": "0.1"
"version": "0.2"
},
{
"type": "extension",
"name": "py_init_extension_cpp",
"version": "0.1"
"version": "0.2"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1"
"version": "0.2"
},
{
"type": "extension",
"name": "agora_rtc",
"version": "=0.5.1"
"version": "=0.7.0-rc2"
},
{
"type": "system",
"name": "azure_speech_sdk",
"version": "1.38.0"
},
{
"type": "extension",
Expand Down
6 changes: 3 additions & 3 deletions agents/property.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"predefined_graphs": [
{
"name": "va.openai.azure",
"auto_start": true,
"auto_start": false,
"nodes": [
{
"type": "extension",
Expand Down Expand Up @@ -1587,7 +1587,7 @@
},
{
"name": "va.gemini.azure",
"auto_start": true,
"auto_start": false,
"nodes": [
{
"type": "extension",
Expand Down Expand Up @@ -1786,7 +1786,7 @@
},
{
"name": "va.qwen.rag",
"auto_start": true,
"auto_start": false,
"nodes": [
{
"type": "extension",
Expand Down
7 changes: 5 additions & 2 deletions agents/scripts/install_deps_and_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ OS="linux"
# x64, arm64
CPU="x64"

# debug, release
BUILD_TYPE="release"

build_cxx_extensions() {
local app_dir=$1

Expand All @@ -16,8 +19,8 @@ build_cxx_extensions() {

cp $app_dir/scripts/BUILD.gn $app_dir

tgn gen $OS $CPU release -- is_clang=false
tgn build $OS $CPU release
tgn gen $OS $CPU $BUILD_TYPE -- is_clang=false enable_sanitizer=false
tgn build $OS $CPU $BUILD_TYPE

local ret=$?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
2 changes: 1 addition & 1 deletion agents/ten_packages/extension/azure_tts/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime",
"version": "0.1"
"version": "0.2"
},
{
"type": "system",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_go",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
2 changes: 1 addition & 1 deletion agents/ten_packages/extension/cosy_tts/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
2 changes: 1 addition & 1 deletion agents/ten_packages/extension/elevenlabs_tts/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "system",
"name": "ten_runtime_go",
"version": "0.1"
"version": "0.2"
}
],
"api": {
Expand Down
Loading

0 comments on commit fa411b4

Please sign in to comment.