Skip to content

Commit db26238

Browse files
authored
Merge pull request #144 from dbpunk-labs/142-bug-fail-to-start-og-command-in-gitpod
fix: catch the iterm_image exception
2 parents 9f1b8c0 + 3443c5a commit db26238

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

agent/src/og_agent/openai_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
{
5656
"name": "python",
57-
"description": "this function must not be used",
57+
"description": "You must not call this function",
5858
"parameters": {
5959
"type": "object",
6060
"properties": {

chat/src/og_terminal/terminal_chat.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
from .utils import parse_file_path
4040
from .markdown import CodeBlock
4141
import clipboard
42-
from PIL import Image
43-
from term_image.image import AutoImage
4442

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

352350

353351
def render_image(images, sdk, image_dir, console):
354-
image_set = set(images)
355-
for image in image_set:
356-
try:
357-
sdk.download_file(image, image_dir)
358-
fullpath = "%s/%s" % (image_dir, image)
359-
pil_image = Image.open(fullpath)
360-
auto_image = AutoImage(image=pil_image, width=int(pil_image.size[0] / 15))
361-
print(f"{auto_image:1.1#}")
362-
except Exception as ex:
363-
pass
352+
try:
353+
from PIL import Image
354+
from term_image.image import AutoImage
355+
356+
image_set = set(images)
357+
for image in image_set:
358+
try:
359+
sdk.download_file(image, image_dir)
360+
fullpath = "%s/%s" % (image_dir, image)
361+
pil_image = Image.open(fullpath)
362+
auto_image = AutoImage(
363+
image=pil_image, width=int(pil_image.size[0] / 15)
364+
)
365+
print(f"{auto_image:1.1#}")
366+
return True
367+
except Exception as ex:
368+
return False
369+
except Exception as ex:
370+
return False
364371

365372

366373
def run_chat(

docker/start_all.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ then
1313
fi
1414
ROOT_DIR=$1
1515

16-
chown octogen:octogen -R ${ROOT_DIR}
16+
mkdir -p ${ROOT_DIR}/kernel/ws
17+
mkdir -p ${ROOT_DIR}/agent/db
18+
mkdir -p ${ROOT_DIR}/kernel/config
19+
chown -R octogen:octogen ${ROOT_DIR}/kernel/ws
20+
chown -R octogen:octogen ${ROOT_DIR}/kernel/config
21+
chown -R octogen:octogen ${ROOT_DIR}/agent/db
22+
1723
cat <<EOF> /bin/start_service.sh
1824
if [ "$2" -eq 1 ]
1925
then

up/src/og_up/up.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def generate_agent_common(fd, rpc_key):
296296
fd.write(f"admin_key={rpc_key}\n")
297297
fd.write("max_file_size=202400000\n")
298298
fd.write("max_iterations=8\n")
299-
fd.write("db_path=/app/agent/octogen.db\n")
299+
fd.write("db_path=/app/agent/db/octogen.db\n")
300300

301301

302302
def generate_agent_azure_openai(

0 commit comments

Comments
 (0)