Skip to content

Commit bea2464

Browse files
committed
Improve app print experience
1 parent 33a96c3 commit bea2464

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

operate/models/apis.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ async def call_gpt_4_vision_preview_ocr(messages, objective, model):
298298

299299
except Exception as e:
300300
print(
301-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[Operate] That did not work. Trying another method {ANSI_RESET}"
301+
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[{model}] That did not work. Trying another method {ANSI_RESET}"
302302
)
303303
if config.verbose:
304304
print("[Self-Operating Computer][Operate] error", e)
@@ -444,7 +444,7 @@ async def call_gpt_4_vision_preview_labeled(messages, objective, model):
444444

445445
except Exception as e:
446446
print(
447-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[Operate] That did not work. Trying another method {ANSI_RESET}"
447+
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[{model}] That did not work. Trying another method {ANSI_RESET}"
448448
)
449449
if config.verbose:
450450
print("[Self-Operating Computer][Operate] error", e)
@@ -517,7 +517,7 @@ def call_ollama_llava(messages):
517517

518518
except Exception as e:
519519
print(
520-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[Operate] That did not work. Trying again {ANSI_RESET}",
520+
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[llava] That did not work. Trying again {ANSI_RESET}",
521521
e,
522522
)
523523
print(

operate/operate.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
config = Config()
3030
operating_system = OperatingSystem()
3131

32+
3233
def main(model, terminal_prompt, voice_mode=False, verbose_mode=False):
3334
"""
3435
Main function for the Self-Operating Computer.
@@ -89,7 +90,9 @@ def main(model, terminal_prompt, voice_mode=False, verbose_mode=False):
8990
print(f"{ANSI_RED}Error in capturing voice input: {e}{ANSI_RESET}")
9091
return # Exit if voice input fails
9192
else:
92-
print(f"{ANSI_GREEN}[Self-Operating Computer]\n{ANSI_RESET}{USER_QUESTION}")
93+
print(
94+
f"[{ANSI_GREEN}Self-Operating Computer {ANSI_RESET}|{ANSI_BRIGHT_MAGENTA} {model}{ANSI_RESET}]\n{USER_QUESTION}"
95+
)
9396
print(f"{ANSI_YELLOW}[User]{ANSI_RESET}")
9497
objective = prompt(style=style)
9598

@@ -109,7 +112,7 @@ def main(model, terminal_prompt, voice_mode=False, verbose_mode=False):
109112
get_next_action(model, messages, objective, session_id)
110113
)
111114

112-
stop = operate(operations)
115+
stop = operate(operations, model)
113116
if stop:
114117
break
115118

@@ -128,7 +131,7 @@ def main(model, terminal_prompt, voice_mode=False, verbose_mode=False):
128131
break
129132

130133

131-
def operate(operations):
134+
def operate(operations, model):
132135
if config.verbose:
133136
print("[Self Operating Computer][operate]")
134137
for operation in operations:
@@ -161,11 +164,9 @@ def operate(operations):
161164
summary = operation.get("summary")
162165

163166
print(
164-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BLUE} Objective Completed {ANSI_RESET}"
165-
)
166-
print(
167-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BLUE} Summary {ANSI_RESET}{summary}"
167+
f"[{ANSI_GREEN}Self-Operating Computer {ANSI_RESET}|{ANSI_BRIGHT_MAGENTA} {model}{ANSI_RESET}]"
168168
)
169+
print(f"{ANSI_BLUE}Objective Complete: {ANSI_RESET}{summary}\n")
169170
return True
170171

171172
else:
@@ -178,10 +179,9 @@ def operate(operations):
178179
return True
179180

180181
print(
181-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[Operate] Thought {ANSI_RESET} {operate_thought}"
182-
)
183-
print(
184-
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_BRIGHT_MAGENTA}[Operate] {operate_type} {ANSI_RESET} {operate_detail}"
182+
f"[{ANSI_GREEN}Self-Operating Computer {ANSI_RESET}|{ANSI_BRIGHT_MAGENTA} {model}{ANSI_RESET}]"
185183
)
184+
print(f"{operate_thought}")
185+
print(f"{ANSI_BLUE}Action: {ANSI_RESET}{operate_type} {operate_detail}\n")
186186

187187
return False

0 commit comments

Comments
 (0)