Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增Http post请求对接,以便支持用户高阶能力(如知识库、联网搜索、agent等高阶能力) #401

Open
1 task done
glsilover opened this issue Jan 11, 2025 · 0 comments

Comments

@glsilover
Copy link

这个问题是否已有issue

  • 我确认没有已有issue,且已阅读常见问题

运行环境

  • OS: MacOS 15.1 (24B83)
  • Zotero version: 7.0.11
  • Plugin version: 1.5.9

当前配置信息

No response

问题详情

为提高大模型自定义丰富程度,希望能支持以Http形式进行接入用户自定义的模型。
该场景的背景是用户通过dify等工具自定义编排工作流(如知识库、联网搜索、agent等高阶能力),最终暴露api为http类型。

request格式:

curl -X POST 'http://{HOST}/v1/chat-messages'
--header 'Authorization: Bearer {KEY}'
--header 'Content-Type: application/json'
--data-raw '{
"query": "你是谁?",
"response_mode": "streaming",
"conversation_id": "",
"user": "abc-123",
"inputs": {
"filter": "_fs01 == "现行有效" and _fi01 == 1730"
}
}'

response响应(流式)

data: {"event":"workflow_started","id":"900bbd43-dc0b-4383-a372-aa6e6c414227","conversation_id":"663c5084-a254-4040-8ad3-51f2a3c1a77c","created_at":1711080728,"task_id":"80a4e87b-6ac4-4361-a878-b6f68ea6fd8b","workflow_run_id":"2aafe79c-4d5c-4558-984d-ebe0f634d0b0","data":{"workflow_id":"f597c5ab-e74b-4b2d-ba7f-b7ad221a32fc","created_at":1718852447,"inputs":null}}

data: {"event":"node_started","id":"900bbd43-dc0b-4383-a372-aa6e6c414227","conversation_id":"663c5084-a254-4040-8ad3-51f2a3c1a77c","created_at":1711080728,"task_id":"80a4e87b-6ac4-4361-a878-b6f68ea6fd8b","data":{"node_id":"1718849945165","node_type":"start","title":"开始","created_at":1718852447,"inputs":null}}

data: {"event":"node_finished","id":"900bbd43-dc0b-4383-a372-aa6e6c414227","conversation_id":"663c5084-a254-4040-8ad3-51f2a3c1a77c","created_at":1711080728,"task_id":"80a4e87b-6ac4-4361-a878-b6f68ea6fd8b","data":{"node_id":"1718849945165","node_type":"start","title":"开始","status":"succeeded","error":null,"inputs":null,"outputs":null,"elapsed_time":0.0038351714611053467,"created_at":1718852447,"finished_at":1718852447}}

data: {"event": "message", "id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "conversation_id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1711080728}

data: {"event": "message", "id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "conversation_id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "你", "created_at": 1711080728}

data: {"event": "message", "id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "conversation_id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "好", "created_at": 1711080728}

data: {"event":"workflow_finished","id":"900bbd43-dc0b-4383-a372-aa6e6c414227","conversation_id":"663c5084-a254-4040-8ad3-51f2a3c1a77c","created_at":1711080728,"task_id":"80a4e87b-6ac4-4361-a878-b6f68ea6fd8b","workflow_run_id":"2aafe79c-4d5c-4558-984d-ebe0f634d0b0","data":{"workflow_id":"f597c5ab-e74b-4b2d-ba7f-b7ad221a32fc","status":"succeeded","error":null,"outputs":null,"elapsed_time":5.297070034779608,"created_at":1718852447,"finished_at":1718852452}}

data: {"event": "message_end", "id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "conversation_id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "created_at": 1711080728, "metadata":{"retriever_resources":[{"dataset_id":"101b4c97-fc2e-463c-90b1-5261a4cdcafb","dataset_name":"助手知识库","document_id":"8dd1ad74-0b5f-4175-b735-7d98bbbb4e00","document_name":"助手文档001.pdf","content": "Hello world!"}]}}

respones 阻塞模式

{
"id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
"answer": "Hi你好",
"created_at": 1711080728,
"metadata": {
"retriever_resources": [
{
"dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
"dataset_name": "助手知识库",
"document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
"document_name": "助手文档001.pdf",
"content": "Hello world!"
}
]
}
}

补充说明

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant