Skip to content

Commit

Permalink
fix llm app bug
Browse files Browse the repository at this point in the history
  • Loading branch information
XianBW committed Dec 24, 2024
1 parent 39abb25 commit a6505d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rdagent/log/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ def log_object(self, obj: object, *, tag: str = "") -> None:
debug_log_path = self.log_trace_path / "debug_llm.pkl"
debug_data = {"tag": tag, "obj": obj}
if debug_log_path.exists():
with debug_log_path.open("rb+") as f:
with debug_log_path.open("rb") as f:
existing_data = pickle.load(f)
existing_data.append(debug_data)
f.seek(0)
existing_data.append(debug_data)
with debug_log_path.open("wb") as f:
pickle.dump(existing_data, f)
else:
with debug_log_path.open("wb") as f:
Expand Down
2 changes: 1 addition & 1 deletion rdagent/log/ui/llm_st.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

def load_data():
try:
with open(f"{main_log_path}/{session_state.log_path}/debug_llm.pkl", "r") as f:
with open(f"{main_log_path}/{session_state.log_path}/debug_llm.pkl", "rb") as f:
session_state.data = pickle.load(f)
except Exception as e:
session_state.data = [{"error": str(e)}]
Expand Down

0 comments on commit a6505d1

Please sign in to comment.