Skip to content

Commit

Permalink
Merge pull request #48 from gomate-community/pipeline
Browse files Browse the repository at this point in the history
Pipeline
  • Loading branch information
yanqiangmiffy authored Aug 29, 2024
2 parents f25d7a1 + 648b354 commit 3a8d98f
Show file tree
Hide file tree
Showing 8 changed files with 478 additions and 184 deletions.
8 changes: 8 additions & 0 deletions api/apps/core/citation/bodys.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ class CitationBody(BaseModel):
[1,2],
description="文档对应的索引"
)
show_code:bool=Field(
default=True,
description="是否显示引用代码块"
)
selected_docs:List[dict]=Field(
default=[]

)
8 changes: 6 additions & 2 deletions api/apps/core/citation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
async def citation(citation_body: CitationBody):
response = citation_body.response
evidences = citation_body.evidences
selected_idx=citation_body.selected_idx
selected_idx = citation_body.selected_idx
show_code = citation_body.show_code
selected_docs=citation_body.selected_docs
# loguru.logger.info(response)
# loguru.logger.info(evidences)
citation_response = mc.ground_response(
response=response,
evidences=evidences,
selected_idx=selected_idx,
markdown=True
markdown=True,
show_code=show_code,
selected_docs=selected_docs
)
loguru.logger.info(citation_response)
return ApiResponse(citation_response, message="答案引用成功")
3 changes: 2 additions & 1 deletion api/apps/core/parser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ async def parser(file: UploadFile = File(...),chunk_size=512):
raise NotImplementedError(
"file type not supported yet(pdf, xlsx, doc, docx, txt supported)")
contents = parser.parse(content)
loguru.logger.info(contents[0])
# loguru.logger.info(contents[0])
contents = tc.chunk_sentences(contents, chunk_size=512)
loguru.logger.info(len(contents))
# 返回成功响应
return JSONResponse(content=contents, status_code=200)
except Exception as e:
Expand Down
Loading

0 comments on commit 3a8d98f

Please sign in to comment.