改进 输出结果

This commit is contained in:
iVampireSP.com 2023-11-22 11:15:38 +08:00
parent 4ec57974a4
commit cf6c92d3e3
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 5 additions and 3 deletions

2
.gitignore vendored
View File

@ -158,5 +158,5 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire `idea` folder. # option (not recommended) you can uncomment the following to ignore the entire `idea` folder.
#.idea/ .idea/

View File

@ -64,7 +64,7 @@ class AIServer(proto.document_query_pb2_grpc.DocumentQuery):
id=_chunk_id id=_chunk_id
)) ))
print(_chunk_content.document) # print(_chunk_content)
# _doc_content_full = _chunk_content.content # _doc_content_full = _chunk_content.content
document_text += "\n" + _chunk_content.content + "\n" document_text += "\n" + _chunk_content.content + "\n"
@ -72,7 +72,8 @@ class AIServer(proto.document_query_pb2_grpc.DocumentQuery):
# append # append
sources.append({ sources.append({
"text": _chunk_content.content, "text": _chunk_content.content,
"document_id": _chunk_content.document.id "document_id": _chunk_content.document.id,
"title": _chunk_content.document.title
}) })
# doc_obj = Document(page_content=_doc_content_full, metadata={"source": "chunked content"}) # doc_obj = Document(page_content=_doc_content_full, metadata={"source": "chunked content"})
@ -86,6 +87,7 @@ class AIServer(proto.document_query_pb2_grpc.DocumentQuery):
output = search(document_text, question) output = search(document_text, question)
print(sources)
print("完成。") print("完成。")
return proto.document_query_pb2.QueryResponse( return proto.document_query_pb2.QueryResponse(
text=output, text=output,