本文导读
调用应用
应用调试成功后,可以使用API调用该应用。
使用Postman调用API
- 获取Token。参考《API参考》文档“如何调用REST API > 认证鉴权”章节获取Token。
- 在Postman中新建POST请求,并填入应用的调用路径,详见获取调用路径。
- 填写请求Header参数。
- 参数名为Content-Type,参数值为application/json。
- 参数名为X-Auth-Token,参数值为步骤1中获取的Token值。
- 参数名为stream,参数值为true。当前应用仅支持流式调用。
- 在Postman中选择“Body > raw”选项,请求Body填写示例如下。其中,query参数为用户提出的问题,作为应用的输入。
{ "query": "预定15:00到16:00的A12会议室" }
- 单击Postman界面“Send”,发送请求。当接口返回状态为200时,表示应用API调用成功,响应示例如下:
data:{"event":"start","data":{},"createdTime":1733821291867,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"好的"},"createdTime":1733821304670,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":","},"createdTime":1733821304671,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"我"},"createdTime":1733821304671,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"需要先"},"createdTime":1733821304671,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"查询"},"createdTime":1733821304672,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"一下"},"createdTime":1733821304672,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"A"},"createdTime":1733821304672,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"12"},"createdTime":1733821304673,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"会议室"},"createdTime":1733821304673,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"在"},"createdTime":1733821304673,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"15"},"createdTime":1733821304673,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821304674,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"到"},"createdTime":1733821304674,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"16"},"createdTime":1733821304674,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821304675,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"的状态"},"createdTime":1733821304675,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"。"},"createdTime":1733821304675,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"请"},"createdTime":1733821304675,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"稍"},"createdTime":1733821304676,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"等"},"createdTime":1733821304676,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"。"},"createdTime":1733821304676,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" "},"createdTime":1733821304676,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" meeting"},"createdTime":1733821304676,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"_"},"createdTime":1733821304677,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"room"},"createdTime":1733821304677,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"_status"},"createdTime":1733821304677,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"_query"},"createdTime":1733821304677,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"|"},"createdTime":1733821304678,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"{\""},"createdTime":1733821304678,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"meeting"},"createdTime":1733821304678,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"Room"},"createdTime":1733821304678,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\":\""},"createdTime":1733821304678,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"A"},"createdTime":1733821304679,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"12"},"createdTime":1733821304679,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\",\""},"createdTime":1733821304679,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"start"},"createdTime":1733821304679,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\":\""},"createdTime":1733821304679,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"15"},"createdTime":1733821304680,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821304680,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\",\""},"createdTime":1733821304680,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"end"},"createdTime":1733821304680,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\":\""},"createdTime":1733821304681,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"16"},"createdTime":1733821304681,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821304681,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\"}"},"createdTime":1733821304681,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" "},"createdTime":1733821304682,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"function_call_end","data":{},"createdTime":1733821304684,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"function_call","conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410","createdTime":1733821304685,"data":{"answer":{"function_call":{"name":"meeting_room_status_query","arguments":"{\"meetingRoom\": \"A12\", \"start\": \"15:00\", \"end\": \"16:00\"}"},"is_workflow":false,"time_consumption":{"total_latency":12.81,"overall_latency":12.82},"memory_variables":{}}}} data:{"event":"api_exec_data","data":{"answer":{"role":"function","name":"meeting_room_status_query","content":{"result":"空闲"},"time_consumption":{"plugin_latency":0.0,"overall_latency":13.05}}},"createdTime":1733821304918,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"start","data":{},"createdTime":1733821304918,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" "},"createdTime":1733821307034,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" reserve"},"createdTime":1733821307035,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"_"},"createdTime":1733821307035,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"meeting"},"createdTime":1733821307035,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"_"},"createdTime":1733821307036,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"room"},"createdTime":1733821307036,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"|"},"createdTime":1733821307036,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"{\""},"createdTime":1733821307037,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"meeting"},"createdTime":1733821307037,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"Room"},"createdTime":1733821307037,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\":"},"createdTime":1733821307037,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" \""},"createdTime":1733821307037,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"A"},"createdTime":1733821307038,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"12"},"createdTime":1733821307038,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\","},"createdTime":1733821307038,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" \""},"createdTime":1733821307038,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"start"},"createdTime":1733821307039,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\":"},"createdTime":1733821307039,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" \""},"createdTime":1733821307039,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"15"},"createdTime":1733821307039,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821307039,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\","},"createdTime":1733821307040,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" \""},"createdTime":1733821307040,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"end"},"createdTime":1733821307040,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\":"},"createdTime":1733821307040,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" \""},"createdTime":1733821307040,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"16"},"createdTime":1733821307041,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821307041,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"\"}"},"createdTime":1733821307041,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":" "},"createdTime":1733821307041,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"function_call_end","data":{},"createdTime":1733821307044,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"function_call","conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410","createdTime":1733821307044,"data":{"answer":{"function_call":{"name":"reserve_meeting_room","arguments":"{\"meetingRoom\": \"A12\", \"start\": \"15:00\", \"end\": \"16:00\"}"},"is_workflow":false,"time_consumption":{"total_latency":2.12,"overall_latency":15.18},"memory_variables":{}}}} data:{"event":"api_exec_data","data":{"answer":{"role":"function","name":"reserve_meeting_room","content":{"result":"会议室预定成功"},"time_consumption":{"plugin_latency":0.0,"overall_latency":15.25}}},"createdTime":1733821307119,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"start","data":{},"createdTime":1733821307120,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"已"},"createdTime":1733821308735,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"成功"},"createdTime":1733821308735,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"为您"},"createdTime":1733821308736,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"预定"},"createdTime":1733821308736,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"15"},"createdTime":1733821308736,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821308736,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"到"},"createdTime":1733821308737,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"16"},"createdTime":1733821308737,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":":00"},"createdTime":1733821308737,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"的"},"createdTime":1733821308737,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"A"},"createdTime":1733821308737,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"12"},"createdTime":1733821308738,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"会议室"},"createdTime":1733821308738,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"message","data":{"answer":"。"},"createdTime":1733821308738,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"done","data":{},"createdTime":1733821308741,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"statistic_data","data":{"answer":{"total_latency":1.62,"model_latency":null,"wait_latency":null,"overall_latency":16.87}},"createdTime":1733821308741,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"} data:{"event":"summary_response","data":{"answer":{"role":"assistant","content":"已成功为您预定15:00到16:00的A12会议室。"}},"createdTime":1733821308741,"conversationId":"7795ee1b-b145-4e21-8e02-d14f973b6410"}
父主题: 编排与调用应用