Skip to content

Commit

Permalink
Hotfix main branch (#158)
Browse files Browse the repository at this point in the history
* Hotfix

* Fix lint

* Fix lint
  • Loading branch information
moria97 authored Aug 20, 2024
1 parent 5963850 commit 1ad6dcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/pai_rag/app/web/tabs/chat_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ def reset_textbox():
def respond(input_elements: List[Any]):
global current_session_id
update_dict = {}

for element, value in input_elements.items():
update_dict[element.elem_id] = value

# empty input.
if not update_dict["question"]:
yield "", update_dict["chatbot"], 0
yield update_dict["chatbot"]
return

try:
rag_client.patch_config(update_dict)
Expand Down Expand Up @@ -61,7 +63,10 @@ def respond(input_elements: List[Any]):
raise gr.Error(f"HTTP {api_error.code} Error: {api_error.msg}")

content = ""
chatbot.append((msg, content))
if chatbot is None:
chatbot = [(msg, content)]
else:
chatbot.append((msg, content))
for resp in response_gen:
chatbot[-1] = (msg, resp.result)
yield chatbot
Expand Down
8 changes: 5 additions & 3 deletions src/pai_rag/app/web/tabs/upload_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import pandas as pd
import asyncio

IGNORE_FILE_LIST = [".DS_Store"]


def upload_knowledge(
upload_files,
Expand Down Expand Up @@ -46,9 +48,9 @@ def upload_knowledge(
)
my_upload_files = []
for file in upload_files:
my_upload_files.append(
MyUploadFile(os.path.basename(file.name), response["task_id"])
)
base_name = os.path.basename(file.name)
if base_name not in IGNORE_FILE_LIST:
my_upload_files.append(MyUploadFile(base_name, response["task_id"]))

result = {"Info": ["StartTime", "EndTime", "Duration(s)", "Status"]}
error_msg = ""
Expand Down

0 comments on commit 1ad6dcf

Please sign in to comment.