提交qiming-mcp-proxy
This commit is contained in:
49
qiming-mcp-proxy/document-parser/fixtures/sample_config.json
Normal file
49
qiming-mcp-proxy/document-parser/fixtures/sample_config.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"project": {
|
||||
"name": "文档解析器",
|
||||
"version": "1.0.0",
|
||||
"description": "支持多种格式的智能文档解析系统",
|
||||
"author": "开发团队",
|
||||
"license": "MIT"
|
||||
},
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 8087,
|
||||
"workers": 4,
|
||||
"timeout": 30
|
||||
},
|
||||
"database": {
|
||||
"type": "sled",
|
||||
"path": "./data/sled",
|
||||
"cache_capacity": 1048576,
|
||||
"compression": true
|
||||
},
|
||||
"parsers": {
|
||||
"markdown": {
|
||||
"enabled": true,
|
||||
"extensions": ["md", "markdown"],
|
||||
"max_file_size": 10485760
|
||||
},
|
||||
"word": {
|
||||
"enabled": true,
|
||||
"extensions": ["doc", "docx"],
|
||||
"max_file_size": 52428800
|
||||
},
|
||||
"pdf": {
|
||||
"enabled": true,
|
||||
"extensions": ["pdf"],
|
||||
"max_file_size": 104857600
|
||||
}
|
||||
},
|
||||
"storage": {
|
||||
"temp_dir": "./temp",
|
||||
"max_concurrent": 10,
|
||||
"cleanup_interval": 3600
|
||||
},
|
||||
"logging": {
|
||||
"level": "info",
|
||||
"file": "./logs/app.log",
|
||||
"max_size": 10485760,
|
||||
"backup_count": 5
|
||||
}
|
||||
}
|
||||
11
qiming-mcp-proxy/document-parser/fixtures/sample_data.csv
Normal file
11
qiming-mcp-proxy/document-parser/fixtures/sample_data.csv
Normal file
@@ -0,0 +1,11 @@
|
||||
姓名,年龄,职业,城市,薪资
|
||||
张三,25,软件工程师,北京,15000
|
||||
李四,30,产品经理,上海,20000
|
||||
王五,28,UI设计师,深圳,18000
|
||||
赵六,32,数据分析师,杭州,22000
|
||||
钱七,26,前端开发,广州,16000
|
||||
孙八,29,后端开发,成都,17000
|
||||
周九,31,测试工程师,武汉,14000
|
||||
吴十,27,运维工程师,西安,15000
|
||||
郑十一,33,架构师,南京,30000
|
||||
王十二,24,实习生,苏州,8000
|
||||
|
60
qiming-mcp-proxy/document-parser/fixtures/sample_data.xml
Normal file
60
qiming-mcp-proxy/document-parser/fixtures/sample_data.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project>
|
||||
<metadata>
|
||||
<name>文档解析器项目</name>
|
||||
<version>1.0.0</version>
|
||||
<description>支持多种格式的智能文档解析系统</description>
|
||||
<author>开发团队</author>
|
||||
<created>2024-08-15</created>
|
||||
</metadata>
|
||||
|
||||
<components>
|
||||
<component>
|
||||
<name>格式检测器</name>
|
||||
<type>core</type>
|
||||
<description>自动识别文档格式</description>
|
||||
<enabled>true</enabled>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<name>解析引擎</name>
|
||||
<type>core</type>
|
||||
<description>支持多种格式的解析</description>
|
||||
<enabled>true</enabled>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<name>存储服务</name>
|
||||
<type>service</type>
|
||||
<description>管理解析结果和元数据</description>
|
||||
<enabled>true</enabled>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<name>任务队列</name>
|
||||
<type>service</type>
|
||||
<description>异步处理文档解析任务</description>
|
||||
<enabled>true</enabled>
|
||||
</component>
|
||||
</components>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<name>tokio</name>
|
||||
<version>1.0</version>
|
||||
<type>runtime</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<name>serde</name>
|
||||
<version>1.0</version>
|
||||
<type>serialization</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<name>sled</name>
|
||||
<version>0.34</version>
|
||||
<type>database</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
91
qiming-mcp-proxy/document-parser/fixtures/sample_markdown.md
Normal file
91
qiming-mcp-proxy/document-parser/fixtures/sample_markdown.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# 测试文档 - Markdown 格式
|
||||
|
||||
## 简介
|
||||
这是一个用于测试 Markdown 解析功能的示例文档。它包含了各种 Markdown 元素,用于验证解析器的功能。
|
||||
|
||||
## 文本格式
|
||||
|
||||
### 粗体和斜体
|
||||
这是**粗体文本**,这是*斜体文本*,这是***粗斜体文本***。
|
||||
|
||||
### 删除线和下划线
|
||||
这是~~删除线文本~~,这是<u>下划线文本</u>。
|
||||
|
||||
## 列表
|
||||
|
||||
### 无序列表
|
||||
- 第一项
|
||||
- 第二项
|
||||
- 子项 2.1
|
||||
- 子项 2.2
|
||||
- 第三项
|
||||
|
||||
### 有序列表
|
||||
1. 第一步
|
||||
2. 第二步
|
||||
1. 子步骤 2.1
|
||||
2. 子步骤 2.2
|
||||
3. 第三步
|
||||
|
||||
## 链接和图片
|
||||
|
||||
### 链接
|
||||
访问 [GitHub](https://github.com) 了解更多信息。
|
||||
|
||||
### 图片
|
||||

|
||||
|
||||
## 代码
|
||||
|
||||
### 行内代码
|
||||
使用 `console.log()` 来输出信息。
|
||||
|
||||
### 代码块
|
||||
```python
|
||||
def hello_world():
|
||||
print("Hello, World!")
|
||||
return "success"
|
||||
```
|
||||
|
||||
```javascript
|
||||
function greet(name) {
|
||||
return `Hello, ${name}!`;
|
||||
}
|
||||
```
|
||||
|
||||
## 表格
|
||||
|
||||
| 姓名 | 年龄 | 职业 |
|
||||
|------|------|------|
|
||||
| 张三 | 25 | 工程师 |
|
||||
| 李四 | 30 | 设计师 |
|
||||
| 王五 | 28 | 产品经理 |
|
||||
|
||||
## 引用
|
||||
|
||||
> 这是一个引用块。
|
||||
>
|
||||
> 可以包含多行内容。
|
||||
|
||||
## 水平线
|
||||
|
||||
---
|
||||
|
||||
## 任务列表
|
||||
|
||||
- [x] 完成项目规划
|
||||
- [x] 编写核心代码
|
||||
- [ ] 进行单元测试
|
||||
- [ ] 部署到生产环境
|
||||
|
||||
## 总结
|
||||
|
||||
这个文档包含了:
|
||||
- 各种标题级别
|
||||
- 文本格式化
|
||||
- 列表和表格
|
||||
- 代码示例
|
||||
- 链接和图片
|
||||
- 引用
|
||||
|
||||
用于全面测试 Markdown 解析器的功能。
|
||||
28
qiming-mcp-proxy/document-parser/fixtures/sample_text.txt
Normal file
28
qiming-mcp-proxy/document-parser/fixtures/sample_text.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
这是一个纯文本测试文档
|
||||
|
||||
用于测试文档解析器对纯文本格式的处理能力。
|
||||
|
||||
文档内容包含:
|
||||
1. 中文字符
|
||||
2. 英文字符
|
||||
3. 数字
|
||||
4. 标点符号
|
||||
5. 换行符
|
||||
|
||||
这个文档没有特殊的格式标记,纯粹是文本内容。
|
||||
|
||||
可以用来测试:
|
||||
- 文本提取功能
|
||||
- 字符编码处理
|
||||
- 换行符处理
|
||||
- 文本长度计算
|
||||
- 内容分析功能
|
||||
|
||||
测试用例应该能够:
|
||||
- 正确识别这是一个文本文件
|
||||
- 提取完整的文本内容
|
||||
- 保持原有的换行格式
|
||||
- 计算准确的字符数量
|
||||
- 生成合适的元数据
|
||||
|
||||
结束。
|
||||
21
qiming-mcp-proxy/document-parser/fixtures/simple_markdown.md
Normal file
21
qiming-mcp-proxy/document-parser/fixtures/simple_markdown.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# 简单测试文档
|
||||
|
||||
这是一个简单的 Markdown 文档,用于基础功能测试。
|
||||
|
||||
## 内容
|
||||
|
||||
- 项目介绍
|
||||
- 功能特性
|
||||
- 使用方法
|
||||
|
||||
## 代码示例
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
println!("Hello, World!");
|
||||
}
|
||||
```
|
||||
|
||||
## 总结
|
||||
|
||||
测试完成。
|
||||
121
qiming-mcp-proxy/document-parser/fixtures/technical_doc.md
Normal file
121
qiming-mcp-proxy/document-parser/fixtures/technical_doc.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Rust 项目技术文档
|
||||
|
||||
## 项目概述
|
||||
|
||||
这是一个基于 Rust 的文档解析器项目,支持多种文档格式的解析和处理。
|
||||
|
||||
## 架构设计
|
||||
|
||||
### 核心组件
|
||||
|
||||
1. **格式检测器** - 自动识别文档格式
|
||||
2. **解析引擎** - 支持多种格式的解析
|
||||
3. **存储服务** - 管理解析结果和元数据
|
||||
4. **任务队列** - 异步处理文档解析任务
|
||||
|
||||
### 技术栈
|
||||
|
||||
- **语言**: Rust 2021 Edition
|
||||
- **异步运行时**: Tokio
|
||||
- **数据库**: Sled (嵌入式)
|
||||
- **Web 框架**: Axum
|
||||
- **序列化**: Serde
|
||||
|
||||
## API 接口
|
||||
|
||||
### 文档上传
|
||||
|
||||
```http
|
||||
POST /api/v1/documents/upload
|
||||
Content-Type: multipart/form-data
|
||||
|
||||
file: [binary data]
|
||||
format: "auto"
|
||||
```
|
||||
|
||||
### 解析状态查询
|
||||
|
||||
```http
|
||||
GET /api/v1/documents/{id}/status
|
||||
```
|
||||
|
||||
### 解析结果获取
|
||||
|
||||
```http
|
||||
GET /api/v1/documents/{id}/content
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
## 配置说明
|
||||
|
||||
### 环境变量
|
||||
|
||||
```bash
|
||||
# 服务器配置
|
||||
SERVER_PORT=8087
|
||||
SERVER_HOST=0.0.0.0
|
||||
|
||||
# 日志配置
|
||||
LOG_LEVEL=info
|
||||
LOG_PATH=./logs/app.log
|
||||
|
||||
# 存储配置
|
||||
SLED_PATH=./data/sled
|
||||
SLED_CACHE_CAPACITY=1048576
|
||||
```
|
||||
|
||||
## 部署指南
|
||||
|
||||
### 开发环境
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone <repository-url>
|
||||
cd document-parser
|
||||
|
||||
# 安装依赖
|
||||
cargo install
|
||||
|
||||
# 运行测试
|
||||
cargo test
|
||||
|
||||
# 启动服务
|
||||
cargo run
|
||||
```
|
||||
|
||||
### 生产环境
|
||||
|
||||
```bash
|
||||
# 构建发布版本
|
||||
cargo build --release
|
||||
|
||||
# 运行服务
|
||||
./target/release/document-parser
|
||||
```
|
||||
|
||||
## 性能指标
|
||||
|
||||
### 解析速度
|
||||
|
||||
| 文档类型 | 平均解析时间 | 内存使用 |
|
||||
|----------|--------------|----------|
|
||||
| Markdown | 50ms | 2MB |
|
||||
| Word | 200ms | 10MB |
|
||||
| PDF | 500ms | 25MB |
|
||||
|
||||
### 并发能力
|
||||
|
||||
- 最大并发解析任务:10
|
||||
- 队列容量:100
|
||||
- 超时设置:30秒
|
||||
|
||||
## 总结
|
||||
|
||||
这个技术文档包含了:
|
||||
- 项目架构说明
|
||||
- API 接口定义
|
||||
- 配置和部署指南
|
||||
- 性能指标数据
|
||||
- 代码示例
|
||||
|
||||
用于测试复杂 Markdown 内容的解析能力。
|
||||
34
qiming-mcp-proxy/document-parser/fixtures/test_config.yml
Normal file
34
qiming-mcp-proxy/document-parser/fixtures/test_config.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
# 测试配置文件
|
||||
app:
|
||||
name: "测试应用"
|
||||
version: "0.1.0"
|
||||
debug: true
|
||||
|
||||
database:
|
||||
host: "localhost"
|
||||
port: 5432
|
||||
name: "test_db"
|
||||
user: "test_user"
|
||||
password: "test_pass"
|
||||
|
||||
api:
|
||||
endpoints:
|
||||
- path: "/api/v1/users"
|
||||
method: "GET"
|
||||
auth: true
|
||||
- path: "/api/v1/users"
|
||||
method: "POST"
|
||||
auth: true
|
||||
- path: "/api/v1/health"
|
||||
method: "GET"
|
||||
auth: false
|
||||
|
||||
logging:
|
||||
level: "debug"
|
||||
format: "json"
|
||||
output: "stdout"
|
||||
|
||||
features:
|
||||
cache: true
|
||||
rate_limit: true
|
||||
compression: false
|
||||
Reference in New Issue
Block a user