Merge pull request #1 from CloudDetail/feat/search

extend apo tool api entities
pull/17608/head
fuwx 1 year ago committed by GitHub
commit ec3c37a183
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 35 KiB

@ -3,12 +3,12 @@ identity:
name: apo_analysis name: apo_analysis
label: label:
en_US: APOAnalysis en_US: APOAnalysis
zh_Hans: APO异常检测 zh_Hans: APO数据异常检测&关联
pt_BR: APOSelect pt_BR: APOAnalysis
description: description:
en_US: A tool for getting the current time. en_US: Input observable data, identify abnormal data through relevant algorithms, or directly correlate and summarize the data.
zh_Hans: APO异常检测分析 zh_Hans: 输入可观测性数据, 通过相关算法识别出现异常数据、或者直接对数据进行关联汇总
pt_BR: A tool for getting the current time. pt_BR: Input observable data, identify abnormal data through relevant algorithms, or directly correlate and summarize the data.
icon: icon.svg icon: icon.svg
tags: tags:
- utilities - utilities

@ -15,9 +15,9 @@ class AlertAssociateTool(BuiltinTool):
app_id: Optional[str] = None, app_id: Optional[str] = None,
message_id: Optional[str] = None, message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
metric = tool_parameters.get('topology_data') metric = tool_parameters.get('topologyData')
topology_data = json.loads(metric)['data'] topology_data = json.loads(metric)['data']
alert_data = json.loads(tool_parameters.get('alert_data'))['data'] alert_data = json.loads(tool_parameters.get('alertData'))['data']
alert = self.process_alert(alert_data) alert = self.process_alert(alert_data)
topology = self.process_topology(topology_data, alert) topology = self.process_topology(topology_data, alert)

@ -8,33 +8,33 @@ identity:
description: description:
human: human:
en_US: A tool for alert_associate en_US: A tool for alert_associate
zh_Hans: 关联拓扑和告警数据 zh_Hans: 关联拓扑和告警数据, 用于大模型推理
pt_BR: A tool for alert_associate pt_BR: A tool for alert_associate
llm: A tool for alert_associate llm: A tool for alert_associate
parameters: parameters:
- name: topology_data - name: topologyData
type: string type: string
required: true required: true
label: label:
en_US: topology_data en_US: topologyData
zh_Hans: 拓扑数据 zh_Hans: topologyData
pt_BR: topology_data pt_BR: topologyData
human_description: human_description:
en_US: topology_data en_US: topologyData
zh_Hans: 拓扑数据 zh_Hans: 入口服务拓扑结构数据
pt_BR: topology_data pt_BR: topology_data
llm_description: topology data llm_description: topology data
form: llm form: llm
- name: alert_data - name: alertData
type: string type: string
required: false required: true
label: label:
en_US: alert_data en_US: alertData
zh_Hans: 告警事件数据 zh_Hans: alertData
pt_BR: alert_data pt_BR: alertData
human_description: human_description:
en_US: alert_data en_US: alertData
zh_Hans: 告警事件数据 zh_Hans: 入口服务告警事件数据
pt_BR: alert_data pt_BR: alertData
llm_description: alert event data llm_description: alert data
form: llm form: llm

@ -15,7 +15,7 @@ class ThresholdTool(BuiltinTool):
app_id: Optional[str] = None, app_id: Optional[str] = None,
message_id: Optional[str] = None, message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
metric = tool_parameters.get('metric_data') metric = tool_parameters.get('metricData')
metric_data = json.loads(metric) metric_data = json.loads(metric)
threshold = float(tool_parameters.get('threshold')) threshold = float(tool_parameters.get('threshold'))
res = {} res = {}

@ -7,34 +7,34 @@ identity:
pt_BR: threshold pt_BR: threshold
description: description:
human: human:
en_US: A tool for getting the current time en_US: threshold judgement
zh_Hans: 阈值判定 zh_Hans: 阈值判定
pt_BR: A tool for getting the current time pt_BR: threshold judgement
llm: A tool for getting the current time llm: threshold judgement
parameters: parameters:
- name: metric_data - name: metricData
type: string type: string
required: true required: true
label: label:
en_US: metric_data en_US: metricData
zh_Hans: 指标数据 zh_Hans: metricData
pt_BR: metric_data pt_BR: metricData
human_description: human_description:
en_US: Time format in strftime standard en_US: time series metric data
zh_Hans: 时序指标数据 zh_Hans: 时序指标数据
pt_BR: Time format in strftime standard pt_BR: time series metric data
llm_description: metric type data llm_description: Time series indicator data
form: llm form: llm
- name: threshold - name: threshold
type: string type: string
required: false required: true
label: label:
en_US: threshold en_US: threshold
zh_Hans: 阈值 zh_Hans: threshold
pt_BR: threshold pt_BR: threshold
human_description: human_description:
en_US: Time format in strftime standard en_US: threshold
zh_Hans: 阈值判定 zh_Hans: 检测指标类型数据是否超过阈值
pt_BR: Time format in strftime standard pt_BR: threshold
llm_description: data threshold judgement llm_description: threshold
form: llm form: llm

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 35 KiB

