change something for ui compatiblity (#1149)

This commit is contained in:
XianBW
2025-08-04 12:40:35 +08:00
committed by GitHub
parent 4b444097b2
commit 88e346b6b5
3 changed files with 18 additions and 4 deletions
+14 -3
View File
@@ -390,19 +390,30 @@ def evolving_win(data, key, llm_data=None, base_workspace=None):
if evo_id in data:
if state.show_llm_log and llm_data is not None:
llm_log_win(llm_data[evo_id])
if data[evo_id]["evolving code"][0] is not None:
# get evolving workspace
if "evolving code" in data[evo_id] and data[evo_id]["evolving code"][0] is not None:
evolving_code_workspace = data[evo_id]["evolving code"][0]
else:
evolving_code_workspace = None
if evolving_code_workspace is not None:
st.subheader("codes")
workspace_win(
data[evo_id]["evolving code"][0],
evolving_code_workspace,
cmp_workspace=data[evo_id - 1]["evolving code"][0] if evo_id > 0 else base_workspace,
cmp_name="last evolving code" if evo_id > 0 else "base workspace",
)
fb = data[evo_id]["evolving feedback"][0]
st.subheader("evolving feedback" + ("" if bool(fb) else ""))
f1, f2, f3 = st.tabs(["execution", "return_checking", "code"])
f1, f2, f3, f4 = st.tabs(["execution", "return_checking", "code", "others"])
other_attributes = {
k: v for k, v in fb.__dict__.items() if k not in ["execution", "return_checking", "code"]
}
f1.code(fb.execution, wrap_lines=True)
f2.code(fb.return_checking, wrap_lines=True)
f3.code(fb.code, wrap_lines=True)
f4.json(other_attributes)
else:
st.write("data[evo_id]['evolving code'][0] is None.")
st.write(data[evo_id])
@@ -44,6 +44,9 @@ class DSRunnerFeedback(CoSTEERSingleFeedback):
return super().is_acceptable()
DSCoSTEEREvalFeedback = DSRunnerFeedback # FIXME: Alias for backward compatibility
class DSRunnerEvaluator(CoSTEEREvaluator):
def evaluate(
@@ -46,7 +46,7 @@ class DSHypothesis(Hypothesis):
lines.append(f"Hypothesis: {self.hypothesis}")
if self.reason is not None:
lines.append(f"Reason: {self.reason}")
if self.appendix is not None:
if hasattr(self, "appendix") and self.appendix is not None: # FIXME: compatibility with old traces
lines.append(f"Appendix: {self.appendix}")
return "\n".join(lines)