feat(plugin): implement INVOKE_RERANK handler with run-scoped authorization

- Add invoke_rerank action handler in plugin handler
- Validate rerank model access via run session
- Cap documents at 64 for API limit
- Return sorted results by relevance score
This commit is contained in:
huanghuoguoguo
2026-05-13 10:36:47 +08:00
committed by huanghuoguoguo
parent d7f08cb29f
commit d560a1eff3
7 changed files with 586 additions and 102 deletions
@@ -38,57 +38,11 @@
},
"ai": {
"runner": {
"runner": "local-agent",
"id": "plugin:langbot/local-agent/default",
"expire-time": 0
},
"local-agent": {
"model": {
"primary": "",
"fallbacks": []
},
"max-round": 10,
"prompt": [
{
"role": "system",
"content": "You are a helpful assistant. When tools are available, use them for exact calculations, data processing, and code execution instead of guessing. Unless the user explicitly asks for code or a script, return the result directly instead of printing the generated code."
}
],
"knowledge-bases": [],
"box-session-id-template": "{launcher_type}_{launcher_id}",
"rerank-model": "",
"rerank-top-k": 5
},
"dify-service-api": {
"base-url": "https://api.dify.ai/v1",
"app-type": "chat",
"api-key": "your-api-key",
"timeout": 30
},
"dashscope-app-api": {
"app-type": "agent",
"api-key": "your-api-key",
"app-id": "your-app-id",
"references-quote": "参考资料来自:"
},
"n8n-service-api": {
"webhook-url": "http://your-n8n-webhook-url",
"auth-type": "none",
"basic-username": "",
"basic-password": "",
"jwt-secret": "",
"jwt-algorithm": "HS256",
"header-name": "",
"header-value": "",
"timeout": 120,
"output-key": "response"
},
"langflow-api": {
"base-url": "http://localhost:7860",
"api-key": "your-api-key",
"flow-id": "your-flow-id",
"input-type": "chat",
"output-type": "chat",
"tweaks": "{}"
"runner_config": {
"plugin:langbot/local-agent/default": {}
}
},
"output": {
@@ -110,4 +64,4 @@
"remove-think": false
}
}
}
}