diff --git a/README.md b/README.md index 849ae9f5..a095a671 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ print(res) VeADK provides several useful command line tools for faster deployment and optimization, such as: -- `veadk deploy`: deploy your project to Volcengine VeFaaS platform +- `veadk deploy`: deploy your project to Volcengine VeFaaS platform (you can use `veadk init` to init a demo project first) - `veadk prompt`: otpimize the system prompt of your agent by PromptPilot ## Contribution diff --git a/veadk/a2a/remote_ve_agent.py b/veadk/a2a/remote_ve_agent.py index 1be9d347..299b8ad5 100644 --- a/veadk/a2a/remote_ve_agent.py +++ b/veadk/a2a/remote_ve_agent.py @@ -16,6 +16,4 @@ def __init__(self, name: str, url: str): agent_card_object = AgentCard.model_validate_json(str(agent_card_json_str)) - super().__init__( - name=name, description="weather reporter", agent_card=agent_card_object - ) + super().__init__(name=name, agent_card=agent_card_object) diff --git a/veadk/cli/main.py b/veadk/cli/main.py index 13f72799..ad357309 100644 --- a/veadk/cli/main.py +++ b/veadk/cli/main.py @@ -16,6 +16,7 @@ import importlib.util import os +import shutil import sys from pathlib import Path @@ -30,6 +31,33 @@ app = typer.Typer(name="vego") +@app.command() +def init(): + """Init a veadk project that can be deployed to Volcengine VeFaaS.""" + from rich.prompt import Confirm, Prompt + + cwd = Path.cwd() + template_dir = Path(__file__).parent.resolve() / "services" / "vefaas" / "template" + + name = Prompt.ask("Project name", default="veadk-cloud-agent") + + target_dir = cwd / name + + if target_dir.exists(): + response = Confirm.ask( + f"Target directory '{target_dir}' already exists, do you want to overwrite it?: " + ) + if not response: + print("Operation cancelled.") + return + else: + shutil.rmtree(target_dir) # 删除旧目录 + print(f"Deleted existing directory: {target_dir}") + + shutil.copytree(template_dir, target_dir) + print(f"Created new project: {name}") + + # @app.command() # def web( # path: str = typer.Option(".", "--path", help="Agent project path"), diff --git a/samples/template-project-for-vefaas/README.md b/veadk/cli/services/vefaas/template/README.md similarity index 94% rename from samples/template-project-for-vefaas/README.md rename to veadk/cli/services/vefaas/template/README.md index f31d5000..9ef8d572 100644 --- a/samples/template-project-for-vefaas/README.md +++ b/veadk/cli/services/vefaas/template/README.md @@ -19,7 +19,7 @@ You must export your agent and short-term memory in `src/config.py`. ## Deploy -We recommand you deploy this project by the `cloud` module of VeADK. +We recommend you deploy this project by the `cloud` module of VeADK. ```bash python deploy.py diff --git a/samples/template-project-for-vefaas/config.yaml.example b/veadk/cli/services/vefaas/template/config.yaml.example similarity index 100% rename from samples/template-project-for-vefaas/config.yaml.example rename to veadk/cli/services/vefaas/template/config.yaml.example diff --git a/samples/template-project-for-vefaas/deploy.py b/veadk/cli/services/vefaas/template/deploy.py similarity index 100% rename from samples/template-project-for-vefaas/deploy.py rename to veadk/cli/services/vefaas/template/deploy.py diff --git a/samples/template-project-for-vefaas/src/app.py b/veadk/cli/services/vefaas/template/src/app.py similarity index 100% rename from samples/template-project-for-vefaas/src/app.py rename to veadk/cli/services/vefaas/template/src/app.py diff --git a/samples/template-project-for-vefaas/src/config.py b/veadk/cli/services/vefaas/template/src/config.py similarity index 100% rename from samples/template-project-for-vefaas/src/config.py rename to veadk/cli/services/vefaas/template/src/config.py diff --git a/samples/template-project-for-vefaas/src/requirements.txt b/veadk/cli/services/vefaas/template/src/requirements.txt similarity index 100% rename from samples/template-project-for-vefaas/src/requirements.txt rename to veadk/cli/services/vefaas/template/src/requirements.txt diff --git a/samples/template-project-for-vefaas/src/run.sh b/veadk/cli/services/vefaas/template/src/run.sh similarity index 100% rename from samples/template-project-for-vefaas/src/run.sh rename to veadk/cli/services/vefaas/template/src/run.sh