AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

write_to_file arguments are printed on a single line, which is hard to read

Open feffy380 opened this issue 1 year ago • 6 comments

Duplicates

  • [X] I have searched the existing issues

Summary 💡

When the current COMMAND is write_to_file (and possibly others), large multiline arguments should be printed as multiple lines for readability.

Examples 🌈

Current behavior:

NEXT ACTION:  COMMAND = write_to_file ARGUMENTS = {'file': 'test.txt', 'text': 'Hello\nWorld'}

Expected behavior (or something similar):

NEXT ACTION:  COMMAND = write_to_file
ARGUMENTS = {'file': 'test.txt', 'text':
  Hello
  World
}

Motivation 🔦

Currently, the arguments for NEXT ACTION are a simple json dump, which combines all the lines into a single long string. I'd like to be able to review what write_to_file is doing, which is difficult when the text isn't formatted.

feffy380 avatar Apr 18 '23 03:04 feffy380

https://github.com/Significant-Gravitas/Auto-GPT/pull/2421

ashuk2000 avatar Apr 18 '23 17:04 ashuk2000

Fixed by #2421

ntindle avatar Apr 20 '23 07:04 ntindle

由#2421修复

Can you print multiple lines by changing the code to f"ARGUMENTS = {Fore.CYAN} {arguments} {Style.RESET_ALL}"

z-x-x136 avatar Apr 21 '23 07:04 z-x-x136

#2421

Can you print multiple lines by changing the code to f"ARGUMENTS = {Fore.CYAN} {arguments} {Style.RESET_ALL}"

z-x-x136 avatar Apr 21 '23 07:04 z-x-x136

#2421

Can you print multiple lines by changing the code to f"ARGUMENTS = {Fore.CYAN} {arguments} {Style.RESET_ALL}"

I think it can be done but the code won't be pretty. The problem is ,when python sees \n strings in a dictionary it replaces the new line \n with a literal \ and n in the f string. Maybe some kinda complex re split might do the trick.

ashuk2000 avatar Apr 21 '23 09:04 ashuk2000

FWIW, I think that should be easy to fix up - but not sure if it's important, there's probably more than just one UI in the pipeline anyway, so probably not a good idea to expend time/energy on cosmetics like these (?)

Admittedly, I did patch up the update_file work to visualize changes using a diff format though (#4079): difflib-agpt

In general however, I think it's worth keeping in mind that there's going to be more than one frontend "soonish" (just look at the REST PR) - all these frontends will merely need the data, no need to bother with formatting etc.

Once the data is available, providing a UI on top of pretty straightforward.

#765 poc-agpt-ui

Boostrix avatar May 11 '23 15:05 Boostrix

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] avatar Sep 09 '23 01:09 github-actions[bot]

This issue was closed automatically because it has been stale for 10 days with no activity.

github-actions[bot] avatar Sep 20 '23 01:09 github-actions[bot]