From d2f65d217a9f0be624f84edc734f0413ddc38b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 5 Nov 2023 17:10:36 +0100 Subject: [PATCH] fix: added some comments, and strip.sh --- gptme/tools/reduce.py | 1 + scripts/describe_api.py | 2 ++ scripts/strip.sh | 6 ++++++ 3 files changed, 9 insertions(+) create mode 100644 scripts/strip.sh diff --git a/gptme/tools/reduce.py b/gptme/tools/reduce.py index 1f4fe1c47..e292dc4de 100644 --- a/gptme/tools/reduce.py +++ b/gptme/tools/reduce.py @@ -62,6 +62,7 @@ def reduce_log( def truncate_msg(msg: Message, lines_pre=10, lines_post=10) -> Message | None: """Truncates message codeblocks to the first and last `lines_pre` and `lines_post` lines, keeping the rest as `[...]`.""" + # TODO: also truncate long
(as can be found in GitHub issue comments) content_staged = msg.content # Truncate long codeblocks diff --git a/scripts/describe_api.py b/scripts/describe_api.py index ba63640ed..30025ae41 100644 --- a/scripts/describe_api.py +++ b/scripts/describe_api.py @@ -1,5 +1,7 @@ """ Describes the API of a given Python file such that a LLM can easily get a summary of the API in a codefile (and later an entire project). + +NOTE: this is easier to do with ctags """ import click import jedi diff --git a/scripts/strip.sh b/scripts/strip.sh new file mode 100644 index 000000000..a51939428 --- /dev/null +++ b/scripts/strip.sh @@ -0,0 +1,6 @@ +#gh issue view $ISSUE_NUMBER > issue.md +#gh issue view $ISSUE_NUMBER -c > comments.md + +# strip long
...
from issue.md and comments.md +perl -0777 -i -pe 's/\n
.*?<\/details>//sg' issue.md +perl -0777 -i -pe 's/\n
.*?<\/details>//sg' comments.md