Skip to content

Commit

Permalink
fix: fix the data dir bug
Browse files Browse the repository at this point in the history
  • Loading branch information
imotai committed Sep 12, 2023
1 parent 688b26c commit 95fcc89
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 7 deletions.
1 change: 0 additions & 1 deletion agent/src/octopus_agent/agent_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions build_package.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions install_package.sh
Original file line number Diff line number Diff line change
@@ -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 .
2 changes: 1 addition & 1 deletion kernel/src/octopus_kernel/server/kernel_rpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions start_sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95fcc89

Please sign in to comment.