diff --git a/src/toolwrapper/devchat.ts b/src/toolwrapper/devchat.ts index 6111b68..1e643f9 100644 --- a/src/toolwrapper/devchat.ts +++ b/src/toolwrapper/devchat.ts @@ -356,9 +356,17 @@ class DevChat { "response_tokens": 1, ...parent? {"parent": parent} : {} }; + const insertValue = JSON.stringify(logData); + let insertValueOrFile = insertValue; + if (insertValue.length > 4 * 1024) { + const tempDir = os.tmpdir(); + const tempFile = path.join(tempDir, 'devchat_log_insert.json'); + await fs.promises.writeFile(tempFile, insertValue); + insertValueOrFile = tempFile; + } // build args for log insert - const args = ["-m", "devchat", "log", "--insert", JSON.stringify(logData)]; + const args = ["-m", "devchat", "log", "--insert", insertValueOrFile]; const {code, stdout, stderr} = await this.runCommand(args); diff --git a/tools b/tools index ab2abbd..b80f640 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit ab2abbdde678cf757707dc540b81efb465e7b3f5 +Subproject commit b80f6402b6895d022a56598e9285baa39ad92670