mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-11 18:49:02 +08:00
fix(onebot): use yarl to format url (#7589)
This commit is contained in:
parent
8807d880dc
commit
e3d7c7c6f9
@ -1,6 +1,7 @@
|
||||
from typing import Any, Union
|
||||
|
||||
import requests
|
||||
from yarl import URL
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
@ -29,9 +30,10 @@ class SendGroupMsg(BuiltinTool):
|
||||
auto_escape = tool_parameters.get('auto_escape', False)
|
||||
|
||||
try:
|
||||
url = URL(self.runtime.credentials['ob11_http_url']) / 'send_group_msg'
|
||||
|
||||
resp = requests.post(
|
||||
f'{self.runtime.credentials['ob11_http_url']}/send_group_msg',
|
||||
url,
|
||||
json={
|
||||
'group_id': send_group_id,
|
||||
'message': message,
|
||||
|
@ -1,6 +1,7 @@
|
||||
from typing import Any, Union
|
||||
|
||||
import requests
|
||||
from yarl import URL
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
@ -29,8 +30,10 @@ class SendPrivateMsg(BuiltinTool):
|
||||
auto_escape = tool_parameters.get('auto_escape', False)
|
||||
|
||||
try:
|
||||
url = URL(self.runtime.credentials['ob11_http_url']) / 'send_private_msg'
|
||||
|
||||
resp = requests.post(
|
||||
f'{self.runtime.credentials['ob11_http_url']}/send_private_msg',
|
||||
url,
|
||||
json={
|
||||
'user_id': send_user_id,
|
||||
'message': message,
|
||||
|
Loading…
x
Reference in New Issue
Block a user