Fix:Agent running message i10n (#7635)

### What problem does this PR solve?

Close #7612

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu
2025-05-14 14:27:12 +08:00
committed by GitHub
parent 4ac61fc470
commit ce81e470e3
12 changed files with 51 additions and 19 deletions

View File

@ -113,6 +113,7 @@ def getsse(canvas_id):
def run():
req = request.json
stream = req.get("stream", True)
running_hint_text = req.get("running_hint_text", "")
e, cvs = UserCanvasService.get_by_id(req["id"])
if not e:
return get_data_error_result(message="canvas not found.")
@ -138,7 +139,7 @@ def run():
def sse():
nonlocal answer, cvs
try:
for ans in canvas.run(stream=True):
for ans in canvas.run(running_hint_text = running_hint_text, stream=True):
if ans.get("running_status"):
yield "data:" + json.dumps({"code": 0, "message": "",
"data": {"answer": ans["content"],
@ -176,7 +177,7 @@ def run():
resp.headers.add_header("Content-Type", "text/event-stream; charset=utf-8")
return resp
for answer in canvas.run(stream=False):
for answer in canvas.run(running_hint_text = running_hint_text, stream=False):
if answer.get("running_status"):
continue
final_ans["content"] = "\n".join(answer["content"]) if "content" in answer else ""