From 4fdcb30ff84cdca317593ad5eadac3abbe6bb387 Mon Sep 17 00:00:00 2001 From: guogeer <1500065870@qq.com> Date: Sun, 14 Jul 2024 22:11:13 +0800 Subject: [PATCH] fix: custom tool input number fail (#6200) Co-authored-by: jinqi.guo --- api/core/app/apps/advanced_chat/app_runner.py | 6 ++++++ api/core/tools/tool/api_tool.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/core/app/apps/advanced_chat/app_runner.py b/api/core/app/apps/advanced_chat/app_runner.py index 96e9319dda58d2..38566217007f46 100644 --- a/api/core/app/apps/advanced_chat/app_runner.py +++ b/api/core/app/apps/advanced_chat/app_runner.py @@ -255,6 +255,12 @@ def _stream_output(self, queue_manager: AppQueueManager, ) index += 1 time.sleep(0.01) + else: + queue_manager.publish( + QueueTextChunkEvent( + text=text + ), PublishFrom.APPLICATION_MANAGER + ) queue_manager.publish( QueueStopEvent(stopped_by=stopped_by), diff --git a/api/core/tools/tool/api_tool.py b/api/core/tools/tool/api_tool.py index c8b683f9ef14ac..69e3dfa0612e8a 100644 --- a/api/core/tools/tool/api_tool.py +++ b/api/core/tools/tool/api_tool.py @@ -238,7 +238,7 @@ def _convert_body_property_type(self, property: dict[str, Any], value: Any) -> A return int(value) elif property['type'] == 'number': # check if it is a float - if '.' in value: + if '.' in str(value): return float(value) else: return int(value)