Skip to content

Commit

Permalink
修改manifests改动对应的单测
Browse files Browse the repository at this point in the history
  • Loading branch information
yepeiwen01 committed Dec 23, 2024
1 parent 27b37c6 commit 032622d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/core/components/v2/tree_mind/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
r"""树图工具"""

import json
from urllib.parse import urlparse, unquote
from typing import Dict, List, Optional, Any
from appbuilder.core.message import Message
from appbuilder.core._client import HTTPClient
Expand Down Expand Up @@ -83,6 +84,17 @@ def _post(self, query, **kwargs):
img_link = treemind_response.info.downloadInfo.fileInfo.pic
return img_link, jump_link

@staticmethod
def get_filename_from_url(url):
"""从给定URL中提取文件名"""
parsed_url = urlparse(url)
# 提取路径部分
path = parsed_url.path
# 从路径中获取文件名
filename = path.split('/')[-1]
# 解码URL编码的文件名
return unquote(filename)

@components_run_stream_trace
def tool_eval(
self,
Expand Down Expand Up @@ -115,6 +127,7 @@ def tool_eval(
img_link_result = self.create_output(
type="image",
text={
"filename": self.get_filename_from_url(img_link),
"url": img_link
},
visible_scope='all',
Expand Down

0 comments on commit 032622d

Please sign in to comment.