mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-04 18:10:02 +00:00
feat(editor): ChatExcel
🔥ChatExcel Mode Operation Manual
This commit is contained in:
parent
ff9ead0859
commit
c80878feef
@ -178,7 +178,7 @@ class BaseChat(ABC):
|
|||||||
|
|
||||||
async def nostream_call(self):
|
async def nostream_call(self):
|
||||||
payload = self.__call_base()
|
payload = self.__call_base()
|
||||||
logger.info(f"Requert: \n{payload}")
|
logger.info(f"Request: \n{payload}")
|
||||||
ai_response_text = ""
|
ai_response_text = ""
|
||||||
try:
|
try:
|
||||||
from pilot.model.worker.manager import worker_manager
|
from pilot.model.worker.manager import worker_manager
|
||||||
@ -231,12 +231,17 @@ class BaseChat(ABC):
|
|||||||
except StopAsyncIteration:
|
except StopAsyncIteration:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def _blocking_nostream_call(self):
|
def _blocking_nostream_call(self):
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"_blocking_nostream_call is only temporarily used in webserver and will be deleted soon, please use nostream_call to replace it for higher performance"
|
"_blocking_nostream_call is only temporarily used in webserver and will be deleted soon, please use nostream_call to replace it for higher performance"
|
||||||
)
|
)
|
||||||
loop = get_or_create_event_loop()
|
loop = get_or_create_event_loop()
|
||||||
|
try:
|
||||||
return loop.run_until_complete(self.nostream_call())
|
return loop.run_until_complete(self.nostream_call())
|
||||||
|
finally:
|
||||||
|
loop.close()
|
||||||
|
|
||||||
|
|
||||||
def call(self):
|
def call(self):
|
||||||
if self.prompt_template.stream_out:
|
if self.prompt_template.stream_out:
|
||||||
@ -244,7 +249,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:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from typing import List, Any, Dict
|
from typing import List, Any, Dict
|
||||||
from pilot.scene.base_message import (
|
from pilot.scene.base_message import (
|
||||||
@ -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.call()
|
result = await learn_chat.nostream_call()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def do_action(self, prompt_response):
|
def do_action(self, prompt_response):
|
||||||
|
Loading…
Reference in New Issue
Block a user