mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-18 16:27:31 +00:00
fix: Fix ChatExcel error
This commit is contained in:
parent
367ffe986c
commit
7a2ae64f83
@ -216,7 +216,7 @@ async def params_load(conv_uid: str, chat_mode: str, doc_file: UploadFile = File
|
|||||||
conv_uid=conv_uid, chat_mode=chat_mode, select_param=doc_file.filename
|
conv_uid=conv_uid, chat_mode=chat_mode, select_param=doc_file.filename
|
||||||
)
|
)
|
||||||
chat: BaseChat = get_chat_instance(dialogue)
|
chat: BaseChat = get_chat_instance(dialogue)
|
||||||
resp = chat.prepare()
|
resp = await chat.prepare()
|
||||||
|
|
||||||
### refresh messages
|
### refresh messages
|
||||||
return Result.succ(get_hist_messages(conv_uid))
|
return Result.succ(get_hist_messages(conv_uid))
|
||||||
@ -279,7 +279,7 @@ async def chat_prepare(dialogue: ConversationVo = Body()):
|
|||||||
chat: BaseChat = get_chat_instance(dialogue)
|
chat: BaseChat = get_chat_instance(dialogue)
|
||||||
if len(chat.history_message) > 0:
|
if len(chat.history_message) > 0:
|
||||||
return Result.succ(None)
|
return Result.succ(None)
|
||||||
resp = chat.prepare()
|
resp = await chat.prepare()
|
||||||
return Result.succ(resp)
|
return Result.succ(resp)
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class BaseChat(ABC):
|
|||||||
else:
|
else:
|
||||||
return self._blocking_nostream_call()
|
return self._blocking_nostream_call()
|
||||||
|
|
||||||
def prepare(self):
|
async def prepare(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def generate_llm_text(self) -> str:
|
def generate_llm_text(self) -> str:
|
||||||
|
@ -81,7 +81,7 @@ class ChatExcel(BaseChat):
|
|||||||
}
|
}
|
||||||
return input_values
|
return input_values
|
||||||
|
|
||||||
def prepare(self):
|
async def prepare(self):
|
||||||
logger.info(f"{self.chat_mode} prepare start!")
|
logger.info(f"{self.chat_mode} prepare start!")
|
||||||
if len(self.history_message) > 0:
|
if len(self.history_message) > 0:
|
||||||
return None
|
return None
|
||||||
@ -93,7 +93,7 @@ class ChatExcel(BaseChat):
|
|||||||
"excel_reader": self.excel_reader,
|
"excel_reader": self.excel_reader,
|
||||||
}
|
}
|
||||||
learn_chat = ExcelLearning(**chat_param)
|
learn_chat = ExcelLearning(**chat_param)
|
||||||
result = learn_chat.nostream_call()
|
result = await learn_chat.nostream_call()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def do_action(self, prompt_response):
|
def do_action(self, prompt_response):
|
||||||
|
@ -135,12 +135,13 @@ def pretty_print_semaphore(semaphore):
|
|||||||
|
|
||||||
|
|
||||||
def get_or_create_event_loop() -> asyncio.BaseEventLoop:
|
def get_or_create_event_loop() -> asyncio.BaseEventLoop:
|
||||||
|
loop = None
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
except Exception as e:
|
assert loop is not None
|
||||||
|
return loop
|
||||||
|
except RuntimeError as e:
|
||||||
if not "no running event loop" in str(e):
|
if not "no running event loop" in str(e):
|
||||||
raise e
|
raise e
|
||||||
logging.warning("Cant not get running event loop, create new event loop now")
|
logging.warning("Cant not get running event loop, create new event loop now")
|
||||||
loop = asyncio.new_event_loop()
|
return asyncio.get_event_loop_policy().get_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
|
||||||
return loop
|
|
||||||
|
Loading…
Reference in New Issue
Block a user