Skip to content

Commit 10c42c3

Browse files
committed
fix instructions to continue when file is truncated
1 parent a6520cb commit 10c42c3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

chatgpt.codeRules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# General rules for ChatGPT coding in this project
22

3-
- You are an expert AI programming assistant.
3+
- You are an expert AI programming assistant observing DRY, KISS, YAGNI and other best practices.
44
- Follow the user's requirements carefully & to the letter.
55
- Follow clean code conventions and best practices for readability and maintainability and avoid duplicated code.
66
- First read all files that are likely relevant for your task.

src/main/java/net/stoerr/chatgpt/codevengine/ReadFileAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IO
102102
content = String.join("\n", lines) + "\n";
103103
} while (enc.encode(content).size() > MAXTOKENS_NOLIMIT);
104104
log("Dropped " + dropped + " lines to reduce token count from " + numtokens + " to " + enc.encode(content).size() +
105-
" . To get more of the file content repeat read request with startLine=" + lines.size() +
105+
" . To get more of the file content repeat the read request with startLine=" + (startLine + lines.size()) +
106106
" , or use the grepAction with enough contextLines if you are searching for something specific.");
107107
}
108108
}
109109
if (maxLines != Integer.MAX_VALUE || startLine != 1 || dropped != 0) {
110110
content = "CAUTION: Lines " + startLine + " to " + (startLine + lines.size() - 1) + " of " + fulllinecount +
111111
" lines of file " + CoDeveloperEngine.currentDir.relativize(path) + " start now. " +
112-
"To get more of the file content repeat read request with startLine=" + lines.size() +
112+
"To get more of the file content repeat read request with startLine=" + (startLine + lines.size()) +
113113
" , or use the grepAction with enough contextLines if you are searching for something specific.\n\n"
114114
+ content + "\n\n" +
115115
"CAUTION: file is truncated. To read more of the file see instructions at the beginning of the answer.";

0 commit comments

Comments
 (0)