Skip to content

Commit

Permalink
Merge pull request #144 from dbpunk-labs/142-bug-fail-to-start-og-com…
Browse files Browse the repository at this point in the history
…mand-in-gitpod

fix: catch the iterm_image exception
  • Loading branch information
imotai authored Oct 9, 2023
2 parents 9f1b8c0 + 3443c5a commit db26238
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion agent/src/og_agent/openai_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
{
"name": "python",
"description": "this function must not be used",
"description": "You must not call this function",
"parameters": {
"type": "object",
"properties": {
Expand Down
31 changes: 19 additions & 12 deletions chat/src/og_terminal/terminal_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
from .utils import parse_file_path
from .markdown import CodeBlock
import clipboard
from PIL import Image
from term_image.image import AutoImage

Markdown.elements["fence"] = CodeBlock
Markdown.elements["code_block"] = CodeBlock
Expand Down Expand Up @@ -351,16 +349,25 @@ def handle_final_answer(segments, respond, values):


def render_image(images, sdk, image_dir, console):
image_set = set(images)
for image in image_set:
try:
sdk.download_file(image, image_dir)
fullpath = "%s/%s" % (image_dir, image)
pil_image = Image.open(fullpath)
auto_image = AutoImage(image=pil_image, width=int(pil_image.size[0] / 15))
print(f"{auto_image:1.1#}")
except Exception as ex:
pass
try:
from PIL import Image
from term_image.image import AutoImage

image_set = set(images)
for image in image_set:
try:
sdk.download_file(image, image_dir)
fullpath = "%s/%s" % (image_dir, image)
pil_image = Image.open(fullpath)
auto_image = AutoImage(
image=pil_image, width=int(pil_image.size[0] / 15)
)
print(f"{auto_image:1.1#}")
return True
except Exception as ex:
return False
except Exception as ex:
return False


def run_chat(
Expand Down
8 changes: 7 additions & 1 deletion docker/start_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ then
fi
ROOT_DIR=$1

chown octogen:octogen -R ${ROOT_DIR}
mkdir -p ${ROOT_DIR}/kernel/ws
mkdir -p ${ROOT_DIR}/agent/db
mkdir -p ${ROOT_DIR}/kernel/config
chown -R octogen:octogen ${ROOT_DIR}/kernel/ws
chown -R octogen:octogen ${ROOT_DIR}/kernel/config
chown -R octogen:octogen ${ROOT_DIR}/agent/db

cat <<EOF> /bin/start_service.sh
if [ "$2" -eq 1 ]
then
Expand Down
2 changes: 1 addition & 1 deletion up/src/og_up/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def generate_agent_common(fd, rpc_key):
fd.write(f"admin_key={rpc_key}\n")
fd.write("max_file_size=202400000\n")
fd.write("max_iterations=8\n")
fd.write("db_path=/app/agent/octogen.db\n")
fd.write("db_path=/app/agent/db/octogen.db\n")


def generate_agent_azure_openai(
Expand Down

0 comments on commit db26238

Please sign in to comment.