Welly-code commited on
Commit
4b565c9
Β·
verified Β·
1 Parent(s): d628bdf

Fix: respond() now returns history list pairs (tuples), not raw strings

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -53,7 +53,7 @@ def execute(tool_name: str, tool_args: dict) -> str:
53
 
54
  # ─── Response Logic ──────────────────────────────────────────────────────────
55
 
56
- def respond(message: str):
57
  msg = message.lower()
58
 
59
  if any(k in msg for k in ["calculate", "compute", "math", "roi", "compound", "interest", "%", "$"]):
@@ -69,12 +69,12 @@ def respond(message: str):
69
  cmd = m.group(1) if m else message.split()[-1]
70
  tool, args = "run_command", {"command": cmd, "cwd": "."}
71
  else:
72
- return "This is a demo of Stack X Ultimate's tool-calling capability. The fine-tuned model processes your message and decides whether to call a tool. Try one of the examples below! πŸ”§"
73
 
74
  result = execute(tool, args)
75
  call = f"πŸ”§ Calling `{tool}`...\n\n```json\n{json.dumps(args, indent=2)}\n```"
76
  res = f"βœ… **{tool}** result:\n\n```\n{result}\n```"
77
- return [[call, res]]
78
 
79
  # ─── Dark CSS ─────────────────────────────────────────────────────────────
80
 
 
53
 
54
  # ─── Response Logic ──────────────────────────────────────────────────────────
55
 
56
+ def respond(message: str, history: list):
57
  msg = message.lower()
58
 
59
  if any(k in msg for k in ["calculate", "compute", "math", "roi", "compound", "interest", "%", "$"]):
 
69
  cmd = m.group(1) if m else message.split()[-1]
70
  tool, args = "run_command", {"command": cmd, "cwd": "."}
71
  else:
72
+ return history + [[message, "This is a demo of Stack X Ultimate's tool-calling capability. The fine-tuned model processes your message and decides whether to call a tool. Try one of the examples below! πŸ”§"]]
73
 
74
  result = execute(tool, args)
75
  call = f"πŸ”§ Calling `{tool}`...\n\n```json\n{json.dumps(args, indent=2)}\n```"
76
  res = f"βœ… **{tool}** result:\n\n```\n{result}\n```"
77
+ return history + [[call, res]]
78
 
79
  # ─── Dark CSS ─────────────────────────────────────────────────────────────
80