Skip to content

Commit

Permalink
fix none context cause crash (#326)
Browse files Browse the repository at this point in the history
Signed-off-by: Aisuko <[email protected]>
  • Loading branch information
Aisuko authored Jul 27, 2024
1 parent 4ebdfca commit c24f679
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DEBUG:=True
BACKEND_SERVER_HOST:=127.0.0.1
BACKEND_SERVER_PORT:=8000
BACKEND_SERVER_WORKERS:=4
BACKEND_SERVER_VERSION:=v0.1.17
BACKEND_SERVER_VERSION:=v0.1.18
TIMEZONE:="UTC"

# Database - Postgres
Expand Down
2 changes: 1 addition & 1 deletion backend/src/repository/rag/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def get_context_by_question(input_msg: str):
context = vector_db.search(
list(embedd_input), 1, collection_name=DatasetFormatter.format_dataset_by_name(collection_name)
)
if len(context) > 0:
if context and (len(context) > 0):
context = f"Please answer the question based on answer {context[0]}"
else:
context = InferenceHelper.instruction
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/unit_tests/test_api_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ def test_api_version(self):
assert response.json() == {
"inferenceEngine": "server--b1-2321a5e",
"milvus": "v2.3.12",
"kirin": "v0.1.17",
"kirin": "v0.1.18",
}

0 comments on commit c24f679

Please sign in to comment.