Refactor project creation process in API documentation and code
- Updated README.md to reflect the removal of the project creation endpoint, adjusting the workflow steps accordingly. - Removed the `create_project` function from graph.py, streamlining the project management API by eliminating deprecated functionality.
This commit is contained in:
parent
e98da6b53e
commit
c60e6e1089
2 changed files with 5 additions and 49 deletions
|
|
@ -63,22 +63,19 @@ python run.py
|
|||
### 核心工作流程
|
||||
|
||||
```
|
||||
1. 创建项目(可选)
|
||||
POST /api/graph/project/create
|
||||
|
||||
2. 上传文件 + 生成本体(接口1)
|
||||
1. 上传文件 + 生成本体(接口1)
|
||||
POST /api/graph/ontology/generate
|
||||
→ 返回 project_id
|
||||
→ 自动创建项目,返回 project_id
|
||||
|
||||
3. 构建图谱(接口2)
|
||||
2. 构建图谱(接口2)
|
||||
POST /api/graph/build
|
||||
→ 传入 project_id
|
||||
→ 返回 task_id
|
||||
|
||||
4. 查询任务进度
|
||||
3. 查询任务进度
|
||||
GET /api/graph/task/{task_id}
|
||||
|
||||
5. 获取图谱数据
|
||||
4. 获取图谱数据
|
||||
GET /api/graph/data/{graph_id}
|
||||
```
|
||||
|
||||
|
|
@ -199,7 +196,6 @@ python run.py
|
|||
|
||||
| 方法 | 路径 | 说明 |
|
||||
|------|------|------|
|
||||
| POST | `/api/graph/project/create` | 创建项目 |
|
||||
| GET | `/api/graph/project/{project_id}` | 获取项目详情 |
|
||||
| GET | `/api/graph/project/list` | 列出所有项目 |
|
||||
| DELETE | `/api/graph/project/{project_id}` | 删除项目 |
|
||||
|
|
|
|||
|
|
@ -32,46 +32,6 @@ def allowed_file(filename: str) -> bool:
|
|||
|
||||
# ============== 项目管理接口 ==============
|
||||
|
||||
@graph_bp.route('/project/create', methods=['POST'])
|
||||
def create_project():
|
||||
"""
|
||||
创建新项目
|
||||
|
||||
请求(JSON):
|
||||
{
|
||||
"name": "项目名称" // 可选
|
||||
}
|
||||
|
||||
返回:
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"project_id": "proj_xxxx",
|
||||
"name": "...",
|
||||
"status": "created",
|
||||
...
|
||||
}
|
||||
}
|
||||
"""
|
||||
try:
|
||||
data = request.get_json() or {}
|
||||
name = data.get('name', 'Unnamed Project')
|
||||
|
||||
project = ProjectManager.create_project(name=name)
|
||||
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"data": project.to_dict()
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
"success": False,
|
||||
"error": str(e),
|
||||
"traceback": traceback.format_exc()
|
||||
}), 500
|
||||
|
||||
|
||||
@graph_bp.route('/project/<project_id>', methods=['GET'])
|
||||
def get_project(project_id: str):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue