Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: separate agents #433

Merged
merged 8 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "ten_agent_dev",
"image": "ghcr.io/ten-framework/ten_agent_build:0.2.3",
"image": "ghcr.io/ten-framework/ten_agent_build:0.2.4",
"customizations": {
"vscode": {
"extensions": [
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ten-framework/ten_agent_build:0.2.3 AS builder
FROM ghcr.io/ten-framework/ten_agent_build:0.2.4 AS builder

ARG SESSION_CONTROL_CONF=session_control.conf

Expand All @@ -7,7 +7,7 @@ WORKDIR /app
COPY . .
COPY agents/${SESSION_CONTROL_CONF} agents/session_control.conf

RUN make clean && make build && \
RUN task clean && task use && \
cd agents && ./scripts/package.sh

FROM ubuntu:22.04
Expand Down
49 changes: 0 additions & 49 deletions Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ You will need to uncheck "Use Rosetta for x86_64/amd64 emulation on Apple Silico
![Docker Setting](https://github.com/TEN-framework/docs/blob/main/assets/gif/docker_setting.gif?raw=true)

#### Windows: Configuring Git to handle line endings
To avoid problems in `make run-server` later, you can configure Git to properly handle line endings on Windows.([more here](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings?platform=windows))
To avoid problems in `task run` later, you can configure Git to properly handle line endings on Windows.([more here](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings?platform=windows))

```bash
git config --global core.autocrlf true
Expand Down Expand Up @@ -148,13 +148,13 @@ Open up a separate terminal window, enter the container and build the agent:
```bash
docker exec -it ten_agent_dev bash

make build
task use AGENT=agents/examples/demo
```

#### 5. Start the server
Once the build is done, `make run-server` on port `8080`:
Once the build is done, `task run` on port `8080/49483`:
```bash
make run-server
task run
```

### Finish and verify
Expand Down
68 changes: 68 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version: '3'

tasks:
clean:
desc: clean up
cmds:
- task: clean-agents
- task: clean-server

build:
desc: build
cmds:
- task: build-agent
- task: build-server

use:
desc: use agent, default 'agents/examples/demo'
vars:
AGENT: '{{.AGENT| default "agents/examples/demo"}}'
cmds:
- ln -sf {{.USER_WORKING_DIR}}/{{.AGENT}}/manifest.json ./agents/
- ln -sf {{.USER_WORKING_DIR}}/{{.AGENT}}/property.json ./agents/
- task: build

run-server:
desc: run backend http server
cmds:
- /app/server/bin/api

run-gd-server:
desc: run tman dev http server for graph designer
dir: ./agents
cmds:
- tman dev-server

run:
desc: run servers
deps:
- task: run-server
- task: run-gd-server

build-agent:
desc: build agent
dir: ./agents
internal: true
cmds:
- ./scripts/install_deps_and_build.sh linux x64 && mv bin/main bin/worker

build-server:
desc: build server
dir: ./server
internal: true
cmds:
- go mod tidy && go mod download && go build -o bin/api main.go

clean-agents:
desc: clean up agents
dir: ./agents
internal: true
cmds:
- rm -rf manifest.json property.json manifest-lock.json bin/main bin/worker out .release ten_packages/system/ten_runtime* ten_packages/system/agora_rtc_sdk ten_packages/system/azure_speech_sdk ten_packages/system/nlohmann_json ten_packages/extension/agora_rtc ten_packages/extension/agora_rtm ten_packages/extension/agora_sess_ctrl ten_packages/extension/azure_tts ten_packages/extension/py_init_extension_cpp

clean-server:
desc: clean up server
dir: ./server
internal: true
cmds:
- rm -rf bin
3 changes: 3 additions & 0 deletions agents/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ xdump_config
.vscode
*.pyc
*.pyc.*
/manifest.json
/manifest-lock.json
/property.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "app",
"name": "ten_agent",
"name": "agent_demo",
"version": "0.4.0",
"dependencies": [
{
Expand Down
Loading