diff --git a/apps/agentfabric/server.py b/apps/agentfabric/server.py index 09ffc0a37..6aaa3b0f9 100644 --- a/apps/agentfabric/server.py +++ b/apps/agentfabric/server.py @@ -426,15 +426,21 @@ def generate(): f'load history method: time consumed {time.time() - start_time}' ) + # skip image upsert + filtered_files = [ + item for item in file_paths + if not item.lower().endswith(('.jpeg', '.png', '.jpg')) + ] + use_llm = True if len(user_agent.function_list) else False ref_doc = user_memory.run( query=input_content, - url=file_paths, + url=filtered_files, checked=True, use_llm=use_llm) logger.info( f'load knowledge method: time consumed {time.time() - start_time}, ' - f'the uploaded_file name is {file_paths}') # noqa + f'the uploaded_file name is {filtered_files}') # noqa response = '' diff --git a/modelscope_agent/agent.py b/modelscope_agent/agent.py index 6e8e99828..c48472615 100644 --- a/modelscope_agent/agent.py +++ b/modelscope_agent/agent.py @@ -133,6 +133,10 @@ def _call_tool(self, tool_list: list, **kwargs): try: result = self.function_map[tool_name].call(tool_args, **kwargs) except BaseException as e: + import traceback + print( + f'The error is {e}, and the traceback is {traceback.format_exc()}' + ) result = f'Tool api {tool_name} failed to call. Args: {tool_args}.' result += f'Details: {str(e)[:200]}' self.callback_manager.on_tool_end(tool_name, result) diff --git a/modelscope_agent/tools/dashscope_tools/paraformer_asr_tool.py b/modelscope_agent/tools/dashscope_tools/paraformer_asr_tool.py index c8926101b..67b4330f2 100644 --- a/modelscope_agent/tools/dashscope_tools/paraformer_asr_tool.py +++ b/modelscope_agent/tools/dashscope_tools/paraformer_asr_tool.py @@ -46,6 +46,8 @@ def call(self, params: str, **kwargs): except AssertionError: raise ValueError('Please set valid DASHSCOPE_API_KEY!') + # make sure the audio_path is file name not file path + params['audio_path'] = params['audio_path'].split('/')[-1] if LOCAL_FILE_PATHS not in kwargs or kwargs[LOCAL_FILE_PATHS] == {}: raw_audio_file = WORK_DIR + '/' + params['audio_path'] else: diff --git a/modelscope_agent/tools/dashscope_tools/style_repaint.py b/modelscope_agent/tools/dashscope_tools/style_repaint.py index 5e89bcaa3..c2a56af4b 100644 --- a/modelscope_agent/tools/dashscope_tools/style_repaint.py +++ b/modelscope_agent/tools/dashscope_tools/style_repaint.py @@ -118,6 +118,8 @@ def _parse_input(self, *args, **kwargs): kwargs = restored_dict image_path = kwargs['input'].pop('image_path', None) if image_path and image_path.endswith(('.jpeg', '.png', '.jpg')): + # make sure the image_path is a valid image file we only get the name of the file + image_path = image_path.split('/')[-1] # 生成 image_url,然后设置到 kwargs['input'] 中 # 复用dashscope公共oss if LOCAL_FILE_PATHS not in kwargs or kwargs[ diff --git a/modelscope_agent_servers/tool_node_server/api.py b/modelscope_agent_servers/tool_node_server/api.py index 838ad01b1..7f36458ab 100644 --- a/modelscope_agent_servers/tool_node_server/api.py +++ b/modelscope_agent_servers/tool_node_server/api.py @@ -132,6 +132,9 @@ async def execute_tool(request: ToolRequest): result = await result return create_success_msg(result, request_id=request.request_id) except Exception as e: + import traceback + print( + f'The error is {e}, and the traceback is {traceback.format_exc()}') return create_error_msg( status_code=400, request_id=request.request_id,