add workflow 市场-Agents调度,dev
This commit is contained in:
parent
c4d42a6aab
commit
b3af3b1f97
|
|
@ -72,8 +72,9 @@ class APIClient:
|
|||
Returns:
|
||||
API响应数据
|
||||
"""
|
||||
inputs_data = {}
|
||||
payload = {
|
||||
"inputs": {},
|
||||
"inputs": inputs_data,
|
||||
"response_mode": "blocking",
|
||||
"user": "admin"
|
||||
}
|
||||
|
|
@ -108,7 +109,7 @@ class APIClient:
|
|||
}
|
||||
|
||||
|
||||
def call_api_with_query(self, query: str = None) -> Dict[str, Any]:
|
||||
def call_api_with_query(self, inputs: Dict[str, Any] = None, query: str = None) -> Dict[str, Any]:
|
||||
"""直接调用带inputs参数的API
|
||||
|
||||
Args:
|
||||
|
|
@ -118,11 +119,10 @@ class APIClient:
|
|||
API响应数据
|
||||
"""
|
||||
payload = json.dumps({
|
||||
"inputs": None,
|
||||
"query" : query,
|
||||
"inputs": inputs,
|
||||
"query": query,
|
||||
"response_mode": "streaming",
|
||||
"user": "admin",
|
||||
"conversation_id":""
|
||||
"user": "admin"
|
||||
})
|
||||
|
||||
try:
|
||||
|
|
@ -307,9 +307,10 @@ def main():
|
|||
|
||||
else:
|
||||
#agent
|
||||
inputs_data = {}
|
||||
query = text
|
||||
logger.info(f"call_api_with_query")
|
||||
result = api_client.call_api_with_query(query)
|
||||
result = api_client.call_api_with_query(inputs_data, query)
|
||||
|
||||
if result['success']:
|
||||
logger.info(f"URL {text} 处理成功")
|
||||
|
|
@ -329,6 +330,9 @@ def main():
|
|||
else:
|
||||
logger.info("调用不带inputs参数的API示例")
|
||||
if type == 'workflow':
|
||||
|
||||
inputs_data = {}
|
||||
|
||||
result2 = api_client.call_api_without_inputs()
|
||||
|
||||
if result2['success']:
|
||||
|
|
@ -338,6 +342,8 @@ def main():
|
|||
|
||||
else:
|
||||
#agent
|
||||
inputs_data = {}
|
||||
|
||||
result2 = api_client.call_api_without_query()
|
||||
|
||||
if result2['success']:
|
||||
|
|
|
|||
Loading…
Reference in New Issue