feat: 三个工具对应的接口(优化)
This commit is contained in:
@@ -22,8 +22,14 @@ def add_api_route(app: FastAPI):
|
||||
@app.get('/api/project/analysis')
|
||||
async def project_analysis(project_name=Query(..., description="项目名称")):
|
||||
tool_result_string = await tool_project_analysis.ainvoke({"project_name": project_name})
|
||||
tool_result_data = json.loads(tool_result_string)
|
||||
return tool_result_data[0]
|
||||
try:
|
||||
tool_result_data = json.loads(tool_result_string)
|
||||
result = tool_result_data[0]
|
||||
except:
|
||||
result = tool_result_string
|
||||
return {
|
||||
"result": result
|
||||
}
|
||||
|
||||
# 项目日报总结
|
||||
@app.get('/api/project/report')
|
||||
@@ -37,9 +43,18 @@ def add_api_route(app: FastAPI):
|
||||
"start_time": start_time,
|
||||
"end_time": end_time,
|
||||
})
|
||||
return json.loads(tool_result_string)
|
||||
try:
|
||||
tool_result_data = json.loads(tool_result_string)
|
||||
result = tool_result_data[0]
|
||||
except:
|
||||
result = tool_result_string
|
||||
return {
|
||||
"result": result
|
||||
}
|
||||
|
||||
# 检索企业内部文档工具
|
||||
@app.get('/api/document/retrieve')
|
||||
async def document_retrieve(question=Query(..., description="用户的问题")):
|
||||
return await tool_retrieve_documents.ainvoke({"question": question})
|
||||
return {
|
||||
"result": await tool_retrieve_documents.ainvoke({"question": question})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user