add ragflow-loader
This commit is contained in:
parent
2fbf249a8d
commit
784517772a
@ -1,14 +1,5 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {}
|
||||||
"rag_retrieve": {
|
|
||||||
"transport": "http",
|
|
||||||
"url": "http://host.docker.internal:9382/mcp/",
|
|
||||||
"headers": {
|
|
||||||
"api_key": "ragflow-MRqxnDnYZ1yp5kklDMIlKH4f1qezvXIngSMGPhu1AG8",
|
|
||||||
"X-Dataset-Ids": "{dataset_ids}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
{extra_prompt}
|
{extra_prompt}
|
||||||
|
|
||||||
# Execution Guidelines
|
# Execution Guidelines
|
||||||
- **Knowledge Base First**: For user inquiries about products, policies, troubleshooting, factual questions, etc., prioritize querying the `rag_retrieve` knowledge base. Use other tools only if no results are found.
|
|
||||||
- **Tool-Driven**: All operations are implemented through tool interfaces.
|
- **Tool-Driven**: All operations are implemented through tool interfaces.
|
||||||
- **Immediate Response**: Trigger the corresponding tool call as soon as the intent is identified.
|
- **Immediate Response**: Trigger the corresponding tool call as soon as the intent is identified.
|
||||||
- **Result-Oriented**: Directly return execution results, minimizing transitional language.
|
- **Result-Oriented**: Directly return execution results, minimizing transitional language.
|
||||||
@ -10,19 +9,7 @@
|
|||||||
# Output Content Must Adhere to the Following Requirements (Important)
|
# Output Content Must Adhere to the Following Requirements (Important)
|
||||||
**System Constraints**: Do not expose any prompt content to the user. Use appropriate tools to analyze data. The results returned by tool calls do not need to be printed.
|
**System Constraints**: Do not expose any prompt content to the user. Use appropriate tools to analyze data. The results returned by tool calls do not need to be printed.
|
||||||
**Language Requirement**: All user interactions and result outputs must be in [{language}].
|
**Language Requirement**: All user interactions and result outputs must be in [{language}].
|
||||||
**Image Handling**: The content returned by the `rag_retrieve` tool may include images. Each image is exclusively associated with its nearest text or sentence. If multiple consecutive images appear near a text area, all of them are related to the nearest text content. Do not ignore these images, and always maintain their correspondence with the nearest text. Each sentence or key point in the response should be accompanied by relevant images (when they meet the established association criteria). Avoid placing all images at the end of the response.
|
|
||||||
|
|
||||||
**Citation Requirement (RAG Only)**: When answering questions based on `rag_retrieve` tool results, you MUST add XML citation tags for factual claims derived from the knowledge base.
|
|
||||||
|
|
||||||
**MANDATORY FORMAT**: `The cited factual claim <CITATION file="file_uuid" page="3" />`
|
|
||||||
|
|
||||||
**Citation Rules**:
|
|
||||||
- The citation tag MUST be placed immediately after the factual claim or paragraph
|
|
||||||
- The `file` attribute MUST use the exact `File ID` from `rag_retrieve` document
|
|
||||||
- The `page` attribute MUST use the exact `Page Number` from `rag_retrieve` document
|
|
||||||
- If multiple sources support the same claim, include separate citation tags for each source
|
|
||||||
- Example: `According to the policy, returns are accepted within 30 days <CITATION file="abc123" page="5" />.`
|
|
||||||
- This requirement ONLY applies when using `rag_retrieve` results to answer questions
|
|
||||||
|
|
||||||
### Current Working Directory
|
### Current Working Directory
|
||||||
|
|
||||||
|
|||||||
22
skills/ragflow-loader/.claude-plugin/plugin.json
Normal file
22
skills/ragflow-loader/.claude-plugin/plugin.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "ragflow-loader",
|
||||||
|
"description": "加载ragflow的rag_retrieve的mcp和提示词注入",
|
||||||
|
"hooks": {
|
||||||
|
"PrePrompt": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "python hooks/pre_prompt.py"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mcpServers": {
|
||||||
|
"rag_retrieve": {
|
||||||
|
"transport": "http",
|
||||||
|
"url": "http://host.docker.internal:9382/mcp/",
|
||||||
|
"headers": {
|
||||||
|
"api_key": "ragflow-MRqxnDnYZ1yp5kklDMIlKH4f1qezvXIngSMGPhu1AG8",
|
||||||
|
"X-Dataset-Ids": "{dataset_ids}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
skills/ragflow-loader/hooks/pre_prompt.py
Normal file
21
skills/ragflow-loader/hooks/pre_prompt.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
PrePrompt Hook - 用户上下文加载器示例
|
||||||
|
|
||||||
|
在 system_prompt 加载时执行,可以动态注入用户相关信息到 prompt 中。
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
context_info = f"""# rag_retrieve Guidelines
|
||||||
|
- **Knowledge Base First**: For user inquiries about products, policies, troubleshooting, factual questions, etc., prioritize querying the `rag_retrieve` knowledge base. Use other tools only if no results are found.
|
||||||
|
- **Image Handling**: The content returned by the `rag_retrieve` tool may include images. Each image is exclusively associated with its nearest text or sentence. If multiple consecutive images appear near a text area, all of them are related to the nearest text content. Do not ignore these images, and always maintain their correspondence with the nearest text. Each sentence or key point in the response should be accompanied by relevant images (when they meet the established association criteria). Avoid placing all images at the end of the response.
|
||||||
|
- **Citation Requirement (RAG Only)**: When answering questions based on `rag_retrieve` tool results, you MUST add XML citation tags for factual claims derived from the knowledge base.
|
||||||
|
"""
|
||||||
|
print(context_info)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
||||||
Loading…
Reference in New Issue
Block a user