@ -4,11 +4,11 @@ identity:
label: label:
en_US: APORule en_US: APORule
zh_Hans: APO规则执行 zh_Hans: APO规则执行
pt_BR: APOSelect pt_BR: APORule
description: description:
en_US: APO execute rule. en_US: The user inputs the rules described in natural language for large model reasoning
zh_Hans: APO规则执行 zh_Hans: 用户输入自然语言描述的规则,用于大模型推理
pt_BR: APO execute rule. pt_BR: The user inputs the rules described in natural language for large model reasoning
icon: icon.svg icon: icon.svg
tags: tags:
- utilities - utilities

@ -3,12 +3,12 @@ identity:
author: APO author: APO
label: label:
en_US: alert_rule en_US: alert_rule
zh_Hans: 告警规则执行 zh_Hans: 规则执行
pt_BR: alert_rule pt_BR: alert_rule
description: description:
human: human:
en_US: alert rule execute en_US: alert rule execute
zh_Hans: 告警规则执行 zh_Hans: 规则执行
pt_BR: alert rule execute pt_BR: alert rule execute
llm: alert rule execute llm: alert rule execute
parameters: parameters:
@ -27,10 +27,10 @@ parameters:
# form: llm # form: llm
- name: rule - name: rule
type: string type: string
required: false required: true
label: label:
en_US: rule en_US: rule
zh_Hans: 自然语言描述的规则 zh_Hans: rule
pt_BR: rule pt_BR: rule
human_description: human_description:
en_US: rule en_US: rule

@ -18,7 +18,7 @@ class RootCauseTool(BuiltinTool):
""" """
invoke tools invoke tools
""" """
llm_text = tool_parameters.get("llm_text") llm_text = tool_parameters.get("text")
node_lists, text = self._get_node_list(llm_text) node_lists, text = self._get_node_list(llm_text)
yield self.create_text_message(text) yield self.create_text_message(text)

@ -8,20 +8,20 @@ identity:
description: description:
human: human:
en_US: get root cause en_US: get root cause
zh_Hans: 获取根因节点 zh_Hans: 从大模型返回结果获取根因节点
pt_BR: get root cause pt_BR: get root cause
llm: get root cause node llm: get root cause node
parameters: parameters:
- name: llm_text - name: text
type: string type: string
required: false required: false
label: label:
en_US: llm_text en_US: text
zh_Hans: 大模型返回结果 zh_Hans: text
pt_BR: llm_text pt_BR: text
human_description: human_description:
en_US: llm_text en_US: llm text
zh_Hans: 大模型返回结果 zh_Hans: 大模型返回文本结果
pt_BR: llm_text pt_BR: llm text
llm_description: rule llm_description: rule
form: llm form: llm

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 35 KiB

@ -3,12 +3,12 @@ identity:
name: apo_select name: apo_select
label: label:
en_US: APOSelect en_US: APOSelect
zh_Hans: APO查询数据 zh_Hans: APO平台查询可观测性数据
pt_BR: APOSelect pt_BR: APOSelect
description: description:
en_US: APO query data. en_US: Query APO data.
zh_Hans: APO查询数据的工具。 zh_Hans: 查询APO平台可观测性数据, 用于进一步分析
pt_BR: APO query data. pt_BR: Query APO data.
icon: icon.svg icon: icon.svg
tags: tags:
- utilities - utilities

@ -20,8 +20,8 @@ class AlertTool(BuiltinTool):
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
service = tool_parameters.get("service") service = tool_parameters.get("service")
endpoint = tool_parameters.get("endpoint") endpoint = tool_parameters.get("endpoint")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
params = { params = {
'service': service, 'service': service,
'endpoint': endpoint, 'endpoint': endpoint,

@ -2,27 +2,30 @@ identity:
name: alert name: alert
author: APO author: APO
label: label:
en_US: toplogy en_US: Query the entry service alert events
zh_Hans: 获取当前入口拓扑的告警事件 zh_Hans: 查询入口服务告警事件
pt_BR: toplogy pt_BR: Query the entry service alert events
description: description:
human: human:
en_US: A tool for getting the current time. en_US: Query the entry service alert events
zh_Hans: 获取当前入口拓扑的告警事件 zh_Hans: 查询入口服务告警事件
pt_BR: A tool for getting the current time. pt_BR: Query the entry service alert events
llm: A tool for getting the current time. llm: Query the entry service alert events
display:
type: alert
unit: alert
parameters: parameters:
- name: service - name: service
type: string type: string
required: true required: true
label: label:
en_US: service en_US: service
zh_Hans: 服务名 zh_Hans: service
pt_BR: service pt_BR: service
human_description: human_description:
en_US: Time format in strftime standard. en_US: entry service
zh_Hans: 拓扑入口服务名 zh_Hans: 拓扑入口服务名
pt_BR: Time format in strftime standard. pt_BR: entry service
llm_description: toplogy service name llm_description: toplogy service name
form: llm form: llm
- name: endpoint - name: endpoint
@ -30,37 +33,37 @@ parameters:
required: true required: true
label: label:
en_US: endpoint en_US: endpoint
zh_Hans: 服务端点 zh_Hans: endpoint
pt_BR: endpoint pt_BR: endpoint
human_description: human_description:
en_US: Time format in strftime standard. en_US: toplogy endpoint
zh_Hans: 拓扑入口服务端点 zh_Hans: 拓扑入口服务端点
pt_BR: Time format in strftime standard. pt_BR: toplogy endpoint
llm_description: toplogy endpoint llm_description: toplogy endpoint
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 查询开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询的结束时间 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm

@ -18,9 +18,9 @@ class SelectContainerCPUTool(BuiltinTool):
app_id: Optional[str] = None, app_id: Optional[str] = None,
message_id: Optional[str] = None, message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
container_name = tool_parameters.get("container_name") container_name = tool_parameters.get("container")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
pmql = 'rate(container_cpu_usage_seconds_total{container="' + container_name + '"}[1m])' pmql = 'rate(container_cpu_usage_seconds_total{container="' + container_name + '"}[1m])'
params = { params = {
'query': pmql, 'query': pmql,

@ -2,52 +2,55 @@ identity:
name: select_container_cpu name: select_container_cpu
author: APO author: APO
label: label:
en_US: select_container_cpu en_US: Query the CPU utilization of the container
zh_Hans: 查询容器CPU占用 zh_Hans: 查询容器CPU利用率
pt_BR: select_container_cpu pt_BR: Query the CPU utilization of the container
display:
type: cpu
unit: precent
description: description:
human: human:
en_US: A tool for getting container cpu. en_US: Query the CPU utilization of the container
zh_Hans: 查询容器CPU占用 zh_Hans: 查询容器CPU利用率
pt_BR: A tool for getting container cpu. pt_BR: Query the CPU utilization of the container
llm: A tool for getting container cpu. llm: Query the CPU utilization of the container
parameters: parameters:
- name: container_name - name: container
type: string type: string
required: true required: true
label: label:
en_US: container_name en_US: container
zh_Hans: 容器名 zh_Hans: container
pt_BR: container_name pt_BR: container
human_description: human_description:
en_US: Time format in strftime standard. en_US: Specified container name
zh_Hans: 查询指定Pod的CPU占用。 zh_Hans: 指定的容器名称
pt_BR: Time format in strftime standard. pt_BR: Specified container name
llm_description: Time format in strftime standard. llm_description: Specified container name
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 指定查询CPU指标的开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询CPU指标的结束时间。 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm

@ -18,9 +18,9 @@ class SelectContainerRSSTool(BuiltinTool):
app_id: Optional[str] = None, app_id: Optional[str] = None,
message_id: Optional[str] = None, message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
container_name = tool_parameters.get("container_name") container_name = tool_parameters.get("container")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
pmql = 'container_memory_rss{container="' + container_name + '"}' pmql = 'container_memory_rss{container="' + container_name + '"}'
params = { params = {
'query': pmql, 'query': pmql,

@ -2,52 +2,55 @@ identity:
name: select_container_rss name: select_container_rss
author: APO author: APO
label: label:
en_US: select_container_rss en_US: Query container resident memory usage
zh_Hans: 查询容器驻留内存 zh_Hans: 查询容器驻留内存使用量
pt_BR: select_container_rss pt_BR: Query container resident memory usage
description: description:
human: human:
en_US: A tool for getting container rss. en_US: Query container resident memory usage
zh_Hans: 查询容器CPU占用 zh_Hans: 查询容器驻留内存使用量
pt_BR: A tool for getting container rss. pt_BR: Query container resident memory usage
llm: A tool for getting container rss. llm: Query container resident memory usage
display:
type: memory
unit: bytes
parameters: parameters:
- name: container_name - name: container
type: string type: string
required: true required: true
label: label:
en_US: container_name en_US: container
zh_Hans: 容器名 zh_Hans: container
pt_BR: container_name pt_BR: container
human_description: human_description:
en_US: Time format in strftime standard. en_US: Specified container name
zh_Hans: 查询指定Pod的CPU占用。 zh_Hans: 指定的容器名称
pt_BR: Time format in strftime standard. pt_BR: Specified container name
llm_description: Time format in strftime standard. llm_description: Specified container name
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 指定查询CPU指标的开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询CPU指标的结束时间。 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm

@ -19,8 +19,8 @@ class FaultLogTool(BuiltinTool):
message_id: Optional[str] = None, message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
service = tool_parameters.get("service") service = tool_parameters.get("service")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
params = { params = {
'service': [service], 'service': [service],
'startTime': start_time, 'startTime': start_time,

@ -2,52 +2,55 @@ identity:
name: fault_log name: fault_log
author: APO author: APO
label: label:
en_US: fault_log en_US: Query service log data
zh_Hans: 获取故障现场日志 zh_Hans: 查询服务日志数据
pt_BR: fault_log pt_BR: Query service log data
description: description:
human: human:
en_US: A tool for getting fault log. en_US: Query service log data
zh_Hans: 查询容器CPU占用 zh_Hans: 查询服务日志数据
pt_BR: A tool for getting fault log. pt_BR: Query service log data
llm: A tool for getting fault log. llm: Query service log data
display:
type: log
unit: log
parameters: parameters:
- name: service - name: service
type: string type: string
required: true required: true
label: label:
en_US: service en_US: service
zh_Hans: 服务名 zh_Hans: service
pt_BR: service pt_BR: service
human_description: human_description:
en_US: Time format in strftime standard. en_US: service name
zh_Hans: 查询指定Pod的CPU占用。 zh_Hans: 查询的日志服务名
pt_BR: Time format in strftime standard. pt_BR: service name
llm_description: Time format in strftime standard. llm_description: service name
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 指定查询CPU指标的开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询CPU指标的结束时间。 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm

@ -22,8 +22,8 @@ class FaultLogTool(BuiltinTool):
endpoint = tool_parameters.get("endpoint") endpoint = tool_parameters.get("endpoint")
entryService = tool_parameters.get("entryService") entryService = tool_parameters.get("entryService")
entryEndpoint = tool_parameters.get("entryEndpoint") entryEndpoint = tool_parameters.get("entryEndpoint")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
type = tool_parameters.get("type") type = tool_parameters.get("type")
params = { params = {

@ -11,6 +11,9 @@ description:
zh_Hans: 获取节点信息 zh_Hans: 获取节点信息
pt_BR: A tool for getting fault log. pt_BR: A tool for getting fault log.
llm: A tool for getting fault log. llm: A tool for getting fault log.
display:
type: info
unit: info
parameters: parameters:
- name: entryService - name: entryService
type: string type: string
@ -64,31 +67,31 @@ parameters:
pt_BR: Time format in strftime standard. pt_BR: Time format in strftime standard.
llm_description: toplogy endpoint llm_description: toplogy endpoint
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 指定查询CPU指标的开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询CPU指标的结束时间。 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: type - name: type
type: string type: string

@ -18,9 +18,9 @@ class SelectCPUTool(BuiltinTool):
app_id: Optional[str] = None, app_id: Optional[str] = None,
message_id: Optional[str] = None, message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
node_name = tool_parameters.get("node_name") node_name = tool_parameters.get("nodeName")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
sumql = 'sum by (instance_name) (avg by (mode, instance_name)' sumql = 'sum by (instance_name) (avg by (mode, instance_name)'
pmql = sumql + ' (rate(node_cpu_seconds_total{mode!="idle", instance_name="' + node_name + '"}[1m])))' pmql = sumql + ' (rate(node_cpu_seconds_total{mode!="idle", instance_name="' + node_name + '"}[1m])))'
params = { params = {

@ -2,52 +2,55 @@ identity:
name: select_cpu name: select_cpu
author: APO author: APO
label: label:
en_US: select_cpu en_US: Query the CPU utilization of the host
zh_Hans: 查询CPU主机指标 zh_Hans: 查询主机CPU利用率
pt_BR: select_cpu pt_BR: Query the CPU utilization of the host
description: description:
human: human:
en_US: A tool for getting the current time. en_US: Query the CPU utilization of the host
zh_Hans: 查询CPU主机指标 zh_Hans: 查询主机CPU利用率
pt_BR: A tool for getting the current time. pt_BR: Query the CPU utilization of the host
llm: A tool for getting the current time. llm: Query the CPU utilization of the host
display:
type: cpu
unit: precent
parameters: parameters:
- name: node_name - name: nodeName
type: string type: string
required: true required: true
label: label:
en_US: node_name en_US: nodeName
zh_Hans: 主机名 zh_Hans: nodeName
pt_BR: node_name pt_BR: nodeName
human_description: human_description:
en_US: Time format in strftime standard. en_US: Specified host name
zh_Hans: 指定查询CPU所在的主机名 zh_Hans: 指定的主机名
pt_BR: Time format in strftime standard. pt_BR: Specified host name
llm_description: Time format in strftime standard. llm_description: Specified host name
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 指定查询CPU指标的开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询CPU指标的结束时间。 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm

@ -20,8 +20,8 @@ class TopologyTool(BuiltinTool):
) -> Generator[ToolInvokeMessage, None, None]: ) -> Generator[ToolInvokeMessage, None, None]:
service = tool_parameters.get("service") service = tool_parameters.get("service")
endpoint = tool_parameters.get("endpoint") endpoint = tool_parameters.get("endpoint")
start_time = tool_parameters.get("start_time") start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("end_time") end_time = tool_parameters.get("endTime")
params = { params = {
'service': service, 'service': service,
'endpoint': endpoint, 'endpoint': endpoint,

@ -2,27 +2,30 @@ identity:
name: topology name: topology
author: APO author: APO
label: label:
en_US: topology en_US: Query the entry service topology
zh_Hans: 获取当前入口的拓扑结构 zh_Hans: 查询入口服务拓扑结构
pt_BR: topology pt_BR: Query the entry service topology
description: description:
human: human:
en_US: A tool for getting the current time. en_US: Query the entry service topology
zh_Hans: 获取当前入口的拓扑结构 zh_Hans: 查询入口服务拓扑结构
pt_BR: A tool for getting the current time. pt_BR: Query the entry service topology
llm: A tool for getting the current time. llm: Query the entry service topology
display:
type: topology
unit: topology
parameters: parameters:
- name: service - name: service
type: string type: string
required: true required: true
label: label:
en_US: service en_US: service
zh_Hans: 服务名 zh_Hans: service
pt_BR: service pt_BR: service
human_description: human_description:
en_US: Time format in strftime standard. en_US: entry service
zh_Hans: 拓扑入口服务名 zh_Hans: 拓扑入口服务名
pt_BR: Time format in strftime standard. pt_BR: entry service
llm_description: toplogy service name llm_description: toplogy service name
form: llm form: llm
- name: endpoint - name: endpoint
@ -30,37 +33,37 @@ parameters:
required: true required: true
label: label:
en_US: endpoint en_US: endpoint
zh_Hans: 服务端点 zh_Hans: endpoint
pt_BR: endpoint pt_BR: endpoint
human_description: human_description:
en_US: Time format in strftime standard. en_US: toplogy endpoint
zh_Hans: 拓扑入口服务端点 zh_Hans: 拓扑入口服务端点
pt_BR: Time format in strftime standard. pt_BR: toplogy endpoint
llm_description: toplogy endpoint llm_description: toplogy endpoint
form: llm form: llm
- name: start_time - name: startTime
type: number type: number
required: false required: true
label: label:
en_US: start_time en_US: startTime
zh_Hans: 开始时间 zh_Hans: startTime
pt_BR: start_time pt_BR: startTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query start time
zh_Hans: 查询开始时间。 zh_Hans: 开始时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query start time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm
- name: end_time - name: endTime
type: number type: number
required: false required: true
label: label:
en_US: end_time en_US: endTime
zh_Hans: 结束时间 zh_Hans: endTime
pt_BR: end_time pt_BR: endTime
human_description: human_description:
en_US: Time format in strftime standard. en_US: Data query end time
zh_Hans: 指定查询的结束时间 zh_Hans: 结束时间 (微秒)
pt_BR: Time format in strftime standard. pt_BR: Data query end time
llm_description: Time format in strftime standard. llm_description: Data query start time
form: llm form: llm

@ -6,6 +6,7 @@ from core.model_runtime.utils.encoders import jsonable_encoder
from core.tools.__base.tool import ToolParameter from core.tools.__base.tool import ToolParameter
from core.tools.entities.common_entities import I18nObject from core.tools.entities.common_entities import I18nObject
from core.tools.entities.tool_entities import ToolProviderType from core.tools.entities.tool_entities import ToolProviderType
from core.tools.entities.tool_entities import APODisPlay
class ToolApiEntity(BaseModel): class ToolApiEntity(BaseModel):
@ -16,6 +17,7 @@ class ToolApiEntity(BaseModel):
parameters: Optional[list[ToolParameter]] = None parameters: Optional[list[ToolParameter]] = None
labels: list[str] = Field(default_factory=list) labels: list[str] = Field(default_factory=list)
output_schema: Optional[dict] = None output_schema: Optional[dict] = None
display: Optional[APODisPlay] = None
ToolProviderTypeApiLiteral = Optional[Literal["builtin", "api", "workflow"]] ToolProviderTypeApiLiteral = Optional[Literal["builtin", "api", "workflow"]]

@ -318,10 +318,14 @@ class ToolDescription(BaseModel):
human: I18nObject = Field(..., description="The description presented to the user") human: I18nObject = Field(..., description="The description presented to the user")
llm: str = Field(..., description="The description presented to the LLM") llm: str = Field(..., description="The description presented to the LLM")
class APODisPlay(BaseModel):
type: str = Field(..., description="The type of the apo data display")
unit: str = Field(..., description="The unit of the apo data display")
class ToolEntity(BaseModel): class ToolEntity(BaseModel):
identity: ToolIdentity identity: ToolIdentity
parameters: list[ToolParameter] = Field(default_factory=list) parameters: list[ToolParameter] = Field(default_factory=list)
display: Optional[APODisPlay] = None
description: Optional[ToolDescription] = None description: Optional[ToolDescription] = None
output_schema: Optional[dict] = None output_schema: Optional[dict] = None
has_runtime_parameters: bool = Field(default=False, description="Whether the tool has runtime parameters") has_runtime_parameters: bool = Field(default=False, description="Whether the tool has runtime parameters")

@ -0,0 +1,3 @@
#!/bin/bash
docker run -d --name dify-api --network host --pid host -v /root/workspace/dify/api/.env:/app/api/.env -v /root/workspace/dify/docker/volumes/app/storage:/app/api/storage -e MIGRATION_ENABLED="true" -e DEBUG="true" -e MODE="api" registry.cn-hangzhou.aliyuncs.com/kindlingx/dify-api:apo-1.0.0-9d88021

@ -0,0 +1,3 @@
#!/bin/bash
docker run -d --name dify-worker --network host --pid host -v /root/workspace/dify/api/.env:/app/api/.env -v /root/workspace/dify/docker/volumes/app/storage:/app/api/storage -e MODE="worker" registry.cn-hangzhou.aliyuncs.com/kindlingx/dify-api:apo-1.0.0-9d88021

@ -359,7 +359,7 @@ class BuiltinToolManageService:
match_tools = process.extract( match_tools = process.extract(
query, query,
[tool.entity.description.human.zh_Hans for tool in tools], [tool.entity.description.human.zh_Hans for tool in tools],
limit=3, limit=5,
) )
for match_name, score, index in match_tools or []: for match_name, score, index in match_tools or []:
tool = tools[index] tool = tools[index]

@ -286,6 +286,7 @@ class ToolTransformService:
name=tool.entity.identity.name, name=tool.entity.identity.name,
label=tool.entity.identity.label, label=tool.entity.identity.label,
description=tool.entity.description.human if tool.entity.description else I18nObject(en_US=""), description=tool.entity.description.human if tool.entity.description else I18nObject(en_US=""),
display=tool.entity.display,
output_schema=tool.entity.output_schema, output_schema=tool.entity.output_schema,
parameters=current_parameters, parameters=current_parameters,
labels=labels or [], labels=labels or [],

Loading…
Cancel
Save