From 95fcc89e7cd33ec48e172a7c4f3316b83d236403 Mon Sep 17 00:00:00 2001 From: imotai Date: Tue, 12 Sep 2023 12:31:45 +0800 Subject: [PATCH] fix: fix the data dir bug --- agent/src/octopus_agent/agent_server.py | 1 - build_package.sh | 28 +++++++++++++++++++ install_package.sh | 9 ++++++ .../server/kernel_rpc_server.py | 2 +- start_sandbox.sh | 6 +--- 5 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 build_package.sh create mode 100644 install_package.sh diff --git a/agent/src/octopus_agent/agent_server.py b/agent/src/octopus_agent/agent_server.py index d04a13b..7cb3212 100644 --- a/agent/src/octopus_agent/agent_server.py +++ b/agent/src/octopus_agent/agent_server.py @@ -72,7 +72,6 @@ async def add_kernel( config.get("max_iterations", 5), self.verbose, ) - # TODO a data dir per user self.agents[request.key] = { "sdk": sdk, "agent": agent, diff --git a/build_package.sh b/build_package.sh new file mode 100644 index 0000000..72149bc --- /dev/null +++ b/build_package.sh @@ -0,0 +1,28 @@ +#! /bin/sh +# +# build_package.sh + + + +WORKDIR=`pwd` +echo "$1" +sed -i -E 's/version\s*=\s*"[^"]*"/version="$1"/' proto/setup.py +sed -i -E 's/version\s*=\s*"[^"]*"/version="$1"/' kernel/setup.py +sed -i -E 's/version\s*=\s*"[^"]*"/version="$1"/' agent/setup.py +sed -i -E 's/version\s*=\s*"[^"]*"/version="$1"/' chat/setup.py +echo "the proto new version" +python3 proto/setup.py --version +echo "the kernel new version" +python3 kernel/setup.py --version +echo "the agent new version" +python3 agent/setup.py --version +echo "the chat new version" +python3 chat/setup.py --version +# build octopus proto package +cd ${WORKDIR}/proto && make && python3 -m build +# build octopus kernel package +cd ${WORKDIR}/kernel && python3 -m build +# build agent package +cd ${WORKDIR}/agent && python3 -m build +# build chat package +cd ${WORKDIR}/chat && python3 -m build diff --git a/install_package.sh b/install_package.sh new file mode 100644 index 0000000..13335e8 --- /dev/null +++ b/install_package.sh @@ -0,0 +1,9 @@ +#! /bin/sh +# +# install_package.sh + +WORKDIR=`pwd` +cd ${WORKDIR}/proto && make && pip install . +cd ${WORKDIR}/kernel && pip install . +cd ${WORKDIR}/agent && pip install . +cd ${WORKDIR}/chat && pip install . diff --git a/kernel/src/octopus_kernel/server/kernel_rpc_server.py b/kernel/src/octopus_kernel/server/kernel_rpc_server.py index 49184ca..24b74e1 100644 --- a/kernel/src/octopus_kernel/server/kernel_rpc_server.py +++ b/kernel/src/octopus_kernel/server/kernel_rpc_server.py @@ -236,7 +236,7 @@ def _build_payload(self, msg, workspace): if msg["msg_type"] == "display_data": if "image/png" in msg["content"]["data"]: filename = "%s.png" % uuid.uuid4().hex - fullpath = "%s/%s" % (data_dir, filename) + fullpath = "%s/%s" % (workspace, filename) with open(fullpath, "wb+") as fd: data = msg["content"]["data"]["image/png"].encode("ascii") buffer = base64.b64decode(data) diff --git a/start_sandbox.sh b/start_sandbox.sh index 7dbccd7..6b53ba0 100644 --- a/start_sandbox.sh +++ b/start_sandbox.sh @@ -3,11 +3,7 @@ # start_local.sh ps -ef | grep python3 | grep -v grep | awk '{print $2}' | while read line; do kill -9 $line; done WORKDIR=`pwd` - -cd ${WORKDIR}/proto && make && pip install . -cd ${WORKDIR}/kernel && pip install . -cd ${WORKDIR}/agent && pip install . -cd ${WORKDIR}/chat && pip install . +bash install_package.sh mkdir -p ${WORKDIR}/sandbox/kernel mkdir -p ${WORKDIR}/sandbox/agent