使用SSE调用自己的接口时,响应永远没有任何内容,下图是使用apipost和apifox调用同一个接口的对比:
https://wiki.apipost.cn/docs/sse/debug 是不是query需要转义 你那个是聚合消息的吗 可以吧url给我们试试
你发的文档看过了。这是自己开发的一个接口,目前只能本机访问,我把从apifox收到的响应中的前几个片断贴出来,看能不能有线索
{
"event": "workflow_started",
"conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"message_id": "40d78b92-d004-42df-ba04-c1f5b5884f9f",
"created_at": 1747981240,
"task_id": "2d8bfa7f-6f44-45f5-8b68-7fb729a9e313",
"workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256",
"data": {
"id": "9b4b984b-2157-4136-8e49-08ab02997256",
"workflow_id": "ebe398ec-ae4f-43e1-bf2c-550e46cc86dc",
"sequence_number": 165,
"inputs": {
"sys.query": "普的拼音是什么",
"sys.files": [],
"sys.conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"sys.user_id": "1",
"sys.dialogue_count": 0,
"sys.app_id": "08de8799-7bee-43a0-8646-f5df76efe0ea",
"sys.workflow_id": "ebe398ec-ae4f-43e1-bf2c-550e46cc86dc",
"sys.workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256"
},
"created_at": 1747981239
}
}{
"event": "node_started",
"conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"message_id": "40d78b92-d004-42df-ba04-c1f5b5884f9f",
"created_at": 1747981240,
"task_id": "2d8bfa7f-6f44-45f5-8b68-7fb729a9e313",
"workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256",
"data": {
"id": "369b363a-d495-42ce-a448-c29924de3297",
"node_id": "1742867556829",
"node_type": "start",
"title": "开始",
"index": 1,
"predecessor_node_id": null,
"inputs": null,
"created_at": 1747981239,
"extras": {},
"parallel_id": null,
"parallel_start_node_id": null,
"parent_parallel_id": null,
"parent_parallel_start_node_id": null,
"iteration_id": null,
"loop_id": null,
"parallel_run_id": null,
"agent_strategy": null
}
}{
"event": "node_finished",
"conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"message_id": "40d78b92-d004-42df-ba04-c1f5b5884f9f",
"created_at": 1747981240,
"task_id": "2d8bfa7f-6f44-45f5-8b68-7fb729a9e313",
"workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256",
"data": {
"id": "369b363a-d495-42ce-a448-c29924de3297",
"node_id": "1742867556829",
"node_type": "start",
"title": "开始",
"index": 1,
"predecessor_node_id": null,
"inputs": {
"sys.query": "普的拼音是什么",
"sys.files": [],
"sys.conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"sys.user_id": "1",
"sys.dialogue_count": 0,
"sys.app_id": "08de8799-7bee-43a0-8646-f5df76efe0ea",
"sys.workflow_id": "ebe398ec-ae4f-43e1-bf2c-550e46cc86dc",
"sys.workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256"
},
"process_data": null,
"outputs": {
"sys.query": "普的拼音是什么",
"sys.files": [],
"sys.conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"sys.user_id": "1",
"sys.dialogue_count": 0,
"sys.app_id": "08de8799-7bee-43a0-8646-f5df76efe0ea",
"sys.workflow_id": "ebe398ec-ae4f-43e1-bf2c-550e46cc86dc",
"sys.workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256"
},
"status": "succeeded",
"error": null,
"elapsed_time": 0.019854,
"execution_metadata": null,
"created_at": 1747981239,
"finished_at": 1747981239,
"files": [],
"parallel_id": null,
"parallel_start_node_id": null,
"parent_parallel_id": null,
"parent_parallel_start_node_id": null,
"iteration_id": null,
"loop_id": null
}
}{
"event": "node_started",
"conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"message_id": "40d78b92-d004-42df-ba04-c1f5b5884f9f",
"created_at": 1747981240,
"task_id": "2d8bfa7f-6f44-45f5-8b68-7fb729a9e313",
"workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256",
"data": {
"id": "169aba15-19c7-465e-9322-375f6db45c67",
"node_id": "1743063036752",
"node_type": "llm",
"title": "LLM 2",
"index": 2,
"predecessor_node_id": "1742867556829",
"inputs": null,
"created_at": 1747981239,
"extras": {},
"parallel_id": null,
"parallel_start_node_id": null,
"parent_parallel_id": null,
"parent_parallel_start_node_id": null,
"iteration_id": null,
"loop_id": null,
"parallel_run_id": null,
"agent_strategy": null
}
}{
"event": "node_finished",
"conversation_id": "e3afb135-c912-4cd4-8f69-8a00fa35a322",
"message_id": "40d78b92-d004-42df-ba04-c1f5b5884f9f",
"created_at": 1747981240,
"task_id": "2d8bfa7f-6f44-45f5-8b68-7fb729a9e313",
"workflow_run_id": "9b4b984b-2157-4136-8e49-08ab02997256",
"data": {
"id": "169aba15-19c7-465e-9322-375f6db45c67",
"node_id": "1743063036752",
"node_type": "llm",
"title": "LLM 2",
"index": 2,
"predecessor_node_id": "1742867556829",
"inputs": null,
"process_data": {
"model_mode": "chat",
"prompts": [
{
"role": "system",
"text": "你是一个中文语言学领域的专家,请将用户的问题进行分类,并必须以json格式的对象返回数据,格式如下{\"type\":\"\",\"words\":\"\"},\n将分类放到type字段中,将关键字放入words中,并以逗号分隔,\n如果用户是查询字典、字、词、成语、俗语、谚语等信息,则type为1,同时将用户问题中的的关键的字或词信息提取出来,以逗号分隔,放到words中\n如果用户是根据问题得到一个或多个字、词、成语等,则type为2,同时直接回答用户的问题,以精简结果返回字、词或成语,多个词之间以逗号(,)分隔,放到words中\n如果不是以上两种情况,则type为3\ntype=1时的返回格式如下:\n{\"type\": 1,\"words\": \"xxxx\"}\ntype=2时的返回格式如下:\n{\"type\": 2,\"words\": \"xxxx\"}\ntype=3时的返回格式如下:\n{\"type\": 3}\n用户问题是:普的拼音是什么",
"files": []
}
],
"model_provider": "langgenius/tongyi/tongyi",
"model_name": "qwen-max"
},
"outputs": {
"text": "{\"type\": 1,\"words\": \"普\"}",
"usage": {
"prompt_tokens": 234,
"prompt_unit_price": "0.02",
"prompt_price_unit": "0.001",
"prompt_price": "0.00468",
"completion_tokens": 11,
"completion_unit_price": "0.06",
"completion_price_unit": "0.001",
"completion_price": "0.00066",
"total_tokens": 245,
"total_price": "0.00534",
"currency": "RMB",
"latency": 0.9883776381611824
},
"finish_reason": "stop"
},
"status": "succeeded",
"error": null,
"elapsed_time": 1.123053,
"execution_metadata": {
"total_tokens": 245,
"total_price": "0.00534",
"currency": "RMB"
},
"created_at": 1747981239,
"finished_at": 1747981241,
"files": [],
"parallel_id": null,
"parallel_start_node_id": null,
"parent_parallel_id": null,
"parent_parallel_start_node_id": null,
"iteration_id": null,
"loop_id": null
}
}