Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ai
/
ai-workflow
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a4eeb8db
authored
Jul 13, 2026
by
sunqi02
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 更新发送消息功能,支持从环境变量加载IM服务的基础URL和API密钥
1 parent
97a47fde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
workspace/agent-admin/backend/app/jobs/runner.py
workspace/agent-admin/backend/app/jobs/runner.py
View file @
a4eeb8d
...
...
@@ -134,6 +134,8 @@ def send_im_message(
True 发送成功 / False 发送失败
"""
settings
=
ConfigLoader
()
.
load_settings
()
base_url
=
os
.
getenv
(
"IM_BASE_URL"
,
settings
.
im
.
base_url
)
api_key
=
os
.
getenv
(
"IM_API_KEY"
,
settings
.
im
.
api_key
)
or
settings
.
im
.
api_key
payload
=
{
"contact_id"
:
group_id
,
"content"
:
content
,
...
...
@@ -142,10 +144,10 @@ def send_im_message(
"biz_rela_no"
:
f
"biz-msg-{int(time.time() * 1000)}"
,
}
headers
=
{
"Content-Type"
:
"application/json"
}
if
settings
.
im
.
api_key
:
headers
[
"X-Api-Key"
]
=
settings
.
im
.
api_key
if
api_key
:
headers
[
"X-Api-Key"
]
=
api_key
url
=
f
"{
settings.im.
base_url}/api/v1/business/messages/send"
url
=
f
"{base_url}/api/v1/business/messages/send"
try
:
resp
=
httpx
.
post
(
url
,
json
=
payload
,
headers
=
headers
,
timeout
=
10
)
resp
.
raise_for_status
()
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment