Skip to content

Commit

Permalink
Cleaner DEBUG=1 Output
Browse files Browse the repository at this point in the history
Modified `debugEvent` function in `src/helpers.js` to remove instructions from event data when logging in DEBUG mode, preventing large instruction strings from cluttering debug output.
  • Loading branch information
metaskills committed Aug 30, 2024
1 parent 7414d83 commit 53f7116
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

See this http://keepachangelog.com link for information on how we want this document formatted.

## v1.5.8

### Changed

- Modified `debugEvent` function in `src/helpers.js` to remove instructions from event data when logging in DEBUG mode, preventing large instruction strings from cluttering debug output.

## v1.5.5, v1.5.6, v1.5.7

### Fixed
Expand Down Expand Up @@ -157,3 +163,10 @@ However, not all make sense with Experts.js.
### Added

- Initial Release

# Changelog

## [Unreleased]

### Changed
- Modified `debugEvent` function in `src/helpers.js` to remove instructions from event data when logging in DEBUG mode, preventing large instruction strings from cluttering debug output.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "experts",
"version": "1.5.7",
"version": "1.5.8",
"description": "An opinionated panel of experts implementation using OpenAI's Assistants API",
"type": "module",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const debug = (message) => {
const debugEvent = (event) => {
if (!DEBUG) return;
if (event.event.includes("delta") && !DEBUG_DELTAS) return;
debug(`📡 Event: ${JSON.stringify(event)}`);
const eventCopy = JSON.parse(JSON.stringify(event));
if (eventCopy.data && eventCopy.data.instructions) {
eventCopy.data.instructions = "[INSTRUCTIONS REMOVED]";
}
debug(`📡 Event: ${JSON.stringify(eventCopy)}`);
};

const messagesContent = (messages) => {
Expand Down

0 comments on commit 53f7116

Please sign in to comment